/* ================================================================
   NeoVTO Demo — Stylesheet
   ================================================================
   A reference implementation showing how to build a product
   browsing page that integrates with the NeoVTO virtual try-on SDK.

   Sections:
     1. Reset & Base
     2. Header
     3. Loading & Error States
     4. Layout
     5. Product Detail — Desktop
     6. Shared UI Components (labels, swatches, buttons)
     7. Model Gallery — Desktop
     8. Curated Looks
     9. Navigation (category / subcategory / product line)
    10. Mobile Overrides
   ================================================================ */

/* ─── 1. Reset & Base ──────────────────────────────────────────── */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    'Open Sans',
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background-color: #faf9f7;
  color: #333;
  line-height: 1.6;
}

/* ─── 2. Header ────────────────────────────────────────────────── */

.header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Logo pinned left, tiles flex-centered in the remaining space */
.header > a {
  position: absolute;
  left: 24px;
  display: inline-flex;
  align-items: center;
}

.header img {
  height: 28px;
  width: auto;
}

/* Category icon-tiles — centered in header by JS */
#header-categories {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-cat-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 40px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #888;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.header-cat-tile:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.2);
  color: #1a1a1a;
}

.header-cat-tile.active {
  background: linear-gradient(105deg, #d54c90 0%, #e8890f 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(213, 76, 144, 0.3);
}

/* Label + subtitle stacked */
.tile-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  line-height: 1;
}

.tile-label {
  display: block;
}

.tile-sub {
  font-size: 9px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.03em;
  opacity: 0.82;
  white-space: nowrap;
  overflow: hidden;
  max-width: 90px;
  text-overflow: ellipsis;
}

.tile-chevron {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  opacity: 0.35;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.header-cat-tile:hover .tile-chevron {
  opacity: 0.6;
}

.header-cat-tile.active .tile-chevron {
  opacity: 0.75;
}

/* ── Subcategory dropdown ── */
.cat-dropdown {
  position: fixed;
  z-index: 200;
  min-width: 170px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.11),
    0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateX(-50%) translateY(-8px) scale(0.95);
  transform-origin: top center;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.15s ease;
}

.cat-dropdown.open {
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Single-line subcategory item */
.cat-dd-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 9px 13px 9px 13px;
  background: none;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  color: #555;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s,
    padding-left 0.15s;
}

.cat-dd-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
}

.cat-dd-item.active {
  font-weight: 600;
  color: #1a1a1a;
  padding-left: 24px;
}

.cat-dd-item.active::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d54c90, #f1b301);
}

/* Multi-line subcategory accordion */
.cat-dd-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 13px;
  background: none;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  color: #555;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
}

.cat-dd-subhead:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
}

.cat-dd-group.expanded .cat-dd-subhead {
  color: #1a1a1a;
  font-weight: 500;
}

.dd-chev {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.35;
  transition:
    transform 0.22s ease,
    opacity 0.2s;
}

.cat-dd-group.expanded .dd-chev {
  transform: rotate(180deg);
  opacity: 0.6;
}

/* Product lines — hidden until expanded */
.cat-dd-lines {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-dd-group.expanded .cat-dd-lines {
  max-height: 400px;
}

.cat-dd-line {
  position: relative;
  display: block;
  width: 100%;
  padding: 7px 13px 7px 24px;
  background: none;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  color: #777;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
}

.cat-dd-line:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #1a1a1a;
}

.cat-dd-line.active {
  font-weight: 600;
  color: #1a1a1a;
  padding-left: 32px;
}

.cat-dd-line.active::before {
  content: '';
  position: absolute;
  left: 21px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d54c90, #f1b301);
}

/* ─── 3. Loading & Error States ────────────────────────────────── */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #eee;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  color: #666;
  font-size: 14px;
}

.error {
  text-align: center;
  padding: 60px 20px;
  color: #c00;
}

/* ─── 4. Layout ────────────────────────────────────────────────── */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ─── 5. Product Detail — Desktop ──────────────────────────────── */
/* Two-column grid: product image on left, details on right.       */

.product-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
  margin-bottom: 60px;
}

.product-image-container {
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}

.product-image {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
}

.product-details {
  padding-top: 20px;
}

.product-line {
  font-family: 'Open Sans', sans-serif;
  font-size: 36px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-bottom: 6px;
  color: #1a1a1a;
}

.product-shade-name {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 12px;
}

.product-price {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 32px;
  background: linear-gradient(90deg, #d54c90, #e8890f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── 6. Shared UI Components ──────────────────────────────────── */

/* Section labels — used for "Select Shade" and "About The Product" */
.shade-label,
.about-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #aaa;
  margin-bottom: 14px;
}

.shade-label span {
  font-weight: 600;
  color: #1a1a1a;
  text-transform: none;
  letter-spacing: normal;
}

/* Spacing for shade selector and about sections */
.shade-selector,
.about-product {
  margin-bottom: 30px;
}

/* Colour swatches — clickable shade selectors */
.color-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.color-swatch {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  box-shadow: none;
  transition:
    width 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    flex-basis 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    border-radius 0.2s ease;
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.color-swatch:hover {
  opacity: 0.85;
}

.color-swatch.active {
  flex-basis: 72px;
  width: 72px;
  border-radius: 10px;
}

/* Finish & palette grid overlays → see neovto-finish-overlays.css */

.about-description {
  font-size: 15px;
  color: #555;
  line-height: 1.7;
  margin-bottom: 12px;
}

/* "Try On" CTA — ghost gradient border, shared by the product and
   look pages ("Try On" / "Try On Look"). The brand gradient and its glow
   are defined ONCE here and inherited by every CTA flavour (hover, active,
   the filled Find My Shade twin). */
.try-on-btn {
  --cta-gradient: linear-gradient(105deg, #d54c90, #e8890f);
  --cta-glow: 213, 76, 144;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: 'Open Sans', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  border-radius: 30px;
  gap: 11px;
  padding: 16px 32px;
  font-size: 13px;
  margin-bottom: 12px;
  color: #1a1a1a;
  background: transparent;
  border: 2px solid #1a1a1a;
  box-shadow: none;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.2s ease;
}

/* Find My Shade and Try On share one row: on foundation/concealer pages
   they split it evenly; on every other line the row holds Try On alone at
   full width. The buttons keep their own bottom margin for the Add to Bag
   below. */
.cta-row {
  display: flex;
  gap: 12px;
}

.cta-row .try-on-btn {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  padding-left: 12px;
  padding-right: 12px;
}

/* "Find My Shade" CTA (Neo Shade journey) — the filled twin of the ghost
   Try On button: same geometry, gradient-filled resting state so the
   journey reads as the hero action on foundation/concealer pages. */
.find-my-shade-btn {
  color: #fff;
  background: var(--cta-gradient);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(var(--cta-glow), 0.28);
}

.find-my-shade-btn:hover {
  box-shadow: 0 8px 24px rgba(var(--cta-glow), 0.4);
}

.find-my-shade-btn .find-my-shade-icon {
  /* The widget's three-stars.svg (38×42) — height leads, width follows.
     Capped to the Try On camera icon's height (17px) so the two buttons
     in the CTA row stay exactly the same height. */
  height: 17px;
  width: auto;
}

.try-on-btn:hover {
  color: #fff;
  background: var(--cta-gradient);
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(var(--cta-glow), 0.32);
  transform: translateY(-1px);
}

.try-on-btn:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(var(--cta-glow), 0.22);
}

.try-on-btn svg {
  width: 22px;
  height: 17px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Dark button — shared base for "Add to Bag" (desktop & mobile) */
.add-to-bag,
.mobile-add-to-bag {
  display: block;
  width: 100%;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 30px;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s ease;
}

.add-to-bag:hover,
.mobile-add-to-bag:hover {
  background: #333;
}

.add-to-bag {
  padding: 16px 32px;
  font-size: 14px;
}

.mobile-add-to-bag {
  padding: 14px 24px;
  font-size: 13px;
}

/* ─── 7. Model Gallery — Desktop ───────────────────────────────── */
/* Row of model images shown below the product hero.               */

.model-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.model-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #e8e5e0;
}

/* Mobile-only elements — hidden on desktop, shown via media query */
.mobile-carousel-container,
.mobile-product-info,
.mobile-shade-selector,
.mobile-about-product,
.mobile-try-on-btn,
.mobile-add-to-bag {
  display: none;
}

/* ─── 8. Curated Looks ─────────────────────────────────────────── */
/* The Looks tab reuses the PDP layout: the model photo as hero,    */
/* look thumbnails in the shade-selector slot, and an "In This      */
/* Look" grid of the products applied together via                  */
/* NeoVTO.applyProducts().                                          */

/* Look rows in the header dropdown — thumbnail + name */
.look-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.look-dd-thumb {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f5f3f0;
}

/* Look hero: model photo fills the square the packshots sit in */
.look-hero-image {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 8px;
}

/* "In This Look" — grid of the products the look applies */
.look-products {
  margin-bottom: 60px;
}

.look-products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.look-product-card {
  display: block;
  padding: 0;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.look-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.look-product-image {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #f5f3f0;
}

.look-product-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.look-product-info {
  padding: 12px 14px 16px;
}

.look-product-line {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #aaa;
  margin-bottom: 2px;
}

.look-product-shade {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.look-product-price {
  font-size: 13px;
  font-weight: 500;
  background: linear-gradient(90deg, #d54c90, #e8890f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── 9. Navigation ────────────────────────────────────────────── */
/* Three-tier nav: Category (Lips/Eyes/Face/Looks) →               */
/* Subcategory (Lipstick/Lipliner) → Product Line (Satin Edit).   */

#navbar-container {
  position: sticky;
  top: 56px;
  z-index: 99;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.07);
}

/* navbar-container now holds only the line-nav strip */

/* Product line pills (third tier) — always a single scrollable row */
.line-nav {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  padding: 8px 32px;
  background: transparent;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.line-nav::-webkit-scrollbar {
  display: none;
}

/* Shared scrollbar hiding for horizontally-scrollable elements */
.mobile-carousel {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mobile-carousel::-webkit-scrollbar {
  display: none;
}

.line-nav-item {
  flex-shrink: 0;
  padding: 6px 16px;
  background: none;
  border: 1px solid #e2e2e2;
  border-radius: 20px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: #777;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.line-nav-item:hover {
  border-color: #bbb;
  color: #333;
}

.line-nav-item.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

/* ─── 10. Mobile Overrides (≤ 768px) ───────────────────────────── */

@media (max-width: 768px) {
  /* Header */
  .header {
    height: 50px;
    padding: 0 16px;
  }

  /* On mobile: logo flows naturally left so tiles never overlap it */
  .header {
    justify-content: flex-start;
    gap: 12px;
  }

  .header > a {
    position: static;
    flex-shrink: 0;
  }

  #header-categories {
    flex: 1;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
  }

  #header-categories::-webkit-scrollbar {
    display: none;
  }

  .header img {
    height: 22px;
  }

  .header-cat-tile {
    padding: 6px 11px;
    gap: 5px;
    font-size: 10px;
  }

  .main-content {
    padding: 20px 16px;
  }

  /* Hide desktop-only sections */
  .product-hero,
  .model-gallery,
  .product-details {
    display: none;
  }

  /* Show mobile product info */
  .mobile-product-info {
    display: block;
    text-align: center;
    margin-bottom: 20px;
  }

  .mobile-product-info .product-line {
    font-size: 32px;
  }

  .mobile-product-info .product-shade-name {
    font-size: 11px;
  }

  .mobile-product-info .product-price {
    font-size: 16px;
    margin-bottom: 0;
  }

  /* Show mobile elements */
  .mobile-carousel-container,
  .mobile-shade-selector,
  .mobile-about-product,
  .mobile-try-on-btn,
  .mobile-add-to-bag {
    display: block;
  }

  /* Image carousel (swipeable) */
  .mobile-carousel-container {
    margin-bottom: 24px;
  }

  .mobile-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    background: #f5f3f0;
  }

  .carousel-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  .carousel-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
  }

  .carousel-slide.model-slide {
    background: #f5f3f0;
    padding: 0;
  }

  .carousel-slide.model-slide img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    border-radius: 8px;
  }

  /* Carousel dot indicators */
  .carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
  }

  .carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  .carousel-dot.active {
    background: #333;
  }

  /* Shade selector & about section (centred on mobile) */
  .mobile-shade-selector {
    margin-bottom: 24px;
  }

  .mobile-shade-selector .shade-label,
  .mobile-shade-selector .color-swatches {
    justify-content: center;
    text-align: center;
  }

  .mobile-shade-selector .color-swatch {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  .mobile-shade-selector .color-swatch.active {
    flex-basis: 88px;
    width: 88px;
    border-radius: 12px;
  }

  .mobile-about-product {
    margin-bottom: 24px;
    text-align: center;
  }

  .mobile-about-product .about-description {
    font-size: 14px;
  }

  /* CTA buttons (smaller on mobile) */
  .mobile-try-on-btn {
    margin-bottom: 12px;
  }

  .mobile-try-on-btn .try-on-btn {
    /* Tighter type so the two-button row fits a phone width. */
    padding: 14px 10px;
    font-size: 11px;
    letter-spacing: 0.08em;
    gap: 7px;
  }

  /* Navigation */
  #navbar-container {
    top: 50px;
  }

  .line-nav {
    padding: 7px 16px;
  }

  .line-nav-item {
    padding: 5px 13px;
    font-size: 11px;
  }

  /* "In This Look" grid (two columns on mobile) */
  .look-products {
    margin-bottom: 24px;
  }

  .look-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}
