/* Extracted from buy_medicine.html — catalog page styles */
.image-fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.image-fullscreen-overlay.active {
  opacity: 1;
  visibility: visible;
}

.fullscreen-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: hsla(35, 10%, 80%, 0.15);
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.fullscreen-close:hover {
  background: hsla(35, 12%, 80%, 0.25);
  transform: scale(1.1);
}

.fullscreen-image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 60px 20px;
}

.fullscreen-image {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  transition: transform 0.2s ease;
  cursor: grab;
}

.fullscreen-image:active {
  cursor: grabbing;
}

.zoom-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  padding: 12px 20px;
  background: hsla(35, 10%, 80%, 0.15);
  border-radius: 30px;
  backdrop-filter: blur(10px);
}

.zoom-btn-control {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: hsla(35, 12%, 80%, 0.2);
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.zoom-btn-control:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.1);
}

.zoom-btn-control:active {
  transform: scale(0.95);
}

/* Mobile optimizations for fullscreen */
@media (max-width: 768px) {
  .fullscreen-close {
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
  
  .fullscreen-image-container {
    padding: 50px 10px;
  }
  
  .zoom-controls {
    bottom: 20px;
    gap: 10px;
    padding: 10px 16px;
  }
  
  .zoom-btn-control {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
}

/* Safe area for iPhone X+ */
@supports (padding: max(0px)) {
  .fullscreen-close {
    top: max(20px, env(safe-area-inset-top));
    right: max(20px, env(safe-area-inset-right));
  }
  
  .zoom-controls {
    bottom: max(30px, env(safe-area-inset-bottom));
  }
}

/* ===== GLOBAL MOBILE FIX (catalog page only — do not leak to site navbar/layout) ===== */
body.catalog-page {
  overflow-x: hidden;
  width: 100%;
}

body.catalog-page .container,
body.catalog-page .container-fluid {
  max-width: 100%;
  padding-left: 15px;
  padding-right: 15px;
}

body.catalog-page .row {
  margin-left: 0;
  margin-right: 0;
  max-width: 100%;
}

body.catalog-page .row > * {
  padding-left: 12px;
  padding-right: 12px;
}

body.catalog-page img,
body.catalog-page video,
body.catalog-page iframe {
  max-width: 100%;
  height: auto;
}

/* ===== ROOT VARIABLES ===== */
:root {
  --vh: 1vh; /* برای حل مشکل viewport height در موبایل */
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
}

/* ===== BREADCRUMB NAVIGATION ===== */
.breadcrumb-navigation {
  background: linear-gradient(135deg, hsl(35, 18%, 90%) 0%, #e9ecef 100%);
  border-radius: 15px;
  padding: 15px 20px;
  border: 1px solid rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.breadcrumb-custom {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 8px;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-link {
  color: #007bff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.breadcrumb-link:hover {
  background: rgba(0, 123, 255, 0.1);
  color: #0056b3;
  transform: translateY(-1px);
}

.breadcrumb-text {
  display: flex;
  align-items: center;
  gap: 6px;
  color: hsl(215, 12%, 52%);
  font-weight: 600;
  padding: 8px 12px;
}

.breadcrumb-separator {
  color: hsl(35, 15%, 82%);
  font-size: 12px;
  margin: 0 4px;
}

.breadcrumb-clear-btn {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.breadcrumb-clear-btn:hover {
  background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* ===== SEARCH SCOPE INDICATOR ===== */
.search-scope-indicator {
  background: hsla(35, 10%, 80%, 0.15);
  border: 1px solid hsla(35, 12%, 80%, 0.2);
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: hsla(35, 25%, 92%, 0.9);
  backdrop-filter: blur(10px);
}

.search-scope-indicator i {
  color: hsla(35, 22%, 90%, 0.7);
}

.scope-clear-btn {
  background: hsla(35, 12%, 80%, 0.2);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsla(35, 25%, 92%, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 12px;
  margin-right: auto;
}

.scope-clear-btn:hover {
  background: hsla(35, 14%, 82%, 0.3);
  color: white;
  transform: scale(1.1);
}

/* ===== SEARCH RESULT INDICATOR ===== */
.search-result-indicator {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.2), rgba(32, 201, 151, 0.15));
  border: 1px solid rgba(40, 167, 69, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: white;
  backdrop-filter: blur(10px);
  animation: fadeInUp 0.4s ease-out;
}

.search-result-indicator i.fa-check-circle {
  color: #28a745;
  font-size: 1.1rem;
}

.clear-search-link {
  background: hsla(35, 12%, 80%, 0.2);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsla(35, 25%, 92%, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 12px;
  margin-inline-start: auto; /* direction-aware: pushes × to logical end (left in RTL) */
  text-decoration: none;
}

.clear-search-link:hover {
  background: rgba(220, 53, 69, 0.4);
  color: white;
  transform: scale(1.1);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== HERO SECTION ===== */
.hero-pharmacy {
  background: linear-gradient(135deg, #006e53 0%, #008c69 40%, #0a9e78 70%, #523db8 100%);
  min-height: 380px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  color: white;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  border-radius: 0 0 36px 36px;
  box-shadow: 0 16px 52px rgba(0, 140, 105, 0.3);
  padding: 48px 20px 72px;
  z-index: 1;
  margin-bottom: 0;
}

/* Hero Stats Bar */
.hero-stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.65rem 1.25rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  backdrop-filter: blur(10px);
  display: inline-flex;
}
.hero-stat-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}
.hero-stat-item i { font-size: 0.85rem; }
.hero-stat-sep {
  color: rgba(255,255,255,0.35);
  font-size: 0.75rem;
  margin: 0 0.15rem;
}
@media (max-width: 480px) {
  .hero-stats-bar { gap: 0.4rem; padding: 0.5rem 0.85rem; }
  .hero-stat-item { font-size: 0.75rem; }
  .hero-stat-sep:nth-child(6), .hero-stat-sep:nth-child(6) ~ * { display: none; }
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="hsla(35, 10%, 80%, 0.1)"/><circle cx="90" cy="30" r="1.5" fill="rgba(255,255,255,0.08)"/><circle cx="50" cy="70" r="1" fill="hsla(35, 10%, 80%, 0.1)"/><circle cx="30" cy="90" r="1.2" fill="rgba(255,255,255,0.06)"/></pattern></defs><rect width="100" height="100" fill="url("#grain#grain")"/></svg>');
}

/* Subtle inner highlight for depth */
.hero-background::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(255,255,255,0.18), rgba(255,255,255,0) 55%);
  pointer-events: none;
}

.floating-pills {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.pill {
  position: absolute;
  font-size: 2rem;
  opacity: 0.3;
  animation: float 6s ease-in-out infinite;
}

.pill-1 { top: 10%; left: 10%; animation-delay: 0s; }
.pill-2 { top: 20%; right: 15%; animation-delay: 1s; }
.pill-3 { bottom: 30%; left: 20%; animation-delay: 2s; }
.pill-4 { top: 60%; right: 20%; animation-delay: 3s; }
.pill-5 { bottom: 20%; right: 30%; animation-delay: 4s; }
.pill-6 { top: 40%; left: 5%; animation-delay: 5s; }

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(180deg); }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Wave transition at the bottom of hero for a modern curved finish */
.hero-pharmacy::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 110px;
  z-index: 1;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 120' preserveAspectRatio='none'><path fill='%23ffffff' d='M0,80 C240,120 480,0 720,40 C960,80 1200,120 1440,60 L1440,120 L0,120 Z'/></svg>") no-repeat center bottom / 100% 100%;
}

.hero-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  min-height: 4rem;
  line-height: 1;
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { 
    transform: scale(1);
    text-shadow: 0 0 20px hsla(35, 18%, 86%, 0.5);
  }
  50% { 
    transform: scale(1.1);
    text-shadow: 0 0 30px hsla(35, 25%, 92%, 0.8);
  }
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 12px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.2);
  animation: slideInDown 0.6s ease-out;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  margin-bottom: 32px;
  color: rgba(255, 255, 255, 0.9);
  animation: slideInUp 0.6s ease-out 0.2s both;
  line-height: 1.6;
}

@keyframes slideInDown {
  0% { opacity: 0; transform: translateY(-50px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
  0% { opacity: 0; transform: translateY(50px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== SEARCH SECTION (hero only — navbar uses .site-header .search-container) ===== */
.hero-pharmacy .search-container {
  max-width: 600px;
  margin: 0 auto;
  animation: fadeInScale 1s ease-out 0.6s both;
}

@keyframes fadeInScale {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.search-wrapper {
  position: relative;
  z-index: 9999;
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(20px);
  border-radius: 50px;
  padding: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  transition: all 0.3s ease;
  gap: 6px;
  overflow: hidden;
}

.search-input-group:hover,
.search-input-group:focus-within {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}

.search-icon {
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: hsla(35, 25%, 92%, 0.8);
  font-size: 1.2rem;
}

.search-input {
  flex: 1;
  min-width: 0; /* 🔥 CRITICAL: اجازه shrink شدن برای جلوگیری از overflow */
  border: none;
  background: transparent;
  color: white;
  font-size: 1.1rem;
  padding: 15px 20px;
  outline: none;
  text-overflow: ellipsis; /* 🔥 نمایش ... برای متن طولانی */
  white-space: nowrap;
  overflow: hidden;
  direction: rtl; /* 🔥 RTL برای فارسی */
}

.search-input:focus {
  white-space: normal; /* 🔥 در حالت focus متن کامل نمایش داده شود */
  overflow: visible;
  text-overflow: clip;
}

.search-input::placeholder {
  color: hsla(35, 22%, 90%, 0.7);
  font-style: italic;
  text-overflow: ellipsis;
  overflow: hidden;
}

.search-btn {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  color: #008c69;
  border: none;
  border-radius: 40px;
  padding: 13px 28px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.search-btn:hover {
  background: linear-gradient(135deg, #006e53, #452fa0);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 140, 105, 0.35);
}

/* RTL: keep search button on the start edge (right in Persian) */
[dir="rtl"] .hero-pharmacy .search-input-group .search-btn {
  order: -1;
}

[dir="rtl"] .hero-pharmacy .search-input-group .search-input {
  order: 0;
  text-align: right;
}

[dir="rtl"] .hero-pharmacy .search-input-group .search-icon {
  order: 1;
}

[dir="ltr"] .hero-pharmacy .search-input-group .search-input {
  text-align: left;
}

.search-suggestions {
  /* position:fixed escapes the hero's overflow:hidden — hero has no transform/filter
     so fixed elements are positioned relative to the viewport as expected.
     top/left/width are set by JS (initSearch → positionSuggestions). */
  position: fixed;
  background: #fff;
  border-radius: 16px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.04);
  z-index: 9999;
  display: none;
  scrollbar-width: thin;
  border: 1px solid rgba(0,0,0,0.06);
}
.search-suggestions .sg-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: all 0.2s ease;
  gap: 12px;
}
.search-suggestions .sg-item:last-child { border-bottom: none; }
.search-suggestions .sg-item:hover,
.search-suggestions .sg-item.sg-selected {
  background: rgba(0, 140, 105, 0.06);
}
.search-suggestions .sg-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
  background: #f8f9fa;
  padding: 4px;
  border: 1px solid rgba(0,0,0,0.06);
}
.search-suggestions .sg-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.search-suggestions .sg-name {
  font-size: 14px;
  font-weight: 600;
  color: #2d3436;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-suggestions .sg-sub {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-suggestions .sg-price {
  font-size: 13px;
  font-weight: 600;
  color: #4CAF50;
  white-space: nowrap;
  margin-inline-start: 12px;
}
.search-suggestions .sg-score {
  display: inline-block;
  height: 3px;
  background: #4CAF50;
  border-radius: 2px;
  margin-top: 4px;
}
.search-suggestions .sg-loading {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: 13px;
}
.search-suggestions .sg-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #ddd;
  border-top-color: #4CAF50;
  border-radius: 50%;
  animation: sg-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-inline-end: 6px;
}
@keyframes sg-spin { to { transform: rotate(360deg); } }
.search-suggestions .sg-no-results {
  padding: 24px 16px;
  text-align: center;
  color: #666;
  font-size: 13px;
}

/* ===== ENHANCED CATEGORIES SECTION ===== */
.categories-section {
  margin-top: 30px;
  position: relative;
  z-index: 10;
  margin-bottom: 40px;
  /* 🔥 CRITICAL FIX: جلوگیری از horizontal overflow */
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}

/* اطمینان از عدم overflow در container-fluid */
.categories-section .container-fluid {
  max-width: 1320px;
  margin-inline: auto;
  overflow-x: hidden;
  padding-left: clamp(1rem, 3vw, 2rem);
  padding-right: clamp(1rem, 3vw, 2rem);
}

/* Desktop Categories */
.categories-desktop {
  background: hsl(35, 25%, 92%);
  border-radius: 25px;
  box-shadow: 0 20px 60px rgba(0, 140, 105, 0.15);
  overflow: visible;
  border: 1px solid rgba(0, 140, 105, 0.1);
  position: relative;
  z-index: 100;
}

.categories-header {
  background: linear-gradient(135deg, #008c69, #006e53);
  color: white;
  padding: 25px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 25px 25px 0 0;
  position: relative;
  z-index: 101;
}

.categories-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-btn {
  background: hsla(35, 12%, 80%, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-btn:hover {
  background: hsla(35, 14%, 82%, 0.3);
  transform: scale(1.1);
}

.categories-grid {
  padding: clamp(1.25rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  background: hsl(35, 18%, 90%);
}

.category-tile {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: linear-gradient(135deg, hsl(35, 18%, 90%), hsl(35, 25%, 92%));
  border: 2px solid #e3e8ff;
  border-radius: 18px;
  text-decoration: none;
  color: #2d3748;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  /* جلوگیری از text selection */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* اطمینان از قابل کلیک بودن */
  touch-action: manipulation;
  /* بهبود accessibility */
  outline: none;
  min-height: 80px;
}

.category-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 140, 105, 0.1), transparent);
  transition: left 0.6s ease;
  pointer-events: none;
}

.category-tile:hover::before {
  left: 100%;
}

.category-tile:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 140, 105, 0.2);
  border-color: #008c69;
  text-decoration: none;
  color: #2d3748;
}

.category-tile:active {
  transform: translateY(-3px) scale(1.01);
}

.category-tile.active {
  background: linear-gradient(135deg, #008c69, #006e53);
  color: white;
  border-color: #008c69;
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 140, 105, 0.3);
}

.category-tile:focus-visible {
  outline: 3px solid rgba(0, 140, 105, 0.5);
  outline-offset: 2px;
}

.tile-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, rgba(0, 140, 105, 0.1), rgba(0, 110, 83, 0.1));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
  color: #008c69;
  transition: all 0.3s ease;
}

.category-tile.active .tile-icon {
  background: hsla(35, 12%, 80%, 0.2);
  color: white;
}

.tile-content {
  flex: 1;
}

.tile-title {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.tile-count {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* =====================================================
   🔥 Mobile Categories - Enhanced Modern UI
   ===================================================== */
.categories-mobile {
  background: linear-gradient(180deg, hsl(35, 25%, 92%) 0%, hsl(35, 18%, 90%) 100%);
  border-radius: 28px;
  box-shadow: 
    0 20px 40px rgba(0, 140, 105, 0.12),
    0 8px 16px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 hsla(35, 25%, 92%, 0.9);
  margin-top: 20px !important;
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(0, 140, 105, 0.1);
}

.mobile-header {
  background: linear-gradient(135deg, #008c69 0%, #006e53 50%, #f9a802 100%);
  color: white;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 100 !important;
  border-radius: 28px 28px 0 0;
  min-height: 65px !important;
  width: 100%;
  overflow: visible !important;
  /* گلس افکت */
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 140, 105, 0.3);
}

.mobile-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.mobile-title i {
  font-size: 1.1rem;
  opacity: 0.9;
}

.mobile-filter-btn {
  background: hsla(35, 12%, 80%, 0.25);
  border: 2px solid hsla(35, 14%, 82%, 0.3);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  /* 🔥 CRITICAL FIX: z-index بسیار بالا و visibility اجباری */
  position: relative;
  z-index: 101 !important;
  flex-shrink: 0;
  /* بهبود touch */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  /* visibility اجباری */
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: all !important;
}

.mobile-filter-btn:hover {
  background: hsla(35, 16%, 84%, 0.4);
  transform: scale(1.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mobile-filter-btn:active {
  transform: scale(0.95);
  background: hsla(35, 18%, 86%, 0.5);
}

/* حذف debug styles قبلی */
@media (max-width: 991px) {
  .mobile-filter-btn {
    background: hsla(35, 12%, 80%, 0.25) !important;
    border: 2px solid hsla(35, 14%, 82%, 0.3) !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 101 !important;
  }
  
  .mobile-header {
    display: flex !important;
    visibility: visible !important;
    z-index: 100 !important;
  }
}

/* Horizontal Scroll Categories - Enhanced */
.categories-scroll-container {
  position: relative;
  padding: 20px 0 25px;
  width: 100%;
  max-width: 100%;
  overflow: visible !important;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(0, 140, 105, 0.03) 0%, transparent 100%);
}

.categories-scroll {
  display: flex;
  gap: 10px;
  padding: 10px 16px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  /* اسکرول روان و طبیعی */
  scroll-snap-type: none;
  max-width: 100%;
  box-sizing: border-box;
  touch-action: pan-x;
  user-select: none;
  -webkit-user-select: none;
  /* بهبود عملکرد */
  will-change: scroll-position;
  overscroll-behavior-x: contain;
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

/* 🔥 Enhanced Scroll Chips - Smooth Touch */
.scroll-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(145deg, hsl(35, 25%, 92%), hsl(35, 18%, 90%));
  border-radius: 14px;
  text-decoration: none;
  color: #334155;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1.5px solid rgba(0, 140, 105, 0.15);
  box-shadow: 0 2px 8px rgba(0, 140, 105, 0.1);
  min-height: 48px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* اجازه اسکرول در هر دو جهت */
  touch-action: pan-x pan-y;
  min-width: 100px;
  max-width: 150px;
  position: relative;
}

/* نوار رنگی بالای chip */
.scroll-chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #008c69, #006e53);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.scroll-chip.active::before {
  opacity: 1;
}

.scroll-chip.active {
  background: linear-gradient(135deg, #008c69 0%, #006e53 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 140, 105, 0.3);
}

.scroll-chip:active {
  opacity: 0.8;
}

/* 🔥 Enhanced Chip Icon */
.chip-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, rgba(0, 140, 105, 0.15), rgba(0, 110, 83, 0.1));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #008c69;
  flex-shrink: 0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 140, 105, 0.15);
}

.scroll-chip:hover .chip-icon,
.scroll-chip.active .chip-icon {
  background: hsla(35, 12%, 80%, 0.25);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 🔥 Enhanced Chip Text */
.chip-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.chip-title {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.chip-count {
  font-size: 0.7rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.scroll-chip:hover .chip-count,
.scroll-chip.active .chip-count {
  opacity: 0.9;
}

/* 🔥 Enhanced Scroll Indicators */
.scroll-indicators {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  padding: 0 8px;
}

.scroll-btn {
  background: linear-gradient(145deg, hsl(35, 25%, 92%), hsl(35, 18%, 90%));
  border: 1.5px solid rgba(0, 140, 105, 0.2);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #008c69;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
  box-shadow: 
    0 4px 12px rgba(0, 140, 105, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.08);
  opacity: 0.95;
  min-width: 36px;
  min-height: 36px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  z-index: 10;
  font-size: 0.8rem;
}

.scroll-btn:hover:not([disabled]) {
  background: linear-gradient(135deg, #008c69, #006e53);
  color: white;
  border-color: transparent;
  transform: scale(1.15);
  box-shadow: 0 6px 18px rgba(0, 140, 105, 0.35);
}

.scroll-btn:active:not([disabled]) {
  transform: scale(0.92);
}

.scroll-btn[disabled] {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.scroll-left {
  right: auto;
  left: 8px;
}

.scroll-right {
  left: auto;
  right: 8px;
}

/* 🔥 Enhanced Mobile Categories Modal */
.mobile-categories-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: calc(var(--vh, 1vh) * 100) !important;
  z-index: 999999 !important;
  display: none !important;
  opacity: 0;
  transition: opacity 0.35s ease;
  flex-direction: column;
  justify-content: flex-end;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  pointer-events: none;
}

.mobile-categories-modal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.mobile-categories-modal .modal-backdrop {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.7) 100%) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1 !important;
  opacity: 1;
  transition: opacity 0.35s ease;
  cursor: pointer;
  pointer-events: auto !important;
}

.mobile-categories-modal:not(.active) .modal-backdrop {
  opacity: 0;
  pointer-events: none !important;
}

.mobile-categories-modal .modal-content {
  position: relative !important;
  background: linear-gradient(180deg, hsl(35, 25%, 92%) 0%, hsl(35, 18%, 90%) 100%) !important;
  border-radius: 28px 28px 0 0 !important;
  max-height: 80vh !important;
  max-height: calc(var(--vh, 1vh) * 80) !important;
  min-height: 55vh !important;
  min-height: calc(var(--vh, 1vh) * 55) !important;
  overflow: hidden !important;
  box-shadow: 
    0 -20px 50px rgba(0, 140, 105, 0.2),
    0 -8px 25px rgba(0,0,0,0.15) !important;
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2 !important;
  width: 100% !important;
  max-width: 100vw !important;
  flex-shrink: 0;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
  padding-bottom: max(20px, var(--safe-area-inset-bottom));
  display: flex !important;
  flex-direction: column !important;
  pointer-events: auto !important;
}

.mobile-categories-modal.active .modal-content {
  transform: translateY(0) !important;
}

/* نشانگر برای کشیدن مودال - بهبود یافته */
.mobile-categories-modal .modal-content::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 5px;
  background: linear-gradient(90deg, #d1d5db, #9ca3af, #d1d5db);
  border-radius: 3px;
  z-index: 10;
  flex-shrink: 0;
}

.mobile-categories-modal .modal-header {
  background: linear-gradient(135deg, #008c69 0%, #006e53 50%, #f9a802 100%);
  color: white;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-radius: 28px 28px 0 0;
  /* Drag handle indicator */
  position: relative;
  cursor: grab;
  touch-action: pan-y;
}

.mobile-categories-modal .modal-header::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: hsla(35, 18%, 86%, 0.5);
  border-radius: 2px;
}

.mobile-categories-modal .modal-header h5 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-categories-modal .modal-header h5 i {
  font-size: 1rem;
  opacity: 0.9;
}

/* 🔥 Modal Search Box */
.modal-search-box {
  padding: 16px 20px 12px;
  background: hsl(35, 25%, 92%);
  border-bottom: 1px solid rgba(0, 140, 105, 0.1);
  flex-shrink: 0;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  right: 14px;
  color: #9ca3af;
  font-size: 0.9rem;
  pointer-events: none;
  transition: color 0.3s ease;
}

.category-search-input {
  width: 100%;
  padding: 12px 42px 12px 40px;
  border: 1.5px solid rgba(0, 140, 105, 0.2);
  border-radius: 12px;
  font-size: 0.95rem;
  background: linear-gradient(145deg, hsl(35, 18%, 90%), hsl(40, 16%, 96%));
  color: #334155;
  transition: all 0.3s ease;
  outline: none;
  font-family: inherit;
}

.category-search-input::placeholder {
  color: #9ca3af;
}

.category-search-input:focus {
  border-color: #008c69;
  background: hsl(35, 25%, 92%);
  box-shadow: 0 0 0 3px rgba(0, 140, 105, 0.1);
}

.category-search-input:focus + .search-icon,
.search-input-wrapper:focus-within .search-icon {
  color: #008c69;
}

.clear-search-btn {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.clear-search-btn:hover {
  color: #ef4444;
  transform: scale(1.1);
}

/* No Results Message */
.no-results-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #9ca3af;
  text-align: center;
  gap: 12px;
}

.no-results-message i {
  font-size: 2.5rem;
  color: #d1d5db;
}

.no-results-message span {
  font-size: 0.95rem;
}

.mobile-categories-modal .modal-close {
  background: hsla(35, 12%, 80%, 0.25);
  border: 2px solid hsla(35, 14%, 82%, 0.3);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.mobile-categories-modal .modal-close:hover {
  background: hsla(35, 16%, 84%, 0.4);
  transform: scale(1.1) rotate(90deg);
}

.mobile-categories-modal .modal-body {
  padding: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* اسکرول آزاد و ایزوله */
  touch-action: pan-y;
  background: linear-gradient(180deg, hsl(35, 25%, 92%) 0%, hsl(35, 18%, 90%) 100%);
  /* جلوگیری از propagation اسکرول */
  isolation: isolate;
}

/* بهبود scrollbar در موبایل */
.mobile-categories-modal .modal-body::-webkit-scrollbar {
  width: 5px;
}

.mobile-categories-modal .modal-body::-webkit-scrollbar-track {
  background: rgba(0, 140, 105, 0.05);
}

.mobile-categories-modal .modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #008c69, #006e53);
  border-radius: 5px;
}

.mobile-categories-modal .modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #006e53, #523db8);
}

.categories-list {
  padding: 8px 0 20px;
  position: relative;
}

/* 🔥 Enhanced List Items */
.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  margin: 3px 12px;
  text-decoration: none;
  color: #334155;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-bottom: none;
  border-radius: 12px;
  cursor: pointer;
  min-height: 58px;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: rgba(0, 140, 105, 0.1);
  touch-action: pan-y;
  position: relative;
  border: 1.5px solid transparent;
}

.list-item:hover {
  background: rgba(0, 140, 105, 0.08);
  border-color: rgba(0, 140, 105, 0.15);
  text-decoration: none;
  transform: translateX(-4px);
}

.list-item.active {
  background: linear-gradient(135deg, #008c69 0%, #006e53 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(0, 140, 105, 0.35);
  transform: scale(1.01);
}

.list-item:active {
  opacity: 0.9;
  transform: scale(0.98);
}

/* 🔥 Enhanced Item Icon */
.item-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, rgba(0, 140, 105, 0.12), rgba(0, 110, 83, 0.08));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #008c69;
  flex-shrink: 0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 140, 105, 0.12);
}

.list-item:hover .item-icon {
  background: linear-gradient(135deg, rgba(0, 140, 105, 0.2), rgba(0, 110, 83, 0.15));
}

.list-item.active .item-icon {
  background: hsla(35, 12%, 80%, 0.25);
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item.active .item-title {
  color: white;
}

.item-count {
  font-size: 0.8rem;
  opacity: 0.65;
  font-weight: 500;
}

.list-item.active .item-count {
  opacity: 0.85;
  color: hsla(35, 25%, 92%, 0.9);
}

.item-arrow {
  color: #cbd5e0;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.list-item:hover .item-arrow {
  color: #008c69;
}

.list-item.active .item-arrow {
  color: hsla(35, 25%, 92%, 0.8);
}

/* ===== ENHANCED PRODUCTS SECTION ===== */
.products-section {
  margin-top: 30px;
}

.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 0 10px;
  flex-wrap: wrap;
  gap: 20px;
}

.products-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* View Toggle */
.view-toggle {
  display: flex;
  background: hsl(35, 18%, 90%);
  border-radius: 12px;
  padding: 4px;
  border: 2px solid #e9ecef;
}

.view-btn {
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  color: hsl(215, 12%, 52%);
  cursor: pointer;
  transition: all 0.3s ease;
}

.view-btn.active,
.view-btn:hover {
  background: linear-gradient(135deg, #008c69, #006e53);
  color: white;
}

/* Products Grid Enhanced */
.products-grid {
  display: grid;
  gap: 22px;
  padding: 0 5px;
  /* Ensure proper overflow handling */
  max-width: 100%;
  overflow: hidden;
}

/* Grid items default to min-width:auto, so a card whose content is wider than
   its track refuses to shrink and overflows — which the container's
   overflow:hidden then CLIPS off the (right) edge on narrow phones. Allowing
   items + their media to shrink to the track keeps every card fully visible. */
.products-grid > *,
.products-grid .product-card-wrapper,
.products-grid .product-card {
  min-width: 0;
}
.products-grid .product-image {
  max-width: 100%;
  height: auto;
}

.products-grid.view-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.products-grid.view-list {
  grid-template-columns: 1fr;
}

.products-grid.view-list .product-card {
  display: flex;
  flex-direction: row;
  max-width: none;
  height: auto;
}

.products-grid.view-list .product-image-container {
  width: 200px;
  flex-shrink: 0;
}

.products-grid.view-list .product-info {
  flex: 1;
  padding: 25px 30px;
}

/* Enhanced Product Cards */

/* Product Rating */
.product-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}

.stars {
  display: flex;
  gap: 2px;
  align-items: center;
}

.stars i {
  font-size: 0.9rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.stars i.fas {
  color: #ffc107;
  text-shadow: 0 1px 2px rgba(255, 193, 7, 0.3);
}

.stars i.far {
  color: #ddd;
}

.stars i:hover {
  transform: scale(1.1);
}

.rating-text {
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
  white-space: nowrap;
}

.rating-text {
  font-size: 0.8rem;
  color: hsl(215, 12%, 52%);
}

/* Enhanced Product Cards */
.product-card-wrapper {
  animation: fadeInUp 0.6s ease-out;
  /* Prevent card overflow */
  max-width: 100%;
  box-sizing: border-box;
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card {
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
  border: 1px solid rgba(0,0,0,0.06);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  height: 100%;
  display: flex;
  flex-direction: column;
  /* Ensure cards don't overflow */
  max-width: 100%;
  box-sizing: border-box;
  /* 🔥 FIX: بهینه‌سازی لمسی موبایل */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* بهبود تجربه hover در دسکتاپ */
@media (hover: hover) and (pointer: fine) {
  .product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 140, 105, 0.15);
    border-color: rgba(0, 140, 105, 0.2);
  }
}

/* فیدبک لمسی در موبایل */
.product-card:active {
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

.product-image-container {
  position: relative;
  height: 220px;
  background: linear-gradient(135deg, hsl(35, 18%, 90%), #e8ecff);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
  padding: 20px;
  max-width: 100%;
}

/* Desktop-only hover effects for product image/overlay */
@media (hover: hover) and (pointer: fine) {
  .product-card:hover .product-image {
    transform: scale(1.1);
  }
}

.product-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 140, 105, 0.9), rgba(0, 110, 83, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  opacity: 0;
  transition: opacity 0.3s ease;
  /* 🔥 FIX: وقتی پنهانه نباید click را بلاک کنه */
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .product-card:hover .product-overlay {
    opacity: 1;
    /* وقتی نمایان شد click ها را بگیره */
    pointer-events: auto;
  }
}

.overlay-btn {
  width: 50px;
  height: 50px;
  background: hsl(35, 25%, 92%);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #008c69;
  cursor: pointer;
  transition: all 0.3s ease;
  transform: translateY(20px);
  /* 🔥 FIX: اطمینان از کار کردن در موبایل */
  position: relative;
  z-index: 30;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
  .product-card:hover .overlay-btn {
    transform: translateY(0);
  }
}

/* فقط در دسکتاپ hover */
@media (hover: hover) and (pointer: fine) {
  .overlay-btn:hover {
    background: #008c69;
    color: white;
    transform: scale(1.1);
  }
}

/* فیدبک لمسی موبایل */
.overlay-btn:active {
  background: #008c69;
  color: white;
  transform: scale(0.95);
}

.product-price-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #008c69, #00a67e);
  color: white;
  padding: 6px 14px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 140, 105, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  z-index: 3;
  opacity: 1;
  transform: scale(1);
  line-height: 1.3;
  min-width: auto;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  max-width: none;
  letter-spacing: -0.02em;
}

.product-price-badge:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.5);
  background: linear-gradient(135deg, #66bb6a, #4caf50);
}

.product-info {
  padding: 25px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 15px;
  line-height: 1.3;
}

.product-title-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

.product-title-link:hover {
  color: #008c69;
}

/* Product Expiry Date */
.product-expiry {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-radius: 10px;
  border-left: 3px solid #0ea5e9;
}

.product-expiry i {
  color: #0284c7;
  font-size: 0.9rem;
}

.expiry-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0c4a6e;
  direction: ltr;
  text-align: left;
}

.expiry-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 12px;
  margin-left: 6px;
  font-weight: 500;
}

.badge-success {
  background: #dcfce7;
  color: #15803d;
}

.badge-warning {
  background: #fef3c7;
  color: #d97706;
}

.badge-danger {
  background: #fee2e2;
  color: #dc2626;
}

.product-description {
  flex: 1;
  margin-bottom: 20px;
}

.description-text {
  color: #718096;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 10px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.description-text.collapsed {
  max-height: 60px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.toggle-description {
  background: none;
  border: none;
  color: #008c69;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
  padding: 0;
  text-decoration: none;
}

.toggle-description:hover {
  color: #006e53;
  text-decoration: none;
}

.view-product-link {
  background: linear-gradient(135deg, rgba(0, 140, 105, 0.1), rgba(0, 110, 83, 0.1));
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  margin-top: 0.5rem;
}

.view-product-link:hover {
  background: linear-gradient(135deg, rgba(0, 140, 105, 0.2), rgba(0, 110, 83, 0.2));
}

.toggle-icon {
  transition: transform 0.3s ease;
}

.toggle-description.expanded .toggle-icon {
  transform: rotate(180deg);
}

.product-actions {
  margin-top: auto;
}

.add-to-cart-form {
  display: flex;
  gap: 15px;
  align-items: center;
}

.quantity-selector {
  display: flex;
  background: #f7fafc;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid hsl(35, 15%, 82%);
  /* 🔥 FIX: لایه محافظ - جلوگیری از click propagation */
  position: relative;
  z-index: 15;
  isolation: isolate;
}

.qty-btn {
  width: 40px;
  height: 40px;
  background: hsl(35, 25%, 92%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #008c69;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  /* 🔥 FIX: بهینه‌سازی برای موبایل - جلوگیری از تداخل */
  position: relative;
  z-index: 20;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}

/* فقط در دسکتاپ hover کار کند */
@media (hover: hover) and (pointer: fine) {
  .qty-btn:hover {
    background: #008c69;
    color: white;
  }
}

/* فیدبک لمسی موبایل */
.qty-btn:active {
  background: #008c69;
  color: white;
  transform: scale(0.9);
}

.qty-input {
  width: 50px;
  height: 40px;
  border: none;
  text-align: center;
  font-weight: 600;
  color: #2d3748;
  background: hsl(35, 25%, 92%);
  outline: none;
  /* 🔥 FIX: جلوگیری از click propagation */
  position: relative;
  z-index: 20;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.add-to-cart-btn {
  flex: 1;
  background: linear-gradient(135deg, #008c69, #006e53);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-to-cart-btn:hover {
  background: linear-gradient(135deg, #006e53, #523db8);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 140, 105, 0.4);
}

/* ===== NO PRODUCTS MESSAGE ===== */
.no-products-message {
  text-align: center;
  padding: 80px 20px;
  color: #718096;
}

.no-products-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.no-products-message h5 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: #4a5568;
}

.clear-filters-btn {
  background: linear-gradient(135deg, #008c69, #006e53);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 25px;
  font-weight: 600;
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.clear-filters-btn:hover {
  background: linear-gradient(135deg, #006e53, #523db8);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 140, 105, 0.4);
}

/* ===== PAGINATION ===== */
.pagination-section {
  margin-top: 40px;
  padding: 0;
}

.pagination-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pagination-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 8px 4px;
}
.pagination-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

.pagination-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 6px;
  justify-content: center;
  width: max-content;
  min-width: 100%;
}

.pagination-item {
  margin: 0;
  flex-shrink: 0;
}

.pagination-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 42px;
  color: #94a3b8;
  font-weight: 600;
  font-size: 1rem;
}

.pagination-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  color: #475569;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.2s ease;
  padding: 0 6px;
  -webkit-tap-highlight-color: transparent;
}

.pagination-link:hover {
  background: #f0fdf4;
  border-color: #008c69;
  color: #008c69;
  text-decoration: none;
}

.pagination-item.active .pagination-link {
  background: linear-gradient(135deg, #008c69, #00a67e);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0, 140, 105, 0.3);
  text-decoration: none;
}

.pagination-link.prev,
.pagination-link.next {
  width: auto;
  padding: 0 16px;
  gap: 6px;
  font-size: 0.82rem;
  background: #f8fafc;
}

.pagination-indicator {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 500;
}

/* ===== LEGACY MODAL STYLES (kept for fallback) ===== */
/* Note: Enhanced modal styles are defined in a separate style block */
.product-modal:not(.product-modal-enhanced) {
  border-radius: 25px;
  border: none;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

/* Ensure Bootstrap product modal isn't affected by mobile modal styles */
#productDetailModal {
  z-index: 1055 !important; /* بالاتر از modal دسته‌بندی */
}

#productDetailModal .modal-dialog {
  margin: 1.75rem auto;
  max-width: 90vw;
}

#productDetailModal .modal-content {
  transform: none !important;
  will-change: transform, opacity;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

#productDetailModal .modal-backdrop {
  z-index: 1050 !important;
  background-color: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(5px);
}

.modal-header {
  background: linear-gradient(135deg, #008c69, #006e53);
  color: white;
  border: none;
  padding: 25px 30px;
  position: relative;
  flex-shrink: 0;
}

.modal-header-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.modal-icon {
  width: 50px;
  height: 50px;
  background: hsla(35, 12%, 80%, 0.2);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: hsla(35, 12%, 80%, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.modal-close-btn:hover {
  background: hsla(35, 14%, 82%, 0.3);
  transform: scale(1.1);
}

/* Tab Navigation */
.modal-tabs-nav {
  display: flex;
  gap: 10px;
  padding: 0 20px;
  background: hsl(35, 18%, 90%);
  border-bottom: 2px solid #e0e0e0;
  flex-shrink: 0;
}

.modal-body {
  padding: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar for Modal Body */
.modal-body::-webkit-scrollbar {
  width: 10px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #008c69, #006e53);
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #006e53, #008c69);
}

.product-detail-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.product-detail-image {
  position: relative;
}

.image-wrapper {
  position: relative;
  background: linear-gradient(135deg, hsl(35, 18%, 90%), #e8ecff);
  border-radius: 20px;
  padding: 25px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.detail-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 450px;
  object-fit: contain;
  border-radius: 15px;
}

.image-zoom-btn {
  position: absolute;
  bottom: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: rgba(0, 140, 105, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.image-zoom-btn:hover {
  background: #008c69;
  transform: scale(1.1);
}

.product-detail-info {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.product-price-section {
  position: relative;
}

.price-label {
  color: #718096;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.price-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: #2d3748;
  margin-bottom: 15px;
}

.price-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #4caf50, #66bb6a);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.product-description-section {
  background: #f7fafc;
  padding: 25px;
  border-radius: 15px;
  border: 2px solid hsl(35, 15%, 82%);
}

.description-title {
  color: #2d3748;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.description-content {
  color: #4a5568;
  line-height: 1.6;
  font-size: 0.95rem;
}

.product-expiry-section {
  margin-top: 20px;
  padding: 15px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-radius: 12px;
  border-left: 4px solid #0ea5e9;
}

.expiry-title {
  color: #0c4a6e;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.expiry-title i {
  color: #0284c7;
}

.modal-expiry-content {
  color: #0c4a6e;
  font-size: 1rem;
  font-weight: 600;
  direction: ltr;
  text-align: left;
}

.product-features {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #4a5568;
  font-weight: 600;
}

.feature-item i {
  color: #008c69;
  font-size: 1.1rem;
}

.modal-footer {
  padding: 25px 30px;
  border: none;
  background: #f7fafc;
  flex-shrink: 0;
  border-top: 1px solid hsl(35, 15%, 82%);
}

.modal-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}

.action-btn {
  padding: 15px 30px;
  border: none;
  border-radius: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: auto;
  position: relative;
  z-index: 10;
}

.action-btn i {
  pointer-events: none;
}

.secondary-btn {
  background: hsl(35, 15%, 82%);
  color: #4a5568;
}

.secondary-btn:hover {
  background: #cbd5e0;
  transform: translateY(-2px);
}

.primary-btn {
  background: linear-gradient(135deg, #008c69, #006e53);
  color: white;
}

.primary-btn:hover {
  background: linear-gradient(135deg, #006e53, #523db8);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 140, 105, 0.4);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1400px) {
  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
  }
  
  .products-grid.view-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 1200px) {
  .hero-pharmacy {
    min-height: 420px;
    padding: 45px 25px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 15px;
    padding: 20px;
  }
  
  .products-grid.view-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
  }
  
  .product-image-container {
    height: 220px;
  }
  
  .products-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .products-controls {
    width: 100%;
    justify-content: space-between;
  }
}

@media (min-width: 1200px) {
  /* تنظیمات دسکتاپ بزرگ */
  .product-price-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 10px;
    min-width: 50px;
  }
}

@media (min-width: 992px) and (max-width: 1199px) {
  /* تنظیمات دسکتاپ متوسط */
  .product-price-badge {
    font-size: 0.65rem;
    padding: 3px 7px;
    border-radius: 8px;
    min-width: 42px;
  }
}

@media (max-width: 992px) {
  /* Hide desktop categories */
  .categories-desktop {
    display: none !important;
  }
  
  /* Show mobile categories */
  .categories-mobile {
    display: block;
  }
  
  .hero-pharmacy {
    min-height: 50vh;
    margin-bottom: 0 !important;
    padding: 40px 20px;
  }
  
  .hero-title {
    font-size: 2.2rem;
  }
  
  .hero-pharmacy .search-container {
    max-width: 500px;
  }
  
  .categories-section {
    margin-top: 20px !important;
    padding-top: 0;
  }
  
  .categories-mobile {
    margin-top: 0 !important;
  }
  
  .products-grid.view-grid {
    /* Force exactly 2 equal columns that always fit the viewport.
       auto-fill + minmax(220px,..) was overflowing on narrow phones (cards
       clipped off the right edge); minmax(0,1fr) lets tracks shrink to fit. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .product-image-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .product-image {
    padding: 15px;
  }
  
  .products-grid.view-list .product-card {
    flex-direction: column;
  }
  
  .products-grid.view-list .product-image-container {
    width: 100%;
    height: 200px;
  }
  
  /* تنظیمات قیمت برای تبلت */
  .product-price-badge {
    font-size: 0.6rem;
    padding: 3px 6px;
    top: 7px;
    right: 7px;
    border-radius: 7px;
    min-width: 38px;
  }
  
  /* Hide view toggle on tablets — grid is forced anyway */
  .view-toggle {
    display: none;
  }
}

@media (max-width: 768px) {
  /* 🔥 بهینه‌سازی کامل موبایل - All-in-One */
  
  /* Global (catalog page only) */
  body.catalog-page {
    overflow-x: hidden;
  }
  
  body.catalog-page .container {
    padding-left: 12px;
    padding-right: 12px;
    max-width: 100%;
  }
  
  /* Breadcrumb */
  .breadcrumb-navigation {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .breadcrumb-custom {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .breadcrumb-link, .breadcrumb-text {
    font-size: 13px;
    padding: 6px 10px;
  }
  
  .breadcrumb-clear-btn {
    font-size: 13px;
    padding: 6px 12px;
  }
  
  /* Hero */
  .hero-pharmacy {
    min-height: 380px;
    padding: 35px 18px;
    border-radius: 18px 18px 35px 35px;
    margin: 0 10px 18px;
    width: calc(100% - 20px);
  }
  
  .hero-title {
    font-size: 2rem;
    margin-bottom: 12px;
  }
  
  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 22px;
  }
  
  .hero-pharmacy::after {
    height: 60px;
  }
  
  .floating-pills .pill {
    font-size: 1.3rem;
    opacity: 0.2;
  }
  
  /* Search */
  .hero-pharmacy .search-container {
    max-width: 100%;
    padding: 0 10px;
  }
  
  .search-input-group {
    padding: 9px;
    border-radius: 22px;
    flex-wrap: nowrap; /* 🔥 جلوگیری از wrap شدن */
  }
  
  .search-input {
    padding: 11px 14px;
    font-size: 16px;
    min-width: 0; /* 🔥 CRITICAL FIX */
    flex: 1 1 auto;
  }
  
  .search-btn {
    padding: 10px 14px;
    min-width: 75px;
    border-radius: 18px;
    flex-shrink: 0; /* 🔥 دکمه کوچک نشود */
    white-space: nowrap;
  }
  
  .search-btn span {
    display: none; /* 🔥 در موبایل فقط آیکون نمایش داده شود */
  }
  
  .search-btn i {
    margin: 0;
  }
  
  /* Categories Mobile */
  .categories-section {
    margin: 18px 10px 0 !important;
    padding: 0;
  }
  
  .categories-mobile {
    background: hsl(35, 25%, 92%);
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(0, 140, 105, 0.12);
  }
  
  .mobile-header {
    background: linear-gradient(135deg, #008c69, #006e53);
    border-radius: 18px 18px 0 0;
    padding: 16px 18px;
    min-height: 65px;
  }
  
  .mobile-filter-btn {
    min-width: 38px;
    min-height: 38px;
    padding: 7px 11px;
    border-radius: 11px;
  }
  
  .categories-scroll {
    padding: 0 10px 6px;
    gap: 9px;
  }
  
  .scroll-chip {
    min-width: 85px;
    max-width: 115px;
    padding: 11px 9px;
    gap: 5px;
    border-radius: 14px;
  }
  
  .chip-icon {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
  }
  
  .chip-title {
    font-size: 0.72rem;
  }
  
  .chip-count {
    font-size: 0.63rem;
  }
  
  /* === Products Grid === */
  .products-section {
    padding: 18px 12px;
    margin: 0 auto;
    max-width: 100%;
  }
  
  .products-title {
    font-size: 1.35rem;
  }
  
  .products-grid.view-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .product-card {
    border-radius: 16px;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
  
  .product-image-container {
    height: 155px;
  }
  
  .product-image {
    padding: 14px;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  
  .product-info {
    padding: 11px;
  }
  
  .product-title {
    font-size: 0.83rem;
    margin-bottom: 7px;
  }
  
  .product-expiry {
    padding: 3px 5px;
    font-size: 0.68rem;
  }
  
  .stars i {
    font-size: 0.68rem;
  }
  
  .rating-text {
    font-size: 0.63rem;
  }
  
  .add-to-cart-btn {
    padding: 9px 11px;
    font-size: 0.78rem;
  }
  
  .qty-btn {
    width: 26px;
    height: 26px;
  }
  
  .qty-input {
    width: 33px;
    height: 26px;
  }
  
  .product-price-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 10px;
    top: 8px;
    right: 8px;
  }
  
  .view-toggle {
    display: none;
  }
  
  /* Modal */
  .modal-dialog {
    margin: 12px;
    max-width: calc(100% - 24px);
  }
  
  .modal-content {
    border-radius: 18px;
    max-height: 88vh;
  }
  
  .modal-header {
    padding: 14px 18px;
  }
  
  .modal-body {
    padding: 0;
  }
  
  .modal-tab-content {
    padding: 16px;
  }
  
  .modal-footer {
    padding: 13px 16px;
  }
  
  .action-btn {
    padding: 11px 18px;
  }
  
  .product-detail-container {
    flex-direction: column;
  }
  
  .product-detail-image {
    width: 100%;
    margin-bottom: 14px;
  }
  
  .image-wrapper {
    height: 270px;
    border-radius: 14px;
    padding: 14px;
  }
  
  .detail-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
  }
  
  .product-detail-info {
    width: 100%;
  }
  
  .list-item {
    padding: 11px 14px;
  }
  
  .item-icon {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 576px) {
  /* === جلوگیری از overflow افقی (catalog page only) === */
  body.catalog-page {
    overflow-x: hidden;
  }
  
  body.catalog-page .container {
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin: 0 auto;
    max-width: 100% !important;
  }
  
  body.catalog-page .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
  }
  
  /* === Hero Section === */
  .hero-pharmacy {
    min-height: 350px;
    padding: 30px 12px 20px;
    margin: 0 auto 15px;
    border-radius: 15px 15px 25px 25px;
    width: calc(100% - 8px);
    max-width: 100%;
  }
  
  .hero-title {
    font-size: 1.6rem;
    margin-bottom: 8px;
  }
  
  .hero-subtitle {
    font-size: 0.85rem;
    margin-bottom: 20px;
  }
  
  .hero-pharmacy .search-container {
    max-width: 98%;
  }
  
  .hero-pharmacy .search-input-group {
    padding: 6px;
    border-radius: 20px;
    flex-wrap: nowrap;
    gap: 4px;
  }
  
  .hero-pharmacy .search-icon {
    padding: 0 10px;
    font-size: 0.9rem;
  }
  
  .hero-pharmacy .search-input {
    padding: 10px 8px;
    font-size: 16px;
    min-width: 0;
    flex: 1 1 auto;
  }
  
  .search-btn {
    padding: 8px 14px;
    font-size: 0.78rem;
    min-width: auto;
    flex-shrink: 0;
    border-radius: 16px;
  }
  
  .search-btn span {
    display: none;
  }
  
  .search-btn i {
    font-size: 0.9rem;
  }
  
  .floating-pills .pill {
    font-size: 1rem;
    opacity: 0.15;
  }
  
  .hero-pharmacy::after {
    height: 40px;
  }
  
  /* === Categories Section === */
  .categories-section {
    margin: 0 auto 15px !important;
    padding: 10px 5px 0;
    width: calc(100% - 8px);
    max-width: 100%;
  }
  
  .categories-mobile {
    margin: 0 !important;
    width: 100%;
    max-width: 100%;
  }
  
  .mobile-header {
    padding: 16px 15px !important;
    border-radius: 15px 15px 0 0 !important;
    min-height: 65px;
    background: linear-gradient(135deg, #008c69, #006e53) !important;
  }
  
  .mobile-title {
    font-size: 1rem !important; /* 🔥 FIX: سایز بزرگتر برای خوانایی */
    color: white !important;
  }
  
  .mobile-filter-btn {
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    /* 🔥 FIX: حفظ visibility در صفحات کوچک */
    position: relative;
    z-index: 20;
    min-width: 36px;
    min-height: 36px;
    flex-shrink: 0;
  }
  
  .categories-scroll-container {
    margin: 10px 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    -webkit-overflow-scrolling: touch;
  }
  
  .categories-scroll {
    padding: 8px 12px;
    gap: 8px;
    width: max-content;
    min-width: 100%;
    /* اسکرول روان در موبایل */
    scroll-behavior: smooth;
  }
  
  .scroll-chip {
    min-width: 85px;
    max-width: 110px;
    padding: 10px 8px;
    gap: 6px;
    border-radius: 12px;
    flex-shrink: 0;
    /* اطمینان از touch بهتر */
    min-height: 44px;
  }
  
  .chip-icon {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
  }
  
  .chip-title {
    font-size: 0.78rem;
    font-weight: 600;
  }
  
  .chip-count {
    font-size: 0.68rem;
  }
  
  .scroll-btn {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }
  
  .scroll-left {
    right: 4px;
  }
  
  .scroll-right {
    left: 4px;
  }
  
  /* === Products Section === */
  .products-section {
    padding: 15px 5px !important;
    margin: 0 auto;
    width: calc(100% - 8px);
    max-width: 100%;
  }
  
  .products-header {
    margin-bottom: 12px;
    padding: 0 3px;
  }
  
  .products-title {
    font-size: 1.05rem;
  }
  
  .products-count {
    font-size: 0.75rem;
  }
  
  .sort-btn {
    padding: 5px 10px;
    font-size: 0.7rem;
    border-radius: 12px;
  }
  
  /* === Products Grid - FIX اصلی === */
  .products-grid.view-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .product-card {
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .product-image-container {
    height: 140px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }
  
  /* 🔥 FIX: دکمه‌ها در گوشه‌های تصویر - بدون پوشاندن تصویر */
  .product-overlay {
    opacity: 1 !important;
    pointer-events: none !important;
    background: transparent !important;
    gap: 0 !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    padding: 8px !important;
  }
  
  .overlay-btn {
    transform: translateY(0) !important;
    width: 34px !important;
    height: 34px !important;
    font-size: 0.9rem !important;
    pointer-events: auto !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    background: rgba(255, 255, 255, 0.95) !important;
  }

  /* سبد خرید overlay مخفی شود — فقط دکمه چشم نمایان باشد */
  .overlay-btn.cart-btn {
    display: none !important;
  }
  
  /* دکمه چشم در گوشه چپ بالا — دور از قیمت */
  .overlay-btn.detail-btn {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    right: auto !important;
  }
  
  .product-image {
    padding: 8px;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  
  .product-info {
    padding: 8px 10px 10px;
  }
  
  .product-title {
    font-size: 0.78rem;
    line-height: 1.3;
    margin-bottom: 5px;
    height: auto;
    max-height: 2.6em;
    overflow: hidden;
  }
  
  .product-expiry {
    padding: 3px 5px;
    margin-bottom: 5px;
    font-size: 0.6rem;
    border-radius: 6px;
  }
  
  .product-expiry i {
    font-size: 0.6rem;
  }
  
  .product-rating {
    margin-bottom: 6px;
  }
  
  .stars i {
    font-size: 0.75rem;
  }
  
  .rating-text {
    font-size: 0.7rem;
  }
  
  /* دکمه‌ها */
  .add-to-cart-btn {
    font-size: 0.75rem;
    padding: 8px 10px;
    border-radius: 10px;
  }
  
  .quantity-selector {
    padding: 1px;
    border-radius: 15px;
  }
  
  .qty-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  
  .qty-input {
    width: 36px;
    height: 32px;
    font-size: 0.85rem;
  }
  
  .product-price-badge {
    font-size: 0.78rem;
    padding: 5px 10px;
    top: 6px;
    right: 6px;
    border-radius: 10px;
    min-width: auto;
    line-height: 1.3;
    font-weight: 800;
  }
  
  .overlay-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  
  /* مودال محصول - بهبود برای موبایل */
  #productDetailModal .modal-dialog {
    margin: 5px;
    max-width: calc(100% - 10px);
    width: calc(100% - 10px);
  }
  
  #productDetailModal .modal-content {
    border-radius: 15px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
  }
  
  #productDetailModal .modal-header {
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    flex-shrink: 0;
  }
  
  #productDetailModal .modal-body {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Tab Content موبایل */
  .modal-tab-content {
    padding: 15px;
  }
  
  /* Tab Navigation موبایل */
  .modal-tabs-nav {
    flex-direction: row;
    padding: 10px 15px;
    gap: 10px;
    flex-shrink: 0;
  }
  
  .modal-tab-btn {
    flex: 1;
    padding: 10px 15px;
    font-size: 0.85rem;
  }
  
  .modal-tab-btn i {
    font-size: 16px;
  }
  
  .modal-tab-btn span:not(.reviews-count) {
    font-size: 0.85rem;
  }
  
  .reviews-count {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
  
  /* Reviews Container موبایل */
  .reviews-container {
    padding: 0;
    max-height: none;
    overflow-y: visible;
  }
  
  .reviews-list {
    max-height: 300px;
    margin-bottom: 20px;
    overflow-y: auto;
  }
  
  .review-item {
    padding: 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
  }
  
  .add-review-section {
    padding-top: 15px;
  }
  
  .rating-input i {
    font-size: 20px;
  }
  
  .review-form textarea {
    font-size: 0.9rem;
    min-height: 100px;
  }
  
  #productDetailModal .modal-footer {
    padding: 12px 15px;
    position: sticky;
    bottom: 0;
    background: hsl(35, 25%, 92%);
    border-top: 1px solid hsl(35, 18%, 90%);
    z-index: 10;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
    border-radius: 0 0 15px 15px;
    flex-shrink: 0;
  }
  
  .modal-actions {
    gap: 8px;
  }
  
  .action-btn {
    padding: 10px 15px;
    font-size: 0.85rem;
  }
  
  .modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: hsla(35, 12%, 80%, 0.2);
    border: none;
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
  }
  
  .modal-close-btn:hover {
    background: hsla(35, 14%, 82%, 0.3);
    transform: scale(1.1);
  }
  
  .product-detail-container {
    flex-direction: column;
    gap: 20px;
  }
  
  .product-detail-image {
    width: 100%;
    margin-bottom: 0;
  }
  
  .image-wrapper {
    height: 320px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, hsl(35, 18%, 90%), #e8ecff);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
  }
  
  .detail-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  
  .product-detail-info {
    width: 100%;
  }
  
  .action-btn {
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    width: 100%;
  }
  
  .modal-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  /* مودال دسته‌بندی */
  .mobile-categories-modal .modal-content {
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
  }
  
  .mobile-categories-modal .modal-content::before {
    width: 30px;
    height: 3px;
    top: 8px;
  }
  
  .mobile-categories-modal .modal-header {
    padding: 15px 20px;
  }
  
  .mobile-categories-modal .modal-header h5 {
    font-size: 1rem;
  }
  
  .mobile-categories-modal .modal-close {
    width: 38px;
    height: 38px;
  }
  
  .categories-list {
    padding: 8px 0;
  }
  
  .list-item {
    padding: 10px 12px;
    border-radius: 10px;
  }
  
  .item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.8rem;
  }
  
  .item-title {
    font-size: 0.85rem;
  }
  
  .item-count {
    font-size: 0.7rem;
  }
  
  /* صفحه‌بندی */
  .pagination-section {
    margin-top: 25px;
    padding: 0;
  }
  
  .pagination-scroll-wrapper {
    justify-content: center;
  }
  
  .pagination-list {
    justify-content: center;
    gap: 4px;
  }
  
  .pagination-link {
    min-width: 36px;
    height: 36px;
    font-size: 0.8rem;
    border-radius: 10px;
  }
  
  .pagination-link.prev,
  .pagination-link.next {
    padding: 0 12px;
    font-size: 0.78rem;
  }
  
  .pagination-ellipsis {
    width: 28px;
    height: 36px;
  }
}

/* بهینه‌سازی برای صفحات بسیار کوچک */
@media (max-width: 360px) {
  /* جلوگیری از overflow در دستگاه‌های خیلی کوچک */
  body.catalog-page .container {
    padding-left: 5px;
    padding-right: 5px;
  }
  
  .hero-pharmacy {
    padding: 20px 8px 15px;
    margin: 0;
    width: 100%;
    max-width: 100vw;
  }
  
  .hero-title {
    font-size: 1.4rem;
  }
  
  .search-input {
    font-size: 16px;
    padding: 8px 10px;
  }
  
  .search-btn {
    font-size: 0.75rem;
    min-width: 60px;
  }
  
  .scroll-chip {
    min-width: 65px;
    max-width: 85px;
    padding: 6px 4px;
  }
  
  .chip-title {
    font-size: 0.65rem;
  }
  
  .chip-count {
    font-size: 0.55rem;
  }
  
  .products-grid.view-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .product-card {
    max-width: calc(100vw - 15px);
  }
  
  .product-title {
    font-size: 0.88rem;
    height: auto;
    margin-bottom: 8px;
  }
  
  .add-to-cart-btn {
    font-size: 0.82rem;
    padding: 10px 14px;
  }
  
  /* قیمت برای موبایل‌های کوچک — خوانا بمونه */
  .product-price-badge {
    font-size: 0.78rem;
    padding: 5px 10px;
    top: 8px;
    right: 8px;
    border-radius: 8px;
    min-width: auto;
    line-height: 1.3;
  }
}

/* Product title links — larger touch target on mobile */
@media (max-width: 768px) {
  .product-title-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 4px 0;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .floating-pills .pill,
  .hero-icon,
  .hero-title,
  .hero-subtitle,
  .hero-pharmacy .search-container,
  .scroll-chip,
  .product-card {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 400px) {
  .hero-title {
    font-size: 1.6rem;
  }
  
  .search-input-group {
    padding: 12px;
  }
  
  .categories-scroll {
    padding: 0 8px;
  }
  
  .scroll-chip {
    min-width: 70px;
    max-width: 90px;
    padding: 6px 8px;
    gap: 4px;
  }
  
  .chip-title {
    font-size: 0.75rem;
  }
  
  .chip-count {
    font-size: 0.6rem;
  }
  
  .chip-icon {
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
  }
  
  .products-grid.view-grid {
    gap: 10px;
    padding: 0 5px;
  }
  
  .product-card {
    max-width: calc(100vw - 15px);
  }
  
  .product-info {
    padding: 10px;
  }
  
  .product-title {
    font-size: 0.85rem;
  }
  
  .product-expiry {
    padding: 4px 6px;
    margin-bottom: 6px;
    gap: 4px;
  }
  
  .product-expiry i {
    font-size: 0.7rem;
  }
  
  .expiry-text {
    font-size: 0.7rem;
  }
  
  .stars i {
    font-size: 0.7rem;
  }
  
  .rating-text {
    font-size: 0.65rem;
  }
  
  .add-to-cart-btn {
    font-size: 0.8rem;
    padding: 8px 12px;
  }
  
  .qty-btn {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }
  
  .qty-input {
    width: 40px;
    height: 36px;
    font-size: 0.85rem;
  }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-pharmacy {
    min-height: 70vh;
  }
  
  .categories-section {
    margin-top: -40px;
  }
  
  .mobile-categories-modal .modal-content {
    max-height: 60vh;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .hero-pharmacy,
  .categories-section,
  .products-controls,
  .pagination-section {
    display: none;
  }
  
  .product-card {
    border: 1px solid #000;
    break-inside: avoid;
    box-shadow: none;
  }
  
  .product-overlay,
  .add-to-cart-form {
    display: none;
  }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
  .category-tile,
  .scroll-chip,
  .product-card {
    border: 2px solid #000;
  }
  
  .category-tile.active,
  .scroll-chip.active {
    background: #000;
    color: #fff;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .floating-pills {
    display: none;
  }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  /* We maintain light theme for better medicine visibility */
  /* Users can override with manual dark mode toggle if needed */
}

/* ===== MOBILE OPTIMIZATIONS ===== */
/* بهینه‌سازی‌های خاص موبایل */

/* محدود کردن زوم در input ها */
@media (max-width: 768px) {
  input[type="text"],
  input[type="search"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important; /* جلوگیری از زوم خودکار در iOS */
    transform: translateZ(0); /* بهبود عملکرد */
  }
}

/* بهبود touch targets */
.mobile-touch-target {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

/* نمایش بهتر در landscape و تبلت */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-pharmacy {
    min-height: calc(var(--vh, 1vh) * 70);
    padding: 20px 0 15px;
  }
  
  .hero-title {
    font-size: 1.4rem;
    margin-bottom: 5px;
  }
  
  .hero-subtitle {
    font-size: 0.8rem;
    margin-bottom: 15px;
  }
  
  .hero-pharmacy .search-container {
    margin-top: 10px;
  }
  
  .mobile-categories-modal .modal-content {
    max-height: calc(var(--vh, 1vh) * 60);
    min-height: calc(var(--vh, 1vh) * 40);
  }
  
  .categories-section {
    margin: 10px 0;
  }
  
  .categories-scroll {
    padding: 5px 8px;
  }
  
  .scroll-chip {
    padding: 6px 8px;
    min-width: 70px;
    max-width: 100px;
  }
  
  .chip-title {
    font-size: 0.7rem;
  }
  
  .chip-count {
    font-size: 0.6rem;
  }
  
  .products-section {
    margin-top: 15px;
  }
  
  .products-grid.view-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  
  .product-card {
    border-radius: 12px;
  }
  
  .product-image-container {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .product-info {
    padding: 8px;
  }
  
  .product-title {
    font-size: 0.75rem;
    line-height: 1.2;
    margin-bottom: 5px;
  }
}

/* تبلت در حالت portrait */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .hero-pharmacy {
    min-height: calc(var(--vh, 1vh) * 50);
    margin: 0 15px;
  }
  
  .products-grid.view-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
  }
  
  .product-image-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .product-image {
    padding: 15px;
  }
  
  .mobile-categories-modal .modal-content {
    max-height: calc(var(--vh, 1vh) * 65);
  }
  
  .categories-scroll {
    padding: 0 20px;
  }
  
  .scroll-chip {
    min-width: 110px;
    max-width: 140px;
    padding: 12px 14px;
  }
}

/* حالت تاریک - پشتیبانی اولیه */
@media (prefers-color-scheme: dark) {
  .mobile-categories-modal .modal-content {
    background: #1a202c;
    color: white;
  }
  
  .mobile-categories-modal .modal-backdrop {
    background: rgba(0,0,0,0.8);
  }
  
  .list-item {
    color: #f7fafc;
    border-bottom-color: #2d3748;
  }
  
  .list-item:hover,
  .list-item.active {
    background: linear-gradient(135deg, #2d3748, #4a5568);
  }
}

/* بهبود accessibility */
@media (prefers-reduced-motion: reduce) {
  .mobile-categories-modal .modal-content {
    transition: none;
  }
  
  .scroll-chip,
  .product-card,
  .add-to-cart-btn {
    transition: none;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast support */
@media (prefers-contrast: high) {
  .scroll-chip,
  .product-card,
  .mobile-filter-btn {
    border: 2px solid #000;
  }
  
  .scroll-chip.active,
  .list-item.active {
    background: #000 !important;
    color: #fff !important;
  }
}

/* بهبود loading states */
.loading-state {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.loading-state::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #008c69;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* جلوگیری از تداخل modal ها */
.modal.show {
  z-index: 1055;
}

.modal.show ~ .mobile-categories-modal.active {
  display: none !important;
}

.mobile-categories-modal.active ~ .modal.show {
  z-index: 1060;
}

/* بهبود backdrop برای modal محصول */
#productDetailModal.show + .modal-backdrop {
  background-color: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(8px);
}

/* 🔥 FIX: جلوگیری از scroll در body هنگام باز بودن modal - بدون position fixed */
body.modal-open {
  overflow: hidden !important;
  /* position: fixed حذف شد - باعث jump می‌شد */
}

/* Safe area support for iPhone X+ */
@supports (padding: max(0px)) {
  .mobile-categories-modal .modal-content {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  
  .hero-pharmacy {
    padding-top: max(30px, env(safe-area-inset-top));
  }
  
  .categories-scroll {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  
  #productDetailModal .modal-content {
    padding-bottom: max(15px, env(safe-area-inset-bottom));
  }
}

/* ===== UTILITY CLASSES ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-up {
  animation: slideUp 0.6s ease-out;
}

.bounce-in {
  animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* کلاس‌های کمکی برای موبایل */
.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block;
  }
  
  .desktop-only {
    display: none;
  }
}

/* بهبود تعامل لمسی */
.touch-friendly {
  -webkit-tap-highlight-color: rgba(0, 140, 105, 0.2);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Haptic feedback simulation */
@media (hover: none) and (pointer: coarse) {
  .scroll-chip:active,
  .add-to-cart-btn:active,
  .mobile-filter-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== ANIMATIONS ===== */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.loading-shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* ===== UTILITIES ===== */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.slide-up {
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== FIX: Remove white halo on small screens (mobile categories header + product modal header) ===== */
@media (max-width: 992px) {
  /* 🔥 CRITICAL FIX: جلوگیری از horizontal overflow در تمام حالات موبایل */
  html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  
  body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    position: relative;
  }
  
  /* Keep the same desktop gradient for the mobile categories header */
  .mobile-header {
    background: linear-gradient(135deg, #008c69, #006e53) !important;
    color: #fff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  .mobile-title i,
  .mobile-filter-btn i {
    color: #fff !important;
  }

  /* Ensure product detail modal header keeps gradient on mobile (no pale overlay) */
  #productDetailModal .modal-header {
    background: linear-gradient(135deg, #008c69, #006e53) !important;
    border-bottom: none !important;
    color: #fff !important;
  }
  #productDetailModal .modal-header .modal-close-btn {
    background: hsla(35, 12%, 80%, 0.2) !important;
    color: #fff !important;
  }

  /* Avoid pale/white overlays around the categories picker modal header on phones */
  .mobile-categories-modal .modal-header {
    background: linear-gradient(135deg, #008c69, #006e53) !important;
    color: #fff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  .mobile-categories-modal .modal-content {
    background: hsl(35, 25%, 92%) !important; /* keep body white but no translucent overlay */
    filter: none !important;
  }

  /* Further fix: remove white halo on the categories themselves inside the mobile categories modal */
  .mobile-categories-modal .modal-backdrop {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* Default list items: solid white, no shadows or blur */
  .mobile-categories-modal .list-item {
    background: hsl(35, 25%, 92%) !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border-bottom: 1px solid hsl(160, 40%, 92%) !important; /* soft divider to avoid white banding */
  }
  .mobile-categories-modal .list-item .item-title,
  .mobile-categories-modal .list-item .item-count,
  .mobile-categories-modal .list-item .item-arrow {
    color: #2d3748 !important;
    text-shadow: none !important;
  }
  .mobile-categories-modal .list-item .item-icon {
    background: #f3f4ff !important;
    color: #008c69 !important;
  }

  /* Remove any text shadows globally inside the mobile modal */
  .mobile-categories-modal * { text-shadow: none !important; }

  /* Use purple gradient for active/hover items to avoid pale glow */
  .mobile-categories-modal .list-item:hover,
  .mobile-categories-modal .list-item.active {
    background: linear-gradient(135deg, #008c69, #006e53) !important;
    color: #fff !important;
    border-bottom-color: hsla(35, 10%, 80%, 0.15) !important; /* subtle divider without white band */
  }
  .mobile-categories-modal .list-item:hover .item-title,
  .mobile-categories-modal .list-item.active .item-title,
  .mobile-categories-modal .list-item:hover .item-count,
  .mobile-categories-modal .list-item.active .item-count,
  .mobile-categories-modal .list-item:hover .item-arrow,
  .mobile-categories-modal .list-item.active .item-arrow {
    color: #fff !important;
  }
  .mobile-categories-modal .list-item:hover .item-icon,
  .mobile-categories-modal .list-item.active .item-icon {
    background: hsla(35, 12%, 80%, 0.2) !important;
    color: #fff !important;
  }
}

/* ===== ENHANCED PRODUCT MODAL - MOBILE-FIRST DESIGN ===== */

/* Modal Base Reset & Setup */
#productDetailModal {
  z-index: 1060 !important;
}

#productDetailModal .modal-dialog {
  margin: 0;
  max-width: 100%;
  min-height: 100%;
  display: flex;
  align-items: flex-end;
}

#productDetailModal .modal-backdrop {
  z-index: 1055 !important;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Modal Content Container */
.product-modal-enhanced {
  border: none;
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: hsl(35, 25%, 92%);
  box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.25);
  animation: slideUpModal 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Enhanced Modal Header */
.modal-header-enhanced {
  background: linear-gradient(135deg, #008c69 0%, #523db8 50%, #523db8 100%);
  padding: 16px 20px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

/* Decorative pattern */
.modal-header-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.modal-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.modal-product-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: hsla(35, 12%, 80%, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  backdrop-filter: blur(10px);
}

.modal-product-badge i {
  font-size: 14px;
}

.modal-close-enhanced {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: hsla(35, 12%, 80%, 0.2);
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  backdrop-filter: blur(10px);
}

.modal-close-enhanced:hover {
  background: hsla(35, 14%, 82%, 0.3);
  transform: scale(1.1);
}

.modal-close-enhanced:active {
  transform: scale(0.95);
}

.modal-title-enhanced {
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  /* Limit to 2 lines with ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Enhanced Tabs */
.modal-tabs-enhanced {
  display: flex;
  gap: 0;
  background: hsl(35, 18%, 90%);
  padding: 0;
  flex-shrink: 0;
  border-bottom: 1px solid hsl(35, 15%, 82%);
}

.tab-btn-enhanced {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  color: #64748b;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.tab-btn-enhanced .tab-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(35, 15%, 82%);
  transition: all 0.3s ease;
}

.tab-btn-enhanced .tab-icon-wrap i {
  font-size: 14px;
  color: #64748b;
}

.tab-btn-enhanced .tab-text {
  transition: color 0.3s ease;
}

.tab-btn-enhanced::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 3px;
  background: linear-gradient(90deg, #008c69, #523db8);
  border-radius: 3px 3px 0 0;
  transition: transform 0.3s ease;
}

.tab-btn-enhanced.active {
  color: #008c69;
}

.tab-btn-enhanced.active .tab-icon-wrap {
  background: linear-gradient(135deg, #008c69, #523db8);
}

.tab-btn-enhanced.active .tab-icon-wrap i {
  color: white;
}

.tab-btn-enhanced.active::after {
  transform: translateX(-50%) scaleX(1);
}

.tab-btn-enhanced:hover:not(.active) {
  color: #475569;
  background: hsl(40, 14%, 95%);
}

.reviews-badge {
  background: linear-gradient(135deg, #008c69, #523db8);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
}

/* Modal Body */
.modal-body-enhanced {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Custom Scrollbar */
.modal-body-enhanced::-webkit-scrollbar {
  width: 6px;
}

.modal-body-enhanced::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body-enhanced::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #008c69, #523db8);
  border-radius: 10px;
}

/* Tab Content */
.tab-content-enhanced {
  display: none;
  padding: 0;
  animation: fadeInContent 0.35s ease;
}

.tab-content-enhanced.active {
  display: block;
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Product Image Section */
.product-image-section {
  padding: 16px 16px 8px;
}

.image-container-enhanced {
  position: relative;
  background: linear-gradient(145deg, hsl(35, 18%, 90%) 0%, hsl(35, 15%, 82%) 100%);
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

.product-img-enhanced {
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.4s ease;
}

.image-container-enhanced:active .product-img-enhanced {
  transform: scale(1.05);
}

.zoom-btn-enhanced {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: hsla(35, 25%, 92%, 0.95);
  color: #008c69;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.zoom-btn-enhanced:hover {
  background: #008c69;
  color: white;
  transform: scale(1.1);
}

/* Price Overlay Badge */
.price-overlay-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  padding: 8px 16px;
  border-radius: 14px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.price-amount {
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Product Info Section */
.product-info-section {
  padding: 8px 16px 16px;
}

/* Quick Stats Row */
.quick-stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.quick-stats-row::-webkit-scrollbar {
  display: none;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: hsl(35, 18%, 90%);
  padding: 10px 14px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px solid hsl(35, 15%, 82%);
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.stat-icon.original {
  background: linear-gradient(135deg, #fef3c7, #fcd34d);
  color: #92400e;
}

.stat-icon.fast {
  background: linear-gradient(135deg, #dbeafe, #60a5fa);
  color: #1e40af;
}

.stat-icon.warranty {
  background: linear-gradient(135deg, #dcfce7, #4ade80);
  color: #166534;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

/* Info Cards */
.info-card {
  background: hsl(35, 18%, 90%);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid hsl(35, 15%, 82%);
}

.card-header-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: #008c69;
  font-size: 13px;
  font-weight: 700;
}

.card-header-mini i {
  font-size: 14px;
}

.card-content {
  color: #475569;
  font-size: 14px;
  line-height: 1.7;
}

/* Description Card */
.description-card .card-content {
  max-height: 120px;
  overflow-y: auto;
  padding-left: 4px;
}

.description-card .card-content::-webkit-scrollbar {
  width: 4px;
}

.description-card .card-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Expiry Card */
.expiry-card {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: #a7f3d0;
}

.expiry-card .card-header-mini {
  color: #059669;
}

.expiry-display {
  font-size: 16px;
  font-weight: 700;
  color: #065f46;
  direction: ltr;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.feature-card {
  background: hsl(35, 25%, 92%);
  border: 1px solid hsl(35, 15%, 82%);
  border-radius: 14px;
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s ease;
}

.feature-card:active {
  transform: scale(0.98);
  background: hsl(35, 18%, 90%);
}

.feature-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
}

.feature-icon-wrap i {
  font-size: 14px;
  color: #006e53;
}

.feature-card span {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  line-height: 1.3;
}

/* Reviews Tab Styles */
.reviews-wrapper {
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.reviews-list-enhanced {
  flex: 1;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-left: 4px;
}

.reviews-list-enhanced::-webkit-scrollbar {
  width: 4px;
}

.reviews-list-enhanced::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.reviews-loading-enhanced {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
  color: #64748b;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid hsl(35, 15%, 82%);
  border-top-color: #008c69;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.review-item {
  background: hsl(35, 25%, 92%);
  border: 1px solid hsl(35, 15%, 82%);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  transition: all 0.25s ease;
}

.review-item:last-child {
  margin-bottom: 0;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.review-author {
  font-weight: 700;
  font-size: 14px;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-review-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: none;
}

.review-date {
  font-size: 12px;
  color: #94a3b8;
}

.review-rating {
  margin-bottom: 8px;
  font-size: 14px;
}

.review-comment {
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

.reviews-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #94a3b8;
  text-align: center;
}

.reviews-empty i {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Add Review Section */
.add-review-enhanced {
  background: hsl(35, 18%, 90%);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid hsl(35, 15%, 82%);
}

.review-form-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #008c69;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 16px;
}

.review-form-header i {
  font-size: 16px;
}

.review-form-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rating-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.rating-selector label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.stars-input {
  display: flex;
  gap: 6px;
}

.stars-input i {
  font-size: 24px;
  color: hsl(35, 15%, 82%);
  cursor: pointer;
  transition: all 0.2s ease;
}

.stars-input i:hover,
.stars-input i.active {
  color: #fbbf24;
  transform: scale(1.15);
}

.comment-input-wrap textarea {
  width: 100%;
  padding: 14px;
  border: 2px solid hsl(35, 15%, 82%);
  border-radius: 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  transition: all 0.25s ease;
  background: hsl(35, 25%, 92%);
}

.comment-input-wrap textarea:focus {
  outline: none;
  border-color: #008c69;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.comment-input-wrap textarea::placeholder {
  color: #94a3b8;
}

.submit-review-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #008c69, #523db8);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.submit-review-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.submit-review-btn:active {
  transform: scale(0.98);
}

/* Login Prompt */
.review-login-prompt {
  text-align: center;
  padding: 30px 20px;
}

.login-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-icon i {
  font-size: 24px;
  color: #006e53;
}

.review-login-prompt p {
  color: #64748b;
  font-size: 14px;
  margin: 0;
}

.review-login-prompt a {
  color: #008c69;
  font-weight: 700;
  text-decoration: none;
}

/* Enhanced Modal Footer */
.modal-footer-enhanced {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: hsl(35, 25%, 92%);
  border-top: 1px solid hsl(35, 15%, 82%);
  flex-shrink: 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  /* Safe area for iPhone X+ */
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

.action-link-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 14px;
  background: hsl(40, 14%, 95%);
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.25s ease;
  border: 1px solid hsl(35, 15%, 82%);
}

.action-link-btn:hover {
  background: hsl(35, 15%, 82%);
  color: #334155;
}

.action-link-btn .btn-text-short {
  display: none;
}

.action-cart-btn {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #008c69, #523db8);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.action-cart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.action-cart-btn:active {
  transform: scale(0.98);
}

.action-cart-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ===== DESKTOP ENHANCEMENTS ===== */
@media (min-width: 768px) {
  #productDetailModal .modal-dialog {
    max-width: 700px;
    margin: 1.75rem auto;
    align-items: center;
  }
  
  .product-modal-enhanced {
    border-radius: 24px;
    max-height: 85vh;
  }
  
  .modal-header-enhanced {
    padding: 20px 28px;
  }
  
  .modal-title-enhanced {
    font-size: 1.4rem;
  }
  
  .tab-btn-enhanced {
    padding: 16px 20px;
  }
  
  .product-image-section {
    padding: 24px 24px 12px;
  }
  
  .image-container-enhanced {
    aspect-ratio: 16/10;
  }
  
  .product-info-section {
    padding: 12px 24px 24px;
  }
  
  .features-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  
  .modal-footer-enhanced {
    padding: 18px 24px;
  }
  
  .action-link-btn .btn-text-full {
    display: inline;
  }
  
  .action-link-btn .btn-text-short {
    display: none;
  }
}

/* ===== LARGE DESKTOP ===== */
@media (min-width: 992px) {
  #productDetailModal .modal-dialog {
    max-width: 850px;
  }
  
  .product-image-section,
  .product-info-section {
    padding-left: 32px;
    padding-right: 32px;
  }
}

/* ===== SMALL MOBILE OPTIMIZATIONS ===== */
@media (max-width: 400px) {
  .modal-header-enhanced {
    padding: 14px 16px;
  }
  
  .modal-title-enhanced {
    font-size: 1.1rem;
  }
  
  .tab-btn-enhanced {
    padding: 12px 10px;
  }
  
  .tab-btn-enhanced .tab-text {
    font-size: 13px;
  }
  
  .tab-btn-enhanced .tab-icon-wrap {
    width: 28px;
    height: 28px;
  }
  
  .product-image-section {
    padding: 12px 12px 6px;
  }
  
  .product-info-section {
    padding: 6px 12px 12px;
  }
  
  .stat-item {
    padding: 8px 10px;
  }
  
  .stat-icon {
    width: 28px;
    height: 28px;
  }
  
  .stat-label {
    font-size: 11px;
  }
  
  .info-card {
    padding: 14px;
  }
  
  .features-grid {
    gap: 8px;
  }
  
  .feature-card {
    padding: 12px 10px;
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  
  .feature-icon-wrap {
    width: 32px;
    height: 32px;
  }
  
  .feature-card span {
    font-size: 11px;
  }
  
  .modal-footer-enhanced {
    padding: 12px;
    gap: 8px;
  }
  
  .action-link-btn {
    padding: 12px 14px;
    font-size: 13px;
  }
  
  .action-link-btn .btn-text-full {
    display: none;
  }
  
  .action-link-btn .btn-text-short {
    display: inline;
  }
  
  .action-cart-btn {
    padding: 12px 18px;
    font-size: 13px;
  }
}

/* ===== VERY SMALL SCREENS ===== */
@media (max-width: 320px) {
  .quick-stats-row {
    gap: 6px;
  }
  
  .stat-item {
    padding: 6px 8px;
    gap: 6px;
  }
  
  .stat-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  
  .stat-label {
    font-size: 10px;
  }
  
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .product-modal-enhanced {
    max-height: 100vh;
  }
  
  .image-container-enhanced {
    aspect-ratio: 3/2;
    max-height: 200px;
  }
  
  .quick-stats-row {
    margin-bottom: 10px;
  }
  
  .info-card {
    padding: 12px;
    margin-bottom: 8px;
  }
  
  .features-grid {
    grid-template-columns: repeat(4, 1fr);
    margin-top: 10px;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .product-modal-enhanced,
  .tab-content-enhanced,
  .loading-spinner {
    animation: none;
  }
  
  .product-img-enhanced,
  .zoom-btn-enhanced,
  .feature-card,
  .submit-review-btn,
  .action-cart-btn {
    transition: none;
  }
}

/* Legacy Modal Tabs (kept for compatibility) */
.modal-tabs-nav {
  display: none; /* Hide old tabs */
}

.reviews-count {
  display: inline-block;
  background: #007bff;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  margin-right: 5px;
}

.modal-tab-content {
  display: none;
  animation: fadeIn 0.3s;
  padding: 30px;
  min-height: 400px;
}

.modal-tab-content.active {
  display: block;
}

/* Reviews Styling */
.reviews-container {
  padding: 0;
  max-height: none;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
}

.reviews-list {
  flex: 1;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 30px;
  padding-right: 10px;
}

/* Custom Scrollbar for Reviews */
.reviews-list::-webkit-scrollbar {
  width: 8px;
}

.reviews-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.reviews-list::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #008c69, #006e53);
  border-radius: 10px;
}

.reviews-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #006e53, #008c69);
}

.review-item {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
  background: hsl(35, 25%, 92%);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.review-author {
  font-weight: 600;
  color: #333;
}

.review-date {
  font-size: 12px;
  color: #999;
}

.review-rating {
  color: #ffc107;
  margin-bottom: 10px;
}

.review-rating i {
  margin-left: 2px;
}

.review-comment {
  color: #666;
  line-height: 1.6;
}

.reviews-loading, .reviews-empty {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.reviews-loading i {
  font-size: 32px;
  margin-bottom: 10px;
  display: block;
}

.add-review-section {
  border-top: 2px solid #e0e0e0;
  padding-top: 20px;
}

.add-review-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  color: #333;
  font-size: 18px;
}

.rating-input {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.rating-input i {
  font-size: 24px;
  color: #ddd;
  cursor: pointer;
  transition: all 0.2s;
}

.rating-input i:hover,
.rating-input i.active {
  color: #ffc107;
  transform: scale(1.2);
}

.review-form .form-group {
  margin-bottom: 20px;
}

.review-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.review-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
}

.review-login-message {
  text-align: center;
  padding: 30px;
  background: hsl(35, 18%, 90%);
  border-radius: 10px;
}

.review-login-message i {
  font-size: 48px;
  color: #007bff;
  margin-bottom: 15px;
}

.review-login-message p {
  margin: 0;
  color: #666;
}

.review-login-message a {
  color: #007bff;
  text-decoration: none;
  font-weight: 600;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
