/* ═══════════════════════════════════════════════════════════════
   CONTAINER STUDIO · container.css
   ═══════════════════════════════════════════════════════════════ */

/* ── RESET & TOKENS ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0b0c0e;
  --surface:     #111318;
  --elevated:    #181b22;
  --overlay:     #1e222c;
  --card:        #14161d;
  --card-hover:  #1a1e28;

  --accent:      #c8ff57;
  --accent-dim:  #9ecf2d;
  --accent-glow: rgba(200,255,87,0.12);
  --accent-alt:  #57d4ff;

  --text:        #f0f2f5;
  --text-2:      #8c92a4;
  --text-3:      #555c6e;
  --text-inv:    #0b0c0e;

  --border:      rgba(255,255,255,0.07);
  --border-acc:  rgba(200,255,87,0.35);

  --radius:      6px;
  --radius-lg:   10px;
  --ff:          'Syne', sans-serif;
  --ff-mono:     'Space Mono', monospace;

  --nav-h:       56px;
  --sidebar-w:   308px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ──────────────────────────────────────────────────────── */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); padding: 0 28px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,12,14,0.9); backdrop-filter: blur(16px);
}
.nav-logo {
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text);
  text-decoration: none; border: 1px solid var(--border);
  padding: 5px 12px; border-radius: var(--radius);
  transition: border-color .2s, background .2s;
}
.nav-logo:hover { border-color: var(--accent); background: var(--accent-glow); }
.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 12px; color: var(--text-2); text-decoration: none;
  letter-spacing: .04em; transition: color .2s;
}
.nav-links a:hover { color: var(--text); }

/* ── PHASE 1 – COMPONENT PICKER ──────────────────────────────── */
.phase-pick {
  min-height: calc(100vh - var(--nav-h) - 52px);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 32px;
}
.pick-header { text-align: center; margin-bottom: 52px; }
.pick-title {
  font-size: 36px; font-weight: 800; line-height: 1.1; margin-bottom: 12px;
}
.pick-title em { font-style: normal; color: var(--accent); }
.pick-sub { font-size: 14px; color: var(--text-2); line-height: 1.6; }

.pick-grid {
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
  max-width: 860px;
}

.pick-card {
  width: 152px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px 16px;
  cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color .18s, background .18s, transform .15s;
  color: var(--text-2);
}
.pick-card:hover {
  border-color: rgba(255,255,255,0.15);
  background: var(--card-hover);
  transform: translateY(-2px);
  color: var(--text);
}
.pick-card.active {
  border-color: var(--border-acc);
  background: linear-gradient(135deg, rgba(200,255,87,0.07), transparent);
  color: var(--text);
}
.pick-card-preview {
  width: 100%; height: 88px;
  background: var(--elevated);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.pick-card.active .pick-card-preview { color: var(--accent-dim); }
.pick-card-preview svg { width: 100%; height: 100%; padding: 8px; }
.pick-card-name {
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
}
.pick-card.active .pick-card-name { color: var(--accent); }
.pick-card-desc {
  font-size: 10px; color: var(--text-3); line-height: 1.5;
  letter-spacing: .02em;
}

/* ── APP LAYOUT (phases 2 & 3) ───────────────────────────────── */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-h) - 52px);
}

/* ── SIDEBAR ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 24px 18px 32px;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-header { margin-bottom: 20px; }
.sidebar-title {
  font-size: 17px; font-weight: 700; line-height: 1.2; margin-bottom: 4px;
}
.sidebar-title em { font-style: normal; color: var(--accent); }
.sidebar-sub { font-size: 11px; color: var(--text-2); line-height: 1.5; }

.comp-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-glow); border: 1px solid var(--border-acc);
  border-radius: 99px; padding: 4px 10px; margin-bottom: 16px;
  font-size: 10px; font-weight: 600; color: var(--accent);
  letter-spacing: .05em; text-transform: uppercase;
}

/* ── COLLAPSIBLE CTRL SECTIONS ────────────────────────────────── */
.ctrl-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 6px;
  background: var(--card);
}
.ctrl-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  width: 100%; text-align: left;
  background: transparent; border: none;
  color: var(--text);
  transition: background .15s;
}
.ctrl-section-head:hover { background: var(--overlay); }
.ctrl-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-2);
}
.ctrl-section-title .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.ctrl-section-chevron {
  color: var(--text-3); flex-shrink: 0;
  transition: transform .2s;
}
.ctrl-section.open .ctrl-section-chevron { transform: rotate(180deg); }
.ctrl-section-body {
  display: none;
  padding: 4px 12px 14px;
  border-top: 1px solid var(--border);
}
.ctrl-section.open .ctrl-section-body { display: block; }

/* ── CONTROL BLOCKS (legacy, inside collapsible body) ──────────── */
.ctrl-block {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.ctrl-block:last-of-type { border-bottom: none; margin-bottom: 0; }

.ctrl-label {
  display: block; font-size: 10px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 10px;
}

/* ── RANGE PAIR (min — max) ──────────────────────────────────── */
.range-row { margin-bottom: 8px; }
.range-row-label {
  font-size: 10px; color: var(--text-3); margin-bottom: 5px;
  letter-spacing: .04em;
}
.range-pair {
  display: flex; align-items: center; gap: 6px;
}
.range-pair-field { display: flex; flex-direction: column; flex: 1; gap: 2px; }
.range-pair-sub { font-size: 9px; color: var(--text-3); letter-spacing: .04em; }
.num-input {
  width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--ff-mono); font-size: 12px; font-weight: 700;
  padding: 6px 8px; outline: none;
  transition: border-color .15s;
  -moz-appearance: textfield;
}
.num-input::-webkit-inner-spin-button,
.num-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.num-input:focus { border-color: var(--accent); }
.range-sep {
  font-size: 13px; color: var(--text-3); flex-shrink: 0;
  padding-bottom: 2px;
}
.range-unit {
  font-size: 10px; color: var(--text-3); font-family: var(--ff-mono);
  flex-shrink: 0;
}

/* ── TEXT INPUT (fonts) ───────────────────────────────────────── */
.font-row { margin-bottom: 8px; }
.font-row-label { font-size: 10px; color: var(--text-3); margin-bottom: 5px; letter-spacing: .04em; }
.font-input {
  width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--ff); font-size: 12px;
  padding: 7px 10px; outline: none;
  transition: border-color .15s;
}
.font-input:focus { border-color: var(--accent); }

/* ── COLOR GRID ───────────────────────────────────────────────── */
.color-grid {
  display: flex; flex-direction: column; gap: 6px;
}
.color-item {
  display: flex; align-items: center; gap: 8px;
}
.color-item-label {
  font-size: 10px; color: var(--text-3); width: 36px;
  flex-shrink: 0; letter-spacing: .04em;
}
.color-field {
  flex: 1; display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 8px 4px 4px;
  transition: border-color .15s;
}
.color-field:focus-within { border-color: var(--accent); }
.color-swatch {
  width: 22px; height: 22px; border: none;
  border-radius: 4px; cursor: pointer; padding: 0;
  background: none; flex-shrink: 0;
}
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 3px; }
.color-hex {
  flex: 1; background: transparent; border: none;
  color: var(--text-2); font-family: var(--ff-mono);
  font-size: 11px; outline: none; min-width: 0;
}

/* ── SLIDER ───────────────────────────────────────────────────── */
.slider-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.slider-row-label { font-size: 10px; color: var(--text-3); flex-shrink: 0; width: 38px; letter-spacing: .04em; }
.ctrl-slider {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 3px;
  background: var(--elevated); border-radius: 99px;
  outline: none; cursor: pointer;
}
.ctrl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 0 3px rgba(200,255,87,0.2);
}
.ctrl-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: none;
}
.slider-val {
  font-size: 10px; font-family: var(--ff-mono);
  color: var(--accent); font-weight: 700; width: 24px;
  text-align: right; flex-shrink: 0;
}

/* ── BORDER STYLE TOGGLES ─────────────────────────────────────── */
.border-controls { display: flex; flex-direction: column; gap: 8px; }
.border-row { display: flex; align-items: center; gap: 8px; }
.border-row .ctrl-slider { flex: 1; }

.toggle-group {
  display: flex; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.toggle {
  flex: 1; border: none; background: transparent;
  color: var(--text-2); font-family: var(--ff);
  font-size: 11px; font-weight: 500;
  padding: 5px 4px; border-radius: 4px;
  cursor: pointer; transition: background .15s, color .15s;
}
.toggle:hover { color: var(--text); }
.toggle.active {
  background: var(--accent); color: var(--text-inv);
  font-weight: 700;
}

/* ── SHADOW DETAIL ────────────────────────────────────────────── */
.shadow-type-group {
  display: flex; gap: 4px; margin-bottom: 10px;
}
.shadow-type-btn {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 4px;
  cursor: pointer; font-family: var(--ff); font-size: 10px;
  font-weight: 600; letter-spacing: .04em; color: var(--text-3);
  text-transform: uppercase;
  transition: border-color .15s, color .15s, background .15s;
}
.shadow-type-btn:hover { border-color: rgba(255,255,255,.14); color: var(--text-2); }
.shadow-type-btn.active {
  border-color: var(--border-acc); background: var(--accent-glow); color: var(--accent);
}

/* ── GLASS / EFFECTS ──────────────────────────────────────────── */
.glass-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
  font-family: var(--ff); font-size: 11px; font-weight: 600;
  color: var(--text-2);
}
.glass-toggle:hover { border-color: rgba(255,255,255,.15); }
.glass-toggle.active {
  border-color: var(--border-acc); background: var(--accent-glow); color: var(--accent);
}
.glass-toggle-pip {
  width: 28px; height: 16px; border-radius: 99px;
  background: var(--elevated); border: 1px solid var(--border);
  position: relative; transition: background .15s;
}
.glass-toggle-pip::after {
  content: ''; position: absolute;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-3); top: 2px; left: 2px;
  transition: transform .15s, background .15s;
}
.glass-toggle.active .glass-toggle-pip { background: var(--accent-glow); border-color: var(--border-acc); }
.glass-toggle.active .glass-toggle-pip::after { transform: translateX(12px); background: var(--accent); }

.conditional-row { display: none; }
.conditional-row.visible { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ── RATIO PRESETS ────────────────────────────────────────────── */
.ratio-group { display: flex; gap: 4px; margin-top: 4px; }
.ratio-btn {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 0;
  cursor: pointer; font-family: var(--ff-mono); font-size: 9px;
  font-weight: 700; color: var(--text-3); letter-spacing: .04em;
  transition: border-color .15s, color .15s;
}
.ratio-btn:hover { border-color: rgba(255,255,255,.14); color: var(--text-2); }
.ratio-btn.active { border-color: var(--border-acc); color: var(--accent); background: var(--accent-glow); }

/* ── SLOT TOGGLES ─────────────────────────────────────────────── */
.slot-group {
  display: flex; gap: 4px;
}
.slot-btn {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 4px;
  cursor: pointer; font-family: var(--ff);
  font-size: 10px; font-weight: 600; letter-spacing: .04em;
  color: var(--text-3); text-transform: uppercase;
  transition: border-color .15s, color .15s, background .15s;
}
.slot-btn:hover { border-color: rgba(255,255,255,0.14); color: var(--text-2); }
.slot-btn.active {
  border-color: var(--border-acc);
  background: var(--accent-glow);
  color: var(--accent);
}

/* ── GENERATE BUTTON ──────────────────────────────────────────── */
.btn-generate {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 8px;
  background: var(--accent); color: var(--text-inv);
  border: none; border-radius: var(--radius-lg);
  font-family: var(--ff); font-size: 13px; font-weight: 700;
  padding: 13px 20px; cursor: pointer;
  letter-spacing: .04em;
  transition: opacity .15s, transform .1s;
  margin-top: 8px;
}
.btn-generate:hover { opacity: .92; }
.btn-generate:active { transform: scale(.98); }

/* ── SIDEBAR REVIEW STATE ─────────────────────────────────────── */
.sidebar-review { display: flex; flex-direction: column; gap: 16px; }
.review-token {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
}
.review-token-title {
  font-size: 10px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 10px;
}
.review-token-items { display: flex; flex-direction: column; gap: 6px; }
.review-token-row {
  display: flex; justify-content: space-between; align-items: center;
}
.review-token-key { font-size: 11px; color: var(--text-2); }
.review-token-val {
  font-size: 11px; font-family: var(--ff-mono);
  color: var(--accent-alt); font-weight: 700;
}
.color-dot {
  width: 12px; height: 12px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.1); display: inline-block;
  vertical-align: middle; margin-right: 5px; flex-shrink: 0;
}

.btn-back {
  display: flex; align-items: center; gap: 7px;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-2);
  font-family: var(--ff); font-size: 12px; font-weight: 600;
  padding: 9px 14px; cursor: pointer;
  transition: border-color .15s, color .15s;
  width: 100%;
}
.btn-back:hover { border-color: rgba(255,255,255,0.15); color: var(--text); }
.btn-figma {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-2);
  font-family: var(--ff); font-size: 12px; font-weight: 600;
  padding: 9px 14px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  width: 100%;
}
.btn-figma:hover {
  border-color: var(--border-acc);
  color: var(--accent);
  background: var(--accent-glow);
}
.btn-figma.copied {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── MAIN CONTAINER AREA ──────────────────────────────────────── */
.container-area {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}

/* ── PREVIEW AREA (Phase 2) ───────────────────────────────────── */
.preview-area {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 32px;
  min-height: 500px;
  /* Subtle grid for glass/transparency context */
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 24px 24px;
}
.preview-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 8px;
}
.preview-label::before,
.preview-label::after {
  content: ''; flex: 1; max-width: 60px;
  height: 1px; background: var(--border);
}
.preview-wrap {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 24px; flex-wrap: wrap;
}

/* ── SKELETON SHIMMER ─────────────────────────────────────────── */
@keyframes shimmer-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 0.18; }
}
.sk-shimmer { animation: shimmer-pulse 1.6s ease-in-out infinite; }

@keyframes shimmer-slide {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.sk-loading {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 75%
  ) !important;
  background-size: 200% 100% !important;
  animation: shimmer-slide 1.4s ease infinite !important;
}
/* When preview is shown over user's bg color, shimmer uses their color */
.preview-comp .sk-loading {
  background: linear-gradient(90deg,
    var(--preview-mid, #f0f0f0) 25%,
    var(--preview-front, #e0e0e0) 50%,
    var(--preview-mid, #f0f0f0) 75%
  ) !important;
  background-size: 200% 100% !important;
  animation: shimmer-slide 1.4s ease infinite !important;
}

/* ── GENERATED GALLERY (Phase 3) ─────────────────────────────── */
.review-area {
  padding: 32px 36px;
}
.review-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 40px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.review-title { font-size: 18px; font-weight: 700; }
.review-sub   { font-size: 12px; color: var(--text-2); font-family: var(--ff-mono); margin-top: 2px; }

/* ── GEN SECTIONS ─────────────────────────────────────────────── */
.gen-section { margin-bottom: 52px; }
.gen-section-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 24px;
}
.gen-section-name {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-2);
}
.gen-section-hint { font-size: 11px; font-family: var(--ff-mono); color: var(--text-3); }

.gen-variant-group { margin-bottom: 28px; }
.gen-variant-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.gen-variant-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.gen-states-row {
  display: flex; gap: 20px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 8px;
}
.gen-state { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.gen-state-label {
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); font-family: var(--ff-mono);
  display: flex; align-items: center; gap: 6px;
}
.gen-state-label::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3);
}
.gen-state-label.state-hover::before   { background: var(--accent-alt); }
.gen-state-label.state-loading::before { background: var(--accent-dim); }

/* ── GENERATED COMPONENT WRAPPER ─────────────────────────────── */
.gen-comp {
  display: inline-block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gen-comp * { transition: inherit; }

/* ── TOAST ────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px) !important;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: 99px; padding: 9px 18px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  opacity: 0 !important; transition: opacity .25s, transform .25s !important;
  pointer-events: none; z-index: 999;
}
.toast.show { opacity: 1 !important; transform: translateX(-50%) translateY(0) !important; }

/* ── FOOTER ───────────────────────────────────────────────────── */
.footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-3);
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-3); text-decoration: none; transition: color .2s; }
.footer-links a:hover { color: var(--text-2); }

/* ── UTIL ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in .3s ease both; }

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .review-area { padding: 24px 20px; }
  .pick-grid { gap: 10px; }
  .pick-card { width: 140px; }
}
@media (max-width: 720px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    width: 100%; position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .gen-states-row { gap: 12px; }
}
