/* استایل‌های اضافی برای کارت‌های منو */

/* بهبود ظاهر کارت‌های منو */
.card {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-1);
}

/* بهبود ظاهر تصاویر در کارت‌ها */
.card .media img {
  transition: transform 0.3s ease;
  /* بهبود loading تصاویر */
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.card .media img.loaded {
  animation: none;
  background: none;
}

.card:hover .media img {
  transform: scale(1.05);
}

/* انیمیشن loading برای تصاویر */
@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* بهبود تصاویر برای موبایل */
@media (max-width: 768px) {
  .card .media img {
    transition: transform 0.2s ease;
    /* بهینه‌سازی برای موبایل */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    opacity: 0.9;
  }
  
  .card:hover .media img {
    transform: scale(1.02);
  }
}

/* بهبود ظاهر badge ها */
.card .badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* بهبود ظاهر label ها */
.card .labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.card .label {
  background: rgba(78, 205, 196, 0.2);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 500;
  border: 1px solid rgba(78, 205, 196, 0.3);
}

/* بهبود ظاهر قیمت */
.card .price {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--brand);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* بهبود ظاهر دکمه افزودن */
.card .add {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--bg);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.card .add:hover {
  background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

/* بهبود ظاهر آیتم‌های ویژه */
.featured-card {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.featured-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.2);
}

.featured-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--brand-3));
}

/* بهبود ظاهر فیلترها */
.chip {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.chip:hover::before {
  left: 100%;
}

.chip.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--bg);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

/* بهبود ظاهر مواد تشکیل‌دهنده */
.ingredients {
  background: rgba(78, 205, 196, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  margin: 8px 0;
}

/* بهبود ظاهر آلرژن‌ها */
.allergens {
  background: rgba(255, 92, 109, 0.1);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--danger);
  margin: 6px 0;
}

/* بهبود ظاهر زمان آماده‌سازی */
.prep-time {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(81, 207, 102, 0.1);
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid rgba(81, 207, 102, 0.3);
}

/* بهبود ظاهر responsive */
@media (max-width: 768px) {
  .card {
    margin-bottom: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  
  .featured-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .featured-card {
    padding: 16px;
    transition: transform 0.2s ease;
  }
  
  .featured-card:hover {
    transform: translateY(-1px);
  }
  
  .card .labels {
    gap: 4px;
    margin-top: 6px;
  }
  
  .card .label {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 6px;
  }
  
  /* بهبود دکمه افزودن برای موبایل */
  .card .add {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 12px;
    width: 100%;
    transition: all 0.2s ease;
  }
  
  .card .add:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 215, 0, 0.3);
  }
  
  /* بهبود badge برای موبایل */
  .card .badge {
    font-size: 11px;
    padding: 3px 6px;
    top: 8px;
    right: 8px;
    border-radius: 8px;
  }
  
  /* بهبود قیمت برای موبایل */
  .card .price {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  /* بهبود فیلترها برای موبایل */
  .chips {
    gap: 8px;
    margin: 16px 0;
    padding: 0 4px;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .chips::-webkit-scrollbar {
    display: none;
  }
  
  .chip {
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
    transition: all 0.2s ease;
  }
  
  .chip:hover {
    transform: translateY(-1px);
  }
  
  .chip.active {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 215, 0, 0.3);
  }
  
  /* بهبود section آیتم‌های ویژه برای موبایل */
  .featured-section {
    margin: 30px auto;
    padding: 0 16px;
  }
  
  .featured-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }
  
  /* بهبود empty state برای موبایل */
  .empty-menu {
    padding: 40px 16px;
  }
  
  .empty-menu h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
  }
  
  .empty-menu p {
    font-size: 14px;
    margin-bottom: 16px;
  }
  
  .empty-menu a {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 20px;
  }
}

/* بهبودهای موبایل کوچک (تا 480px) */
@media (max-width: 480px) {
  .card .content {
    padding: 12px;
  }
  
  .card .content h3 {
    font-size: 15px;
    line-height: 1.3;
  }
  
  .card .content p {
    font-size: 12px;
    line-height: 1.4;
  }
  
  .card .price {
    font-size: 16px;
  }
  
  .card .add {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .featured-card {
    padding: 12px;
  }
  
  .featured-card h3 {
    font-size: 15px;
  }
  
  .featured-card p {
    font-size: 12px;
  }
  
  .chips {
    padding: 0 2px;
  }
  
  .chip {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .featured-section {
    padding: 0 12px;
  }
  
  .featured-section h2 {
    font-size: 1.3rem;
  }
  
  .empty-menu {
    padding: 30px 12px;
  }
  
  .empty-menu h3 {
    font-size: 1.2rem;
  }
  
  .empty-menu p {
    font-size: 13px;
  }
}

/* انیمیشن‌های اضافی */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card[data-animate] {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

/* بهبود ظاهر loading state */
.card.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.card.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--brand);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10;
}

/* بهبود loading state برای موبایل */
@media (max-width: 768px) {
  .card.loading::after {
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-width: 2px;
  }
  
  .card.loading {
    opacity: 0.7;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* بهبود ظاهر empty state */
.empty-menu {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.empty-menu h3 {
  color: var(--text);
  margin-bottom: 15px;
  font-size: 1.5rem;
}

.empty-menu p {
  margin-bottom: 20px;
  line-height: 1.6;
}

.empty-menu a {
  display: inline-block;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--bg);
  padding: 12px 24px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.empty-menu a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 215, 0, 0.4);
}

/* بهبود ظاهر فیلترهای فعال */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.chip {
  padding: 8px 16px;
  border: 2px solid var(--surface-2);
  background: var(--surface);
  color: var(--text);
  border-radius: 25px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.chip:hover {
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
}

/* بهبود ظاهر section آیتم‌های ویژه */
.featured-section {
  margin: 40px auto;
  padding: 0 20px;
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.featured-section h2 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--brand);
  font-size: 2rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.featured-section h2::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 2px;
  /* بهبود performance برای موبایل */
  will-change: transform;
  transform: translateX(-50%) translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* بهبود performance کلی برای موبایل */
@media (max-width: 768px) {
  * {
    -webkit-tap-highlight-color: transparent;
  }
  
  .card, .chip, .btn, .add {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  /* بهبود scroll performance */
  .menu-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* بهبود image loading */
  .card .media img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  /* بهبود button states برای موبایل */
  .btn:active,
  .chip:active,
  .add:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  /* بهبود focus states برای موبایل */
  .btn:focus,
  .chip:focus,
  .add:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
  }
  
  /* بهبود accessibility برای موبایل */
  .btn, .chip, .add {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* بهبود loading states برای موبایل */
  .card.loading {
    opacity: 0.7;
  }
  
  .card.loading::after {
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-width: 2px;
  }
  
  /* بهبود empty state برای موبایل */
  .empty-menu {
    padding: 40px 16px;
  }
  
  .empty-menu h3 {
    font-size: 1.3rem;
    margin-bottom: 12px;
  }
  
  .empty-menu p {
    font-size: 14px;
    margin-bottom: 16px;
  }
  
  .empty-menu a {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 20px;
  }
  
  /* بهبود performance کلی */
  .card, .chip, .btn, .add, .featured-card {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  /* بهبود scroll performance */
  .menu-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* بهبود image loading */
  .card .media img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  /* بهبود touch interactions */
  .card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .btn:active,
  .chip:active,
  .add:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  /* بهبود accessibility برای موبایل */
  .btn, .chip, .add {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* بهبود focus states برای موبایل */
  .btn:focus,
  .chip:focus,
  .add:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
  }
  
  /* بهبود text selection */
  .card .content h3,
  .card .content p {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  /* بهبود button states */
  .btn:disabled,
  .add:disabled {
    opacity: 0.6;
    pointer-events: none;
  }
  
  /* بهبود performance کلی */
  .card, .chip, .btn, .add, .featured-card {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  /* بهبود scroll performance */
  .menu-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* بهبود image loading */
  .card .media img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  /* بهبود touch interactions */
  .card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .btn:active,
  .chip:active,
  .add:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  /* بهبود accessibility برای موبایل */
  .btn, .chip, .add {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* بهبود focus states برای موبایل */
  .btn:focus,
  .chip:focus,
  .add:focus {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
  }
  
  /* بهبود text selection */
  .card .content h3,
  .card .content p {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  /* بهبود button states */
  .btn:disabled,
  .add:disabled {
    opacity: 0.6;
    pointer-events: none;
  }
  
  /* بهبود performance کلی */
  .card, .chip, .btn, .add, .featured-card {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  
  /* بهبود scroll performance */
  .menu-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* بهبود image loading */
  .card .media img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  /* بهبود touch interactions */
  .card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .btn:active,
  .chip:active,
  .add:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
}

/* بهینه‌سازی‌های اضافی برای موبایل */
@media (max-width: 768px) {
  /* کاهش انیمیشن‌ها در موبایل */
  .card:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
  }
  
  .featured-card:hover {
    transform: translateY(-1px);
    transition: transform 0.2s ease;
  }
  
  /* بهینه‌سازی grid برای موبایل */
  .featured-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    /* کاهش reflow */
    contain: layout;
  }
  
  /* بهینه‌سازی فیلترها */
  .chips {
    /* کاهش repaints */
    contain: layout style;
    /* بهبود scroll */
    -webkit-overflow-scrolling: touch;
  }
  
  /* بهبود lazy loading */
  .lazy-load {
    opacity: 0.7;
    transition: opacity 0.3s ease;
  }
  
  .lazy-load.loaded {
    opacity: 1;
  }
  
  /* کاهش complexity انیمیشن‌ها */
  .card .media img {
    transition: transform 0.2s ease;
  }
  
  .card:hover .media img {
    transform: scale(1.02);
  }
  
  /* بهینه‌سازی performance کلی */
  .menu-container {
    contain: layout style paint;
  }
  
  .card, .featured-card {
    contain: layout style;
  }
}

/* بهینه‌سازی برای اتصال ضعیف */
.slow-connection .lazy-load {
  background: #f0f0f0;
  animation: none;
}

.slow-connection .card .media img {
  filter: blur(1px);
  transition: filter 0.3s ease;
}

.slow-connection .card .media img.loaded {
  filter: none;
}

/* کاهش انیمیشن‌ها برای دستگاه‌های ضعیف */
.reduced-motion * {
  animation-duration: 0.1s !important;
  transition-duration: 0.1s !important;
}

.reduced-motion .card:hover {
  transform: none;
}

.reduced-motion .featured-card:hover {
  transform: none;
}

/* بهبود performance برای دستگاه‌های قدیمی */
@media (max-width: 480px) and (max-height: 800px) {
  .card {
    contain: layout style paint;
  }
  
  .featured-card {
    contain: layout style paint;
  }
  
  .lazy-load {
    will-change: auto;
  }
  
  .lazy-load.loaded {
    will-change: auto;
  }
}
