/* =============================================
   AVON REMEDIES — PRODUCTS PAGE CSS
   ============================================= */

.products-page {
  min-height: 100vh;
  background: var(--clr-bg);
}

/* Products Page Hero (Matching Home Theme) */
.products-new-hero {
  min-height: 45vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: var(--clr-bg-alt);
  background-image: 
    radial-gradient(circle at 20% 0%, rgba(26, 78, 196, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 80% 0%, rgba(6, 182, 212, 0.08) 0%, transparent 60%);
  padding-top: calc(var(--nav-height) + var(--space-10));
  padding-bottom: var(--space-10);
}

.products-new-hero .hero-title {
  color: var(--clr-primary-dark);
  font-family: var(--font-heading);
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: var(--space-4);
  text-align: center;
}

.hero-subtitle {
  color: var(--clr-text);
  font-size: var(--text-lg);
  font-weight: 400;
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Filter Bar */
.filter-bar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  position: relative;
  z-index: 10;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.filter-inner {
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
}

.filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  width: 100%;
}

.filter-dropdowns {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
  justify-content: flex-end;
}

/* Custom Scrollbar for dropdowns */

/* Search bar */
.products-search {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  min-width: 200px;
  flex: 1;
  max-width: 460px;
  transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dynamic expansion when active */
.products-search:focus-within {
  max-width: 520px;
}

.search-input-wrap {
  position: relative;
  width: 100%;
}

.search-input-wrap svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--clr-primary);
  opacity: 0.8;
  pointer-events: none;
  transition: all var(--transition-fast);
}

.search-input-wrap:focus-within svg {
  transform: translateY(-50%) scale(1.1);
  opacity: 1;
}

.search-input {
  padding: 0.6rem 1rem 0.6rem 2.8rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(26, 78, 196, 0.25);
  background: rgba(248, 250, 252, 0.9);
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--clr-text);
  width: 100%; /* Fully fluid */
  box-sizing: border-box;
  outline: none;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.search-input:hover {
  background: #ffffff;
  border-color: rgba(26, 78, 196, 0.5);
  box-shadow: 0 4px 12px rgba(26, 78, 196, 0.08);
}

.filter-pill-trigger {
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.8);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-fast);
}

.filter-pill-trigger:hover, 
.nav-dropdown:hover .filter-pill-trigger {
  border-color: var(--clr-primary);
  box-shadow: 0 4px 12px rgba(26, 78, 196, 0.08);
}

.search-input:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 4px rgba(26, 78, 196, 0.1);
  background: #fff;
}

/* Products Content */
.products-content {
  padding: var(--space-12) 0 var(--space-20);
}

/* Products Count */
.products-count {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  margin-bottom: var(--space-8);
}

.products-count strong {
  color: var(--clr-primary);
  font-weight: 600;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-10);
}

/* Product Card */
.product-card {
  background-color: #ffffff;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #E8ECF2;
  transform: translateZ(0); /* Anti-blur hardware acceleration */
  backface-visibility: hidden;
  will-change: transform;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.06);
  border-color: #D0D7E3;
}

.product-card-image {
  aspect-ratio: 4 / 3;
  overflow: hidden; /* Clips the white margins that get pushed out by scaling */
  background: radial-gradient(ellipse at 50% 45%, #F4F5F7 0%, #EAECF0 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #EAEDF1;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Scale up to zoom into product center — white photo margins get clipped by overflow:hidden */
  transform: translateZ(0) scale(1.45);
  backface-visibility: hidden;
  will-change: transform;
  filter: contrast(1.10) brightness(1.02);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover .product-card-image img {
  transform: translateZ(0) scale(1.45) translateY(-4px);
  filter: contrast(1.12) brightness(1.03);
}

.featured-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background-color: #F59E0B; /* Amber/Gold */
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 10;
}

/* Image placeholder */
.product-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  background: linear-gradient(135deg, #EEF2FF 0%, #dbeafe 100%);
}

.product-img-placeholder span {
  font-size: 3rem;
}

.product-img-placeholder p {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--clr-primary);
  opacity: 0.5;
  text-align: center;
  padding: 0 var(--space-4);
}

.product-card-body {
  padding: var(--space-8) var(--space-8);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-category-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-primary);
  margin-bottom: var(--space-3);
}

.product-category-tag span {
  color: var(--clr-text-light);
  margin: 0 6px;
}

.product-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: var(--space-4);
  line-height: 1.3;
}

.product-description {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.6;
  flex: 1;
  margin-bottom: var(--space-6);
}

.product-composition {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
  padding-top: var(--space-5);
  margin-bottom: var(--space-6);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.product-composition strong {
  color: #334155;
  font-weight: 600;
}

.product-card-footer {
  margin-top: auto;
}

.btn-enquire {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--clr-primary);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: color 0.3s ease;
  letter-spacing: 0.01em;
}

.btn-enquire::after {
  content: '→';
  font-size: 1.2rem;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-enquire:hover {
  color: var(--clr-primary-dark);
  background: transparent;
  box-shadow: none;
}

.btn-enquire:hover::after {
  transform: translateX(5px);
}

/* Loading Skeleton */
.skeleton-card {
  background: var(--clr-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-image {
  height: 220px;
  border-radius: 0;
}

.skeleton-body {
  padding: var(--space-6);
}

.skeleton-tag {
  height: 12px;
  width: 80px;
  margin-bottom: var(--space-3);
}

.skeleton-title {
  height: 24px;
  width: 70%;
  margin-bottom: var(--space-3);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-btn {
  height: 40px;
  margin-top: var(--space-5);
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-20) var(--space-8);
  color: var(--clr-text-muted);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  color: var(--clr-primary);
  margin-bottom: var(--space-3);
}

/* ══════════════════════════════════════
   RESPONSIVE BREAKPOINTS (ALL DEVICES & SIZES)
   ══════════════════════════════════════ */

/* ── 1280px: Small Laptops / Desktops ── */
@media (max-width: 1280px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
}

/* ── 1024px: Tablets Landscape ── */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
  }
  .products-search {
    max-width: 380px;
  }
}

/* ── 768px: Tablets Portrait ── */
@media (max-width: 768px) {
  .products-new-hero {
    padding: calc(var(--nav-height) + var(--space-6)) 0 var(--space-6);
    min-height: auto;
  }
  .products-new-hero .hero-title {
    font-size: clamp(2rem, 5vw, 2.75rem);
  }
  .hero-subtitle {
    font-size: var(--text-base);
    padding: 0 var(--space-4);
  }
  .filter-toolbar {
    flex-direction: column;
    gap: var(--space-3);
    align-items: stretch;
  }
  .filter-dropdowns {
    justify-content: space-between;
    width: 100%;
    gap: var(--space-3);
  }
  .nav-dropdown {
    flex: 1;
  }
  .filter-pill-trigger {
    width: 100%;
    min-height: 44px;
    justify-content: space-between;
    box-sizing: border-box;
  }

  /* Filter bar becomes sticky on tablet/mobile */
  .filter-bar {
    position: sticky;
    top: var(--nav-height);
  }
  .filter-inner {
    gap: var(--space-2);
    padding: var(--space-3) 0;
  }

  .products-search {
    width: 100%;
    max-width: none;
  }
  .products-search:focus-within {
    max-width: none;
  }
  .search-input {
    min-height: 44px;
  }
}

/* ── 640px: Large Phones & Small Tablets ── */
@media (max-width: 640px) {
  .products-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
    max-width: 480px;
    margin: 0 auto;
  }

  .products-new-hero .hero-title {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
  }

  .products-count {
    font-size: var(--text-sm);
    text-align: center;
  }

  /* Fluid, distortion-free card image */
  .product-card-image {
    aspect-ratio: 4 / 3;
    height: auto;
  }
  .product-card-body {
    padding: var(--space-5);
  }

  .btn-enquire {
    min-height: 44px;
    font-size: var(--text-sm);
  }

  /* Modal bottom sheet on mobile */
  .modal-box {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    margin: 0;
  }
  .modal-overlay {
    align-items: flex-end;
  }
}

/* ── 480px: Standard Mobile Phones ── */
@media (max-width: 480px) {
  .products-new-hero {
    padding: calc(var(--nav-height) + var(--space-4)) 0 var(--space-4);
  }
  .products-new-hero .hero-title { 
    font-size: 1.75rem; 
  }
  .hero-subtitle { 
    font-size: var(--text-sm); 
  }

  .products-content {
    padding: var(--space-4) 0 var(--space-10);
  }

  .search-input { 
    font-size: var(--text-sm);
    padding-left: 2.5rem;
  }
  .search-input-wrap svg {
    left: 14px;
    width: 16px;
    height: 16px;
  }

  .filter-dropdowns {
    flex-direction: row;
    gap: var(--space-2);
  }
  .filter-pill-trigger {
    font-size: var(--text-xs);
    padding: 0.45rem 0.75rem;
  }
}

/* ── 360px: Smallest Phones (iPhone SE, Foldables) ── */
@media (max-width: 360px) {
  .products-grid { 
    gap: var(--space-3); 
  }
  .products-new-hero .hero-title { 
    font-size: 1.45rem; 
  }
  .product-card-body {
    padding: var(--space-4);
  }
  .product-name {
    font-size: 1.1rem;
  }
  .filter-dropdowns {
    flex-direction: column;
  }
}

/* ─────────────────────────────────────────
   TOUCH FEEDBACK & HARDWARE ACCELERATION
───────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .product-card:active {
    transform: scale(0.985);
    transition: transform 0.15s ease;
  }
  .btn-enquire:active {
    transform: scale(0.96);
  }
  .filter-pill-trigger:active {
    background: #F1F5F9;
  }
}

/* ─────────────────────────────────────────
   IMAGE LIGHTBOX / POPUP (FULLY RESPONSIVE & DYNAMIC)
───────────────────────────────────────── */
.img-lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 18, 38, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3vw, 24px);
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.img-lightbox-overlay.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.img-lightbox-panel {
  position: relative;
  background: #ffffff;
  border-radius: clamp(12px, 2vw, 20px);
  padding: clamp(10px, 2vw, 16px);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: min(94vw, 840px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.img-lightbox-overlay.active .img-lightbox-panel {
  transform: scale(1);
}

.img-lightbox-media-wrap {
  position: relative;
  overflow: hidden;
  border-radius: clamp(8px, 1.5vw, 14px);
  background: radial-gradient(ellipse at 50% 50%, #F8FAFC 0%, #EFF2F6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: calc(88vh - 80px);
  min-height: 180px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.img-lightbox-panel img {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 90px);
  object-fit: contain;
  cursor: zoom-in;
  transform-origin: center center;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.img-lightbox-panel img.zoomed {
  cursor: grab;
}

.img-lightbox-panel img.zoomed:active {
  cursor: grabbing;
}

/* Close Button */
.img-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  color: #475569;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
  touch-action: manipulation;
}

.img-lightbox-close:hover {
  background: #F8FAFC;
  color: #1A4EC4;
  transform: scale(1.1) rotate(90deg);
}

.img-lightbox-close:active {
  transform: scale(0.95);
}

/* Lightbox Caption */
.img-lightbox-caption {
  margin-top: 14px;
  font-family: var(--font-heading);
  font-size: clamp(18px, 2.4vw, 23px);
  font-weight: 700;
  color: var(--clr-primary-dark);
  text-align: center;
  max-width: 92%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.015em;
  padding: 0 4px;
}

/* Product image card hover cursor */
.product-card-image {
  cursor: zoom-in;
}

/* Search clear button */
.search-clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(148, 163, 184, 0.25);
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  font-size: 13px;
  line-height: 1;
  transition: all 0.2s ease;
  padding: 0;
}

.search-clear-btn.visible {
  display: flex;
}

.search-clear-btn:hover {
  background: rgba(26, 78, 196, 0.2);
  color: #1A4EC4;
  transform: translateY(-50%) scale(1.1);
}

/* Media Query Adaptations for Lightbox */
@media (max-width: 640px) {
  .img-lightbox-close {
    top: -10px;
    right: -10px;
    width: 34px;
    height: 34px;
    font-size: 18px;
  }
  .img-lightbox-caption {
    margin-top: 10px;
  }
}

@media (max-width: 380px) {
  .img-lightbox-panel {
    padding: 8px;
  }
  .img-lightbox-close {
    top: -8px;
    right: -8px;
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
  .img-lightbox-media-wrap {
    min-height: 150px;
  }
}

