/* ============================================================
   J10 PAINTS — colours.css
   Colour Browser Page Styles
   Imports global design system from style.css
   ============================================================

   Contents:
    1.  Page header
    2.  Browser layout (two-column)
    3.  Filter bar + tabs
    4.  Active filter label
    5.  Swatch grid
    6.  Swatch card — default state
    7.  Swatch card — hover / expanded state
    8.  Special order badge
    9.  Room preview panel
   10.  Room fallback scene (CSS-drawn room)
   11.  Room colour overlay
   12.  Colour detail card
   13.  Detail card — special order notice
   14.  Detail card — WhatsApp button
   15.  Panel WhatsApp CTA
   16.  Splash canvas
   17.  Loading state
   18.  Filter transition (fade between categories)
   19.  Responsive — tablet
   20.  Responsive — mobile

   ============================================================ */


/* ============================================================
   1. PAGE HEADER
   ============================================================ */
.colours-header {
  padding: 160px 0 64px;          /* top padding clears floating navbar */
  background: var(--cream);
  border-bottom: 1px solid rgba(184,134,11,0.10);
}

.colours-header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 48px;
}

.colours-header-text {
  max-width: 560px;
}

.colours-page-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 900;
  color: var(--ink);
  line-height: 1.05;
  margin-bottom: 20px;
}

.colours-page-sub {
  font-size: 17px;
  color: var(--mid-brown);
  line-height: 1.7;
  max-width: 480px;
}

/* Three stat cards in the header */
.colours-header-stats {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.header-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 24px;
  border-radius: var(--r-md);
  min-width: 96px;
  text-align: center;
}

.header-stat-num {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 6px;
}

.header-stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--mid-brown);
  line-height: 1.4;
}


/* ============================================================
   2. BROWSER LAYOUT — two-column sticky right panel
   ============================================================ */
.colours-main {
  padding: 48px 0 80px;
  background: var(--cream);
  min-height: 80vh;
}

.browser-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  align-items: start;
}

/* Right column sticks as you scroll */
.browser-right {
  position: sticky;
  top: 100px;               /* clears the floating navbar */
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: none;    /* Firefox */
}

.browser-right::-webkit-scrollbar {
  display: none;            /* Chrome / Safari */
}


/* ============================================================
   3. FILTER BAR + TABS
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(184,134,11,0.12);
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--mid-brown);
  background: transparent;
  border: 1.5px solid rgba(138,122,96,0.25);
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
  white-space: nowrap;
}

.filter-tab:hover {
  color: var(--ink);
  border-color: var(--gold);
  background: rgba(184,134,11,0.06);
  transform: translateY(-1px);
}

.filter-tab.active {
  color: var(--white);
  background: linear-gradient(135deg, var(--gold) 0%, #D4A017 100%);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(184,134,11,0.35);
}

.filter-tab.active:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(184,134,11,0.45);
}

/* Count badge inside tab */
.filter-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,0.25);
  color: inherit;
  transition: background 0.2s;
}

.filter-tab:not(.active) .filter-tab-count {
  background: rgba(138,122,96,0.15);
  color: var(--mid-brown);
}


/* ============================================================
   4. ACTIVE FILTER LABEL
   ============================================================ */
.active-filter-label {
  font-size: 13px;
  color: var(--mid-brown);
  margin-bottom: 28px;
}

.active-filter-label strong {
  color: var(--ink);
  font-weight: 700;
}

#activeFilterName {
  color: var(--gold);
  font-weight: 600;
}


/* ============================================================
   5. SWATCH GRID
   ============================================================ */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

/* Filter transition — grid fades when category changes */
.swatch-grid.filtering {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.swatch-grid.filtered {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}


/* ============================================================
   6. SWATCH CARD — default state
   ============================================================ */
.swatch-card {
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  background: var(--white);
  border: 1.5px solid rgba(0,0,0,0.06);
  transition:
    transform 0.3s var(--ease-back),
    box-shadow 0.3s ease,
    border-color 0.2s ease;
  position: relative;

  /* Stagger animation — set by colours.js via style attribute */
  opacity: 0;
  transform: translateY(24px);
}

/* Visible state — added by colours.js after stagger delay */
.swatch-card.card-visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.45s var(--ease-out),
    transform 0.45s var(--ease-out),
    box-shadow 0.3s ease,
    border-color 0.2s ease;
}

/* Colour block at top of card */
.swatch-colour-block {
  width: 100%;
  height: 100px;
  transition: height 0.3s var(--ease-out);
  position: relative;
}

/* Card info area */
.swatch-card-info {
  padding: 12px 14px 14px;
}

.swatch-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.swatch-card-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mid-brown);
  display: block;
}


/* ============================================================
   7. SWATCH CARD — HOVER / EXPANDED STATE
   ============================================================ */

/* On hover: lift and glow */
.swatch-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: rgba(184,134,11,0.30);
  z-index: 10;
}

/* Colour block grows on hover */
.swatch-card:hover .swatch-colour-block {
  height: 120px;
}

/* Other cards dim when one is hovered */
.swatch-grid.has-hover .swatch-card:not(:hover) {
  opacity: 0.65;
  transform: scale(0.98);
}

/* Detail panel slides up from bottom of card on hover */
.swatch-detail-panel {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(184,134,11,0.12);
  background: rgba(253,246,220,0.50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  /* Hidden by default */
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.35s var(--ease-out),
    opacity 0.25s ease,
    padding 0.3s ease;
  padding-top: 0;
  padding-bottom: 0;
}

.swatch-card:hover .swatch-detail-panel {
  max-height: 200px;
  opacity: 1;
  padding-top: 12px;
  padding-bottom: 14px;
}

/* Price rows inside detail panel */
.swatch-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.swatch-price-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid-brown);
}

.swatch-price-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-body);
}

/* WhatsApp order button inside card */
.swatch-order-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 10px;
  padding: 9px 12px;
  font-size: 12px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: var(--white);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 0.2s, box-shadow 0.2s;
}

.swatch-order-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37,211,102,0.40);
}


/* ============================================================
   8. SPECIAL ORDER BADGE
   ============================================================ */
.special-order-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--alert);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(184,48,48,0.35);
  pointer-events: none;
}


/* ============================================================
   9. ROOM PREVIEW PANEL
   ============================================================ */
.room-preview-panel {
  border-radius: var(--r-lg);
  overflow: hidden;
  padding: 0;
}

/* Room style switcher buttons */
.room-switcher {
  display: flex;
  gap: 8px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(184,134,11,0.10);
}

.room-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--mid-brown);
  background: transparent;
  border: 1.5px solid rgba(138,122,96,0.20);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.room-btn:hover {
  color: var(--ink);
  border-color: var(--gold);
}

.room-btn.active {
  background: linear-gradient(135deg, var(--gold), #D4A017);
  color: var(--white);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(184,134,11,0.30);
}

/* Room image container */
.room-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 280px;
  overflow: hidden;
  background: #E8E0D0;
}

.room-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* Colour overlay — covers the wall area of the room photo
   colours.js sets background-color on hover
   CSS blend mode makes it look painted rather than flat */
.room-colour-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background-color: transparent;
  mix-blend-mode: multiply;
  transition: background-color 0.5s ease;
  pointer-events: none;
}

/* Idle message shown before any hover */
.room-idle-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13,13,13,0.30);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.room-idle-message p {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.90);
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

/* Hide idle message once a colour has been hovered */
.room-idle-message.hidden {
  opacity: 0;
}

/* Preview label below the room image */
.room-preview-label {
  padding: 12px 16px;
  background: rgba(13,13,13,0.04);
  border-top: 1px solid rgba(184,134,11,0.10);
}

.preview-label-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--mid-brown);
  letter-spacing: 0.04em;
}


/* ============================================================
   10. ROOM FALLBACK SCENE — CSS-drawn room
   Shown when real room photos are not yet uploaded.
   A simple perspective room: wall, floor, sofa, window, plant.
   colours.js changes rf-wall background on hover.
   ============================================================ */
.room-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;            /* ADD THIS — hides clipart completely */
}

.room-fallback-scene {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Back wall — this is what changes colour on hover */
.rf-wall {
  position: absolute;
  inset: 0 0 35% 0;
  background: #E8DBC8;
  transition: background-color 0.4s ease;
}

/* Floor */
.rf-floor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35%;
  background: linear-gradient(180deg, #C8B87A 0%, #A89060 100%);
}

/* Sofa */
.rf-sofa {
  position: absolute;
  bottom: 32%;
  left: 50%;
  transform: translateX(-50%);
  width: 55%;
  height: 22%;
  background: #2C2C2C;
  border-radius: 8px 8px 0 0;
}

.rf-sofa::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 8%;
  right: 8%;
  height: 40%;
  background: #3A3A3A;
  border-radius: 6px 6px 0 0;
}

.rf-sofa::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -8%;
  width: 12%;
  height: 90%;
  background: #3A3A3A;
  border-radius: 6px;
  box-shadow: calc(100% + 72%) 0 0 #3A3A3A;
}

/* Window */
.rf-window {
  position: absolute;
  top: 12%;
  right: 15%;
  width: 22%;
  height: 38%;
  background: linear-gradient(135deg, #B8D8E8 0%, #87CEEB 100%);
  border: 3px solid rgba(255,255,255,0.60);
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.30),
    0 4px 16px rgba(0,0,0,0.15);
}

.rf-window::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255,255,255,0.50);
}

.rf-window::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255,255,255,0.50);
}

/* Plant */
.rf-plant {
  position: absolute;
  bottom: 33%;
  left: 10%;
  width: 6%;
  height: 18%;
  background: #5A8060;
  border-radius: 50% 50% 0 0;
}

.rf-plant::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 30%;
  background: #7A5838;
  border-radius: 2px;
}


/* ============================================================
   11. COLOUR DETAIL CARD — right panel, appears on hover
   ============================================================ */
.colour-detail-card {
  border-radius: var(--r-lg);
  overflow: hidden;

  /* Fully removed from layout until a swatch is hovered */
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
  pointer-events: none;
}

/* JS adds .card-shown first (display:block), then .active (fade in) */
.colour-detail-card.card-shown {
  display: block;
}

.colour-detail-card.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Large colour swatch at top of card */
.detail-card-swatch {
  width: 100%;
  height: 80px;
  transition: background-color 0.35s ease;
}

.detail-card-body {
  padding: 20px;
}

.detail-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-colour-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 4px;
}

.detail-colour-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mid-brown);
}

.detail-finish-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(184,134,11,0.10);
  border: 1px solid rgba(184,134,11,0.20);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Price rows */
.detail-prices {
  margin-bottom: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.50);
  border-radius: var(--r-md);
  border: 1px solid rgba(184,134,11,0.12);
}

.detail-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.detail-price-row + .detail-price-row {
  border-top: 1px solid rgba(184,134,11,0.08);
}

.detail-price-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid-brown);
}

.detail-price-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}


/* ============================================================
   13. SPECIAL ORDER NOTICE inside detail card
   ============================================================ */
.detail-special-notice {
  display: none;              /* shown by colours.js when specialOrder = true */
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgba(184,48,48,0.08);
  border: 1px solid rgba(184,48,48,0.18);
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--alert);
  line-height: 1.5;
}

.detail-special-notice.visible {
  display: flex;
}

.special-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--alert);
  flex-shrink: 0;
  animation: dot-pulse 1.6s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}


/* ============================================================
   14. DETAIL CARD — WhatsApp order button
   ============================================================ */
.detail-order-btn {
  display: flex;
  width: 100%;
  justify-content: center;
  font-size: 13px;
  padding: 13px 20px;
  margin-top: 4px;
}


/* ============================================================
   15. PANEL WHATSAPP CTA — always visible in right column
   ============================================================ */
.panel-whatsapp-cta {
  padding: 20px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-cta-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--mid-brown);
}

.panel-cta-btn {
  font-size: 12px;
  padding: 10px 18px;
  flex-shrink: 0;
}


/* ============================================================
   16. SPLASH CANVAS — full-page particle layer
   ============================================================ */
#splashCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;   /* never blocks clicks */
  z-index: 500;
}


/* ============================================================
   17. LOADING STATE
   ============================================================ */
.grid-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 80px 20px;
  color: var(--mid-brown);
  font-size: 15px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(184,134,11,0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state — shown when a filter returns 0 results */
.grid-empty {
  grid-column: 1 / -1;
  padding: 80px 20px;
  text-align: center;
  color: var(--mid-brown);
}

.grid-empty p {
  font-size: 16px;
  margin-bottom: 20px;
}


/* ============================================================
   18. FILTER TRANSITION
   ============================================================ */

/* Brief fade-out before new swatches render */
@keyframes grid-fade-out {
  to { opacity: 0; transform: translateY(8px); }
}

@keyframes grid-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.swatch-grid.refreshing {
  animation: grid-fade-out 0.18s var(--ease-out) forwards;
}

.swatch-grid.refreshed {
  animation: grid-fade-in 0.35s var(--ease-out) forwards;
}


/* ============================================================
   19. RESPONSIVE — TABLET (max 1100px)
   ============================================================ */
@media (max-width: 1100px) {
  .browser-layout {
    grid-template-columns: 1fr 300px;
    gap: 28px;
  }

  .swatch-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }

  .colours-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
  }

  .colours-header-stats {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .browser-layout {
    grid-template-columns: 1fr;
  }

  /* Right panel unsticks and flows below the grid on tablet */
  .browser-right {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    order: -1;               /* moves above the swatch grid on mobile */
  }

  .room-preview-panel {
    grid-column: 1 / -1;
  }

  .colour-detail-card {
    display: none;           /* hidden on mobile — swatch card handles it */
  }

  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
  }

  .filter-bar::-webkit-scrollbar {
    display: none;
  }
}


/* ============================================================
   20. RESPONSIVE — MOBILE (max 640px)
   ============================================================ */
@media (max-width: 640px) {
  .colours-header {
    padding: 130px 0 40px;
  }

  .colours-page-title {
    font-size: 42px;
  }

  .colours-header-stats {
    gap: 10px;
  }

  .header-stat {
    padding: 14px 16px;
    min-width: 80px;
  }

  .header-stat-num {
    font-size: 28px;
  }

  .browser-right {
    grid-template-columns: 1fr;
  }

  .swatch-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
  }

  .swatch-colour-block {
    height: 80px;
  }

  .swatch-card:hover .swatch-colour-block {
    height: 96px;
  }

  .swatch-card-name {
    font-size: 12px;
  }

  .room-switcher {
    gap: 6px;
  }

  .room-btn {
    font-size: 11px;
    padding: 7px 8px;
  }

  .panel-whatsapp-cta {
    flex-direction: column;
    text-align: center;
  }

  .panel-cta-btn {
    width: 100%;
    justify-content: center;
  }
}


/* ============================================================
   REDUCED MOTION — accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .swatch-card,
  .swatch-card:hover,
  .swatch-colour-block,
  .swatch-detail-panel,
  .colour-detail-card,
  .room-colour-overlay,
  .rf-wall,
  .filter-tab {
    transition: none !important;
    animation: none !important;
  }

  .swatch-card {
    opacity: 1 !important;
    transform: none !important;
  }

  .loading-spinner {
    animation: none;
    border-top-color: var(--gold);
    opacity: 0.6;
  }
}