:root {
  --bg:          #f6f3ec;
  --surface:     #ffffff;
  --line:        #e6e0d0;
  --line-strong: #cdc4ad;
  --ink:         #3a2e22;
  --ink-2:       #6a5a48;
  --ink-3:       #9a8a78;

  /* Palette beige / or chaud — style luxe */
  --gold:        #b39870;
  --gold-soft:   #d4b98a;
  --gold-deep:   #8a6f4a;
  --gold-strong: #8a6f4a;

  /* Alias utilisés par les composants */
  --violet:      #b39870;
  --violet-soft: #d4b98a;
  --violet-light:#f5ede2;
  --violet-dark: #8a6f4a;

  --shadow-soft: 0 1px 0 rgba(0,0,0,0.04), 0 14px 30px -22px rgba(60,40,10,0.22);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 300;
  color: var(--ink);
  background: var(--bg);
  font-size: 13px;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-rows: 70px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─── NAVBAR (Unified Brand Luxury Menu) ────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 60px;
  height: 70px;
  background: rgba(245, 237, 226, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(179, 152, 112, 0.15);
  z-index: 200;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  font-family: 'Cormorant Garamond', serif;
  color: #3a2e22;
  text-decoration: none;
}
.logo-mark {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
}
.logo-mark .plus {
  font-size: 11px;
  color: #b39870;
  margin-right: 4px;
  margin-top: -6px;
}
.logo-v {
  font-size: 34px;
  font-weight: 400;
  letter-spacing: 0.02em;
}
.logo-name {
  font-family: 'Outfit', sans-serif;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #3a2e22;
  margin-top: 2px;
  padding-left: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-right: auto;
  margin-left: 80px;
}
.nav-links a {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #4a3d30;
  transition: color 0.25s;
  text-decoration: none;
}
.nav-links a:hover { color: #b39870; }

@media (max-width: 980px) {
  .navbar { padding: 0 20px; }
  .navbar .nav-links { display: none; }
  .hdr-burger { display: grid; }
}

/* ─── Header (Fallback / Legacy support) ────────────────────── */
.header {
  display: grid;
  grid-template-columns: 220px 1fr auto auto;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: relative;
}
.hdr-burger {
  display: none;
  appearance: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 38px; height: 38px;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
  margin-left: 8px;
}
.hdr-burger:hover { border-color: var(--gold-soft); background: #fffdf6; }
.hdr-burger svg { stroke: currentColor; fill: none; stroke-width: 1.6; }
@media (max-width: 980px) {
  .header { grid-template-columns: 1fr auto; gap: 16px; padding: 0 16px; }
  .header .page-title { display: none; }
  .header-actions { display: none; }
  .hdr-burger { display: grid; }
}

.hdr-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  animation: hdrOverlayIn 200ms ease;
}
@keyframes hdrOverlayIn { from { opacity: 0; } to { opacity: 1; } }
.hdr-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(340px, 88vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 0 0 24px;
  animation: hdrDrawerIn 240ms cubic-bezier(.2,.7,.2,1);
  display: flex; flex-direction: column;
}
@keyframes hdrDrawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.hdr-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0;
  z-index: 2;
}
.hdr-drawer-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
}
.hdr-drawer-close {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink-2);
}
.hdr-drawer-close:hover { color: var(--ink); border-color: var(--gold-soft); }
.hdr-drawer-section {
  padding: 16px 14px 8px;
}
.hdr-drawer-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 8px 8px;
}
.hdr-drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  border-radius: 4px;
  transition: background 160ms ease, color 160ms ease;
}
.hdr-drawer-item:hover { background: #fbf6e8; color: var(--ink); }
.hdr-drawer-item.active { background: #fbf6e8; color: var(--gold-deep); }
.hdr-drawer-icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--gold-soft);
  background: #fffcf3;
  color: var(--gold);
  flex-shrink: 0;
}
.hdr-drawer-icon svg { stroke-width: 1.5; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand .mark {
  width: 30px; height: 30px;
  border: 1px solid var(--gold);
  display: grid; place-items: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--gold);
}
.brand .wordmark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  letter-spacing: 0.32em;
  color: var(--ink);
  text-transform: uppercase;
}
.brand .wordmark small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.4em;
  color: var(--ink-3);
  margin-top: 2px;
}
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink);
}
.header-actions {
  display: flex; gap: 28px; align-items: center;
  color: var(--ink-2);
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
}
.header-actions a {
  color: inherit; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.header-actions a:hover { color: var(--ink); }
.header-actions svg { opacity: 0.7; }

/* ─── Main grid ──────────────────────────────────────────── */
.main {
  display: grid;
  grid-template-columns: 90px 340px 1fr 64px;
  min-height: 0;
}

/* ─── Side nav ──────────────────────────────────────────── */
.sidenav {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding-top: 16px;
}
.sidenav button {
  appearance: none; background: none; border: none;
  padding: 18px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer;
  color: var(--ink-3);
  font-family: inherit; font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase;
  border-left: 2px solid transparent;
  transition: color 120ms ease, background 120ms ease;
  line-height: 1.3; text-align: center;
}
.sidenav button:hover { color: var(--ink); }
.sidenav button.active {
  color: var(--violet);
  background: linear-gradient(90deg, rgba(124,92,191,0.10), transparent);
  border-left-color: var(--violet);
}
.sidenav button svg { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.sidenav button.active svg { color: var(--violet); }

/* ─── Browser panel ──────────────────────────────────────── */
.browser {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  min-height: 0;
}
.b-section-title {
  padding: 18px 22px 8px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.b-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  gap: 4px;
}
.b-tab {
  appearance: none; background: none; border: none;
  padding: 12px 10px 14px;
  font: inherit; font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  position: relative;
  border-radius: 6px 6px 0 0;
  transition: color 120ms ease;
}
.b-tab:hover { color: var(--ink); }
.b-tab.active { color: var(--violet); }
.b-tab.active::after {
  content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px;
  height: 2px; background: var(--violet); border-radius: 2px 2px 0 0;
}
.b-filters {
  display: flex; flex-wrap: wrap;
  gap: 6px 5px;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.b-chip {
  appearance: none; background: none; border: 1px solid var(--line-strong);
  padding: 5px 12px;
  font: inherit; font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 999px;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.b-chip:hover { color: var(--ink); border-color: var(--violet-soft); background: var(--violet-light); }
.b-chip.active {
  background: var(--violet);
  color: #fff;
  border-color: var(--violet);
}
.b-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}
.b-toolbar-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px; letter-spacing: 0.04em;
  color: var(--ink);
}
.b-toolbar-icons {
  display: flex; gap: 14px; color: var(--ink-3);
}
.b-toolbar-icons button {
  appearance: none; background: none; border: none; padding: 0;
  cursor: pointer; color: inherit;
  display: grid; place-items: center;
}
.b-toolbar-icons svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.b-toolbar-icons button:hover { color: var(--ink); }

.search {
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
  height: 0; opacity: 0; pointer-events: none;
  transition: height 160ms ease, opacity 160ms ease;
  overflow: hidden;
}
.search.open { height: 40px; opacity: 1; pointer-events: auto; }
.search input {
  flex: 1; border: none; outline: none;
  background: transparent;
  font: inherit; color: var(--ink);
  padding: 8px 0;
  letter-spacing: 0.04em;
}

.b-grid {
  overflow-y: auto;
  padding: 14px 14px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 4px;
  align-content: start;
}

.thumb {
  appearance: none; background: none; border: 1px solid transparent;
  padding: 8px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 120ms ease, background 120ms ease;
}
.thumb:hover { background: var(--violet-light); border-color: var(--violet-soft); }
.thumb.active {
  border-color: var(--violet);
  background: var(--violet-light);
}
.thumb-img {
  width: 92px; height: 112px;
  display: grid; place-items: center;
  overflow: hidden;
  padding: 30px 26px;
  background: var(--surface-2);
  border-radius: 8px;
}
.thumb-img img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.thumb-img.pump, .thumb-img.cap {
  height: 78px;
  padding: 16px 18px;
}
.thumb-img:has(img[src*="pot"]),
.thumb-img:has(img[src*="jar"]) {
  padding: 2px 2px;
}
.thumb-img:has(img[src*="pot"]) img,
.thumb-img:has(img[src*="jar"]) img {
  transform: scale(1.12);
  transform-origin: center center;
}
.thumb-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
}
.thumb-meta {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ─── Preview canvas ─────────────────────────────────────── */
.preview {
  background: var(--surface);
  display: grid;
  grid-template-rows: 1fr auto;
  position: relative;
  overflow: hidden;
}
.preview-stage {
  position: relative;
  display: grid; place-items: center;
  min-height: 0;
  overflow: hidden;
  background-color: #f5f0e8;
  padding-bottom: 15vh; /* Pousse la bouteille vers le haut pour la poser sur la table */
}

.preview-stack {
  display: flex; flex-direction: column; align-items: center;
  position: relative;
  transform-origin: center center;
  transition: gap 240ms ease, opacity 220ms ease;
  gap: 0;
  --neck-px: 28px; /* fallback; JS overrides per-bottle via inline style */
}
.preview-stack.loading {
  opacity: 0;
}
.preview-stack.ready {
  opacity: 1;
}
.preview-stack.view-exploded { gap: 24px; }

.preview-cap {
  position: relative;
  z-index: 3;
  width: var(--cap-w, 70px);
  margin-bottom: calc((var(--neck-px) + var(--cap-sink, 10px)) * -1);
  filter: drop-shadow(0 6px 8px rgba(70,55,20,0.12));
  transition: margin-bottom 240ms ease, width 240ms ease, opacity 220ms ease;
  display: flex; justify-content: center; align-items: flex-end;
}
.preview-cap.loading,
.preview-pump.loading {
  opacity: 0;
  pointer-events: none;
}
.preview-cap.ready,
.preview-pump.ready {
  opacity: 1;
}
.preview-cap img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.preview-pump {
  position: relative;
  z-index: 2;
  width: var(--pump-w, 72px);
  margin-bottom: calc((var(--neck-px) + var(--pump-sink, 10px)) * -1);
  transition: margin-bottom 240ms ease, width 240ms ease, opacity 220ms ease;
  display: flex; justify-content: center; align-items: flex-end;
}
.preview-pump img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* In assembled mode the pump is hidden from the layout entirely. */
.preview-stack.view-capped .preview-pump {
  display: none;
}

/* In uncapped mode the cap is hidden, pump sits on the neck. */
.preview-stack.view-uncapped .preview-cap {
  display: none;
}

/* Exploded — every part visible with no overlap. */
.preview-stack.view-exploded .preview-cap,
.preview-stack.view-exploded .preview-pump {
  margin-bottom: 0;
}

.preview-bottle {
  position: relative;
  z-index: 1;
  width: var(--bottle-w, 170px);
  filter: drop-shadow(0 22px 18px rgba(70,55,20,0.10));
  display: flex; justify-content: center;
  transition: width 240ms ease;
  transform-style: preserve-3d;
}
.preview-bottle > img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
/* slot overlay over the bottle for user-supplied artwork — draggable + resizable */
.preview-slot {
  position: absolute;
  pointer-events: none;
  /* Add a subtle dashed border so they see the actual bounds of the image slot */
  border: 1px dashed rgba(0, 102, 255, 0.4);
}
.preview-slot image-slot {
  pointer-events: auto;
  width: 100%; height: 100%;
  display: block;
  position: relative;
  z-index: 10;
}
.slot-drag {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  background: var(--ink-3);
  border: 2px solid white;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  cursor: grab;
  pointer-events: auto;
  z-index: 5;
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.preview.is-hovered .slot-drag,
.slot-drag:hover { 
  opacity: 0.85; 
  transform: translate(-50%, -50%) scale(1.1);
}
.slot-drag:active { cursor: grabbing; transform: translate(-50%, -50%) scale(0.95); }

/* Corner resize handles — small filled squares on each corner */
.slot-resize {
  position: absolute;
  width: 14px; height: 14px;
  background: #ffffff;
  border: 2px solid var(--ink-3);
  border-radius: 50%;
  pointer-events: auto;
  z-index: 5;
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.preview.is-hovered .slot-resize,
.slot-resize:hover { 
  opacity: 0.9; 
  transform: scale(1.2);
  background: var(--ink-3);
}
.slot-resize.nw { top: -7px; left: -7px;  cursor: nwse-resize; }
.slot-resize.ne { top: -7px; right: -7px; cursor: nesw-resize; }
.slot-resize.sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.slot-resize.se { bottom: -7px; right: -7px; cursor: nwse-resize; }

.preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.preview-toolbar .left, .preview-toolbar .right {
  display: flex; gap: 18px; align-items: center;
}
.preview-toggle {
  appearance: none; background: none; border: 1px solid var(--line-strong);
  font: inherit;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 7px 14px;
  cursor: pointer; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 6px;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.preview-toggle:hover { color: var(--violet); border-color: var(--violet-soft); background: var(--violet-light); }
.preview-toggle.active { background: var(--violet); color: #fff; border-color: var(--violet); }

/* Segmented control for 3 view modes — icon buttons */
.view-modes {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}
.view-modes button {
  appearance: none; background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  font: inherit;
  padding: 6px 12px;
  cursor: pointer; color: var(--ink-2);
  display: grid; place-items: center;
  transition: background 120ms ease, color 120ms ease;
}
.view-modes button:last-child { border-right: none; }
.view-modes button:hover { color: var(--violet); background: var(--violet-light); }
.view-modes button.active {
  background: var(--violet); color: #fff;
}
.view-modes button svg {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none; stroke-width: 1.3;
}

.preview-zoom { display: flex; gap: 4px; align-items: center; }
.preview-zoom button {
  width: 28px; height: 28px;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  color: var(--ink-2);
  display: grid; place-items: center;
}
.preview-zoom button:hover { color: var(--ink); border-color: var(--ink); }

/* ─── Action rail ────────────────────────────────────────── */
.actionrail {
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 22px 0;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.actionrail button {
  appearance: none; background: none; border: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: color 120ms ease, background 120ms ease;
}
.actionrail button:hover { color: var(--violet); background: var(--violet-light); }
.actionrail button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.actionrail button:disabled { opacity: 0.4; cursor: not-allowed; }
.actionrail.busy button { pointer-events: none; }

/* ─── Toast & busy overlay (configurator actions) ───────── */
.cfg-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #f6f1e2;
  background: #1a1814;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 50px -22px rgba(0,0,0,0.7);
  animation: cfgToastIn 240ms cubic-bezier(.2,.7,.2,1);
  max-width: min(560px, 90vw);
}
.cfg-toast.success { background: linear-gradient(180deg, #1c2618 0%, #14180e 100%); border-color: rgba(170, 200, 130, 0.25); }
.cfg-toast.error   { background: linear-gradient(180deg, #2a1414 0%, #190a0a 100%); border-color: rgba(220, 130, 130, 0.3); }
.cfg-toast.info    { background: linear-gradient(180deg, #1a1814 0%, #0e0c09 100%); }
@keyframes cfgToastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.cfg-busy {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.cfg-busy-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 26px;
  background: #1a1814;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: #f6f1e2;
  font-size: 13px;
  letter-spacing: 0.04em;
}
.cfg-busy-card .spinner-ring {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: #d9c08a;
  border-radius: 50%;
  animation: cfgSpin 0.9s linear infinite;
}
@keyframes cfgSpin { to { transform: rotate(360deg); } }

/* ─── Color swatches ────────────────────────────────────── */
.swatches {
  display: flex; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.swatches-label {
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3); margin-right: 6px;
}
.swatch {
  appearance: none; padding: 0;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.10);
  cursor: pointer;
  background-size: cover;
  background-position: center;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.swatch:hover { transform: scale(1.12); box-shadow: 0 2px 8px rgba(124,92,191,0.25); }
.swatch.active {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* ─── Add Design / placeholder views ─────────────────────── */
.placeholder-pane {
  padding: 32px 22px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.04em;
}
.placeholder-pane h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 0 0 12px;
}

.gallery {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  overflow-y: auto;
}
.gallery-card {
  background: #fbf8f0;
  border: 1px solid var(--line);
  padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.gallery-card .nm {
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px; letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bg-subtle {
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 20%, rgba(183,138,61,0.05), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(183,138,61,0.04), transparent 50%);
}

/* ─── Loading spinner ────────────────────────────────────── */
.preview-spinner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 4;
  animation: spinner-fade-in 200ms ease;
}
.spinner-ring {
  width: 42px; height: 42px;
  border: 1.5px solid rgba(183,138,61,0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spinner-rotate 880ms cubic-bezier(.45,.05,.55,.95) infinite;
}
@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}
@keyframes spinner-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Catalog page ───────────────────────────────────────── */
.main-catalog {
  grid-template-columns: 90px 1fr !important;
}
.catalog-page {
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.catalog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 4;
}
.catalog-crumb {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.catalog-back {
  appearance: none;
  background: none;
  border: 1px solid var(--line-strong);
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.catalog-back:hover { color: var(--ink); border-color: var(--ink); }
.catalog-back svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.catalog-sep { color: var(--line-strong); }
.catalog-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
.catalog-title.accent { color: var(--gold); }
.catalog-meta {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Category strip — circular icon buttons in the Erbatur house style */
.catalog-categories {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 16px 12px;
  padding: 28px 32px 22px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 1280px) {
  .catalog-categories { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 760px) {
  .catalog-categories { grid-template-columns: repeat(3, 1fr); }
}
.catalog-cat {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 6px 4px;
  color: var(--ink-2);
  transition: color 140ms ease, transform 140ms ease;
}
.catalog-cat:hover { color: var(--violet-dark); transform: translateY(-2px); }
.catalog-cat-ring {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: 1.5px dashed var(--violet-soft);
  background: #ffffff;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.catalog-cat:hover .catalog-cat-ring {
  border-color: var(--violet);
  border-style: solid;
  background: var(--violet-light);
  color: var(--violet);
  box-shadow: 0 6px 18px -8px rgba(124,92,191,0.40);
}
.catalog-cat.active .catalog-cat-ring {
  border-style: solid;
  border-color: var(--violet);
  background: linear-gradient(135deg, var(--violet-light) 0%, #ddd0f5 100%);
  color: var(--violet);
  box-shadow: 0 8px 22px -10px rgba(124,92,191,0.50);
}
.catalog-cat-ring svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.catalog-cat-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: inherit;
  text-align: center;
  line-height: 1.2;
  max-width: 100px;
}
.catalog-cat.active .catalog-cat-label { color: var(--violet); }

/* Gallery grid — product cards */
.catalog-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 22px 32px 40px;
  align-content: start;
  min-height: 0;
}
.catalog-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 14px 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.catalog-card:hover {
  border-color: var(--violet-soft);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -14px rgba(124,92,191,0.35);
}
.catalog-card-img {
  height: 160px;
  display: grid; place-items: center;
  padding: 8px;
  background:
    radial-gradient(ellipse at 50% 80%, rgba(124,92,191,0.04), transparent 60%),
    linear-gradient(180deg, #f8f5ff 0%, #ffffff 100%);
}
.catalog-card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.catalog-card-body { padding: 4px 4px 2px; }
.catalog-card-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.catalog-card-meta {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}

.catalog-empty {
  grid-column: 1 / -1;
  padding: 60px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--ink-3);
  text-align: center;
}
.catalog-empty h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 20px;
  margin: 0;
  color: var(--ink);
}
.catalog-empty p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  max-width: 480px;
}
.catalog-empty code {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 6px;
  font-size: 11px;
  font-family: 'Menlo', monospace;
  color: var(--ink-2);
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ─── Premium Mobile Responsive Adaptations ────────────────────────── */
@media (max-width: 980px) {
  .main {
    grid-template-columns: 1fr !important;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    overflow: hidden;
  }

  .preview {
    order: 1;
    flex: 1;
    min-height: 240px;
    border-bottom: 1px solid var(--line);
  }

  .sidenav {
    order: 2;
    flex-direction: row;
    width: 100%;
    height: auto;
    padding-top: 0;
    border-right: none;
    border-bottom: 1px solid var(--line);
    justify-content: space-around;
    background: var(--surface);
  }
  
  .sidenav button {
    flex: 1;
    padding: 8px 4px;
    border-left: none;
    border-bottom: 2px solid transparent;
    gap: 4px;
    height: 52px;
  }
  
  .sidenav button.active {
    background: linear-gradient(0deg, rgba(124,92,191,0.08), transparent);
    border-left-color: transparent;
    border-bottom-color: var(--violet);
  }
  
  .sidenav button svg {
    width: 20px;
    height: 20px;
  }
  
  .sidenav button span {
    font-size: 8px;
    letter-spacing: 0.05em;
    white-space: nowrap !important;
  }

  .browser {
    order: 3;
    height: 250px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    grid-template-rows: auto auto auto auto 1fr;
  }

  .b-section-title {
    display: none;
  }

  .b-tabs {
    padding: 0 4px;
    gap: 2px;
  }

  .b-tab {
    padding: 8px 6px 10px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .b-filters {
    padding: 5px 8px 6px;
    gap: 4px 2px;
  }

  .b-chip {
    padding: 3px 6px;
    font-size: 8.5px;
  }

  .b-toolbar {
    padding: 5px 10px;
  }

  .b-toolbar-title {
    font-size: 13px;
  }

  .b-toolbar-icons {
    gap: 10px;
  }

  .swatches {
    padding: 5px 10px;
    gap: 6px;
  }

  .swatches-label {
    font-size: 8px;
    margin-right: 2px;
  }

  .swatch {
    width: 18px;
    height: 18px;
  }

  .b-grid {
    padding: 8px;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px 4px;
  }

  .thumb {
    padding: 6px 2px;
    gap: 2px;
  }

  .thumb-img {
    width: 58px;
    height: 64px;
    padding: 10px 8px;
  }

  .thumb-img.pump,
  .thumb-img.cap {
    height: 46px;
    padding: 6px 8px;
  }

  .thumb-name {
    font-size: 10px;
    letter-spacing: 0.02em;
  }

  .thumb-meta {
    display: none;
  }

  .preview-toolbar {
    padding: 8px 12px;
  }

  .preview-toolbar .left,
  .preview-toolbar .right {
    gap: 8px;
  }

  .preview-toggle {
    padding: 4px 8px;
    font-size: 8.5px;
    letter-spacing: 0.1em;
  }

  .view-modes button {
    padding: 4px 6px;
  }

  .view-modes button svg {
    width: 14px;
    height: 14px;
  }

  .preview-zoom button {
    width: 22px;
    height: 22px;
  }

  .actionrail {
    order: 4;
    flex-direction: row;
    width: 100%;
    height: auto;
    padding: 6px 12px;
    border-left: none;
    border-top: 1px solid var(--line);
    justify-content: space-around;
    background: var(--surface);
    gap: 12px;
  }

  .actionrail button {
    width: 32px;
    height: 32px;
  }

  .actionrail button svg {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 480px) {
  .sidenav button span {
    display: none;
  }
  .sidenav button {
    height: 44px;
    padding: 6px 0;
  }
  .b-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ─── Bottle Color Studio Custom Styles ─────────────────── */
.customizer-section {
  box-shadow: inset 0 1px 0 var(--line);
}
.customizer-section input[type="range"] {
  appearance: none;
  background: var(--line-strong);
  height: 3px;
  border-radius: 2px;
  outline: none;
  transition: background 150ms ease;
}
.customizer-section input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--violet);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--violet);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.customizer-section input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--gold-strong);
}
.customizer-section input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.customizer-section input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

/* ─── 2D / 3D Preview Mode ──────────────────────────────────── */
/* 2D: flat, centred, no tilt — clean product shot look */
.preview-stack.dim-2D {
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.12));
}

/* 3D: tilted studio view with deeper cast shadow */
.preview-stack.dim-3D {
  filter: drop-shadow(0 24px 36px rgba(0,0,0,0.20)) drop-shadow(0 4px 10px rgba(0,0,0,0.10));
}

.preview-stack.dim-3D::after {
  content: '';
  display: block;
  position: absolute;
  bottom: -12px;
  left: 10%;
  width: 80%;
  height: 16px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.18) 0%, transparent 70%);
  pointer-events: none;
  z-index: -2;
}

/* ─── Luxury 3D Idle Breathing Animation ─── */
@keyframes previewIdleBreath {
  0% { transform: rotateY(-3deg) rotateX(-2deg) translateY(0px); }
  50% { transform: rotateY(3deg) rotateX(1deg) translateY(-4px); }
  100% { transform: rotateY(-3deg) rotateX(-2deg) translateY(0px); }
}

.preview-3d-idle-container {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  pointer-events: none;
}

.preview-3d-idle-container > * {
  pointer-events: auto; /* Re-enable pointer events for the stack inside */
}

.preview-idle-active {
  animation: previewIdleBreath 12s ease-in-out infinite;
}

