/* ============================================================
   CHROMA ART CO — LUXURY DASHBOARD DESIGN SYSTEM
   Premium dark-mode UI for abstract wall art generation
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=DM+Serif+Display:ital@0;1&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES — DESIGN TOKENS
   ============================================================ */
:root {
  /* Background Scale */
  --bg-void:        #060608;
  --bg-base:        #0A0A0D;
  --bg-surface:     #111116;
  --bg-panel:       #18181F;
  --bg-card:        #1E1E27;
  --bg-elevated:    #252530;
  --bg-hover:       #2C2C3A;

  /* Border Scale */
  --border-subtle:  rgba(255, 255, 255, 0.04);
  --border-soft:    rgba(255, 255, 255, 0.08);
  --border-medium:  rgba(255, 255, 255, 0.12);
  --border-strong:  rgba(255, 255, 255, 0.20);

  /* Gold Accent System */
  --gold-100:       #FDF6E8;
  --gold-200:       #F2E0B0;
  --gold-300:       #E6C97A;
  --gold-400:       #C9A96E;
  --gold-500:       #B8904F;
  --gold-600:       #9A7340;
  --gold-glow:      rgba(201, 169, 110, 0.20);
  --gold-glow-sm:   rgba(201, 169, 110, 0.10);

  /* Semantic Colors */
  --text-primary:   #F0EEE8;
  --text-secondary: #A8A5A0;
  --text-muted:     #6B6865;
  --text-disabled:  #3D3C3A;

  /* Status Colors */
  --success:        #6DAE8C;
  --success-dim:    rgba(109, 174, 140, 0.15);
  --warning:        #C4965A;
  --warning-dim:    rgba(196, 150, 90, 0.15);
  --error:          #C46B5A;
  --error-dim:      rgba(196, 107, 90, 0.15);
  --info:           #6A8DC4;
  --info-dim:       rgba(106, 141, 196, 0.15);

  /* Spacing Scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
  --shadow-lg:   0 10px 30px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.5);
  --shadow-xl:   0 20px 60px rgba(0,0,0,0.7), 0 8px 24px rgba(0,0,0,0.6);
  --shadow-gold: 0 0 20px rgba(201,169,110,0.25), 0 0 60px rgba(201,169,110,0.10);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 60px;
  --content-max: 1400px;
}

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

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   CUSTOM SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================
   LAYOUT SHELL
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  padding: var(--sp-6) var(--sp-6) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--header-height);
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--gold-glow);
}

.sidebar-logo-icon svg {
  width: 18px;
  height: 18px;
  fill: var(--bg-void);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.sidebar-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--gold-400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
  position: relative;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(201,169,110,0.15), rgba(201,169,110,0.08));
  color: var(--gold-300);
  border: 1px solid rgba(201,169,110,0.15);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gold-400);
  border-radius: 0 2px 2px 0;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--duration-fast);
}

.nav-item.active svg,
.nav-item:hover svg {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--gold-400);
  color: var(--bg-void);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.sidebar-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-subtle);
}

.sidebar-version {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  grid-area: header;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-8);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.header-status {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  grid-area: main;
  margin-left: var(--sidebar-width);
  padding: var(--sp-8);
  overflow-y: auto;
  min-height: calc(100vh - var(--header-height));
  background: var(--bg-base);
}

.page {
  display: none;
  animation: fadeSlideIn 0.3s var(--ease-out);
}

.page.active {
  display: block;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  margin-bottom: var(--sp-8);
}

.page-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
}

.page-eyebrow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-400);
  margin-bottom: var(--sp-1);
}

.page-title {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--text-primary);
  line-height: 1.2;
  font-weight: 400;
}

.page-title em {
  color: var(--gold-300);
  font-style: italic;
}

.page-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--sp-2);
  max-width: 480px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  position: relative;
  transition: border-color var(--duration-base) var(--ease-out);
}

.card:hover {
  border-color: var(--border-soft);
}

.card-glass {
  background: rgba(30, 30, 39, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon svg { width: 16px; height: 16px; color: var(--gold-400); }

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-4); }

.generator-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--sp-6);
  align-items: start;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  margin-bottom: var(--sp-5);
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.form-label-optional {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: var(--sp-2);
}

.form-control {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: var(--sp-3) var(--sp-4);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-control:hover {
  border-color: var(--border-medium);
}

.form-control:focus {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.12);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6865' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

select.form-control option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Segmented Controls */
.segmented-control {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.segmented-control input[type="radio"] { display: none; }

.segmented-control label {
  flex: 1;
  text-align: center;
  padding: var(--sp-2) var(--sp-3);
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.segmented-control input[type="radio"]:checked + label {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Slider */
.slider-group {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.form-range {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold-400);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 8px var(--gold-glow);
  cursor: pointer;
  transition: transform var(--duration-fast);
}

.form-range::-webkit-slider-thumb:hover { transform: scale(1.2); }

.range-value {
  min-width: 36px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-300);
  background: rgba(201,169,110,0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* Checkbox & Toggle */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] { display: none; }

.checkbox-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.checkbox-group input[type="checkbox"]:checked ~ .checkbox-box {
  background: var(--gold-400);
  border-color: var(--gold-400);
}

.checkbox-box svg {
  width: 10px;
  height: 10px;
  color: var(--bg-void);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.checkbox-group input[type="checkbox"]:checked ~ .checkbox-box svg { opacity: 1; }

.checkbox-label {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color var(--duration-fast);
}

.checkbox-group:hover .checkbox-label { color: var(--text-primary); }

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}

.toggle input { display: none; }

.toggle-track {
  width: 36px;
  height: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  position: relative;
  transition: all var(--duration-base) var(--ease-out);
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--duration-base) var(--ease-out);
}

.toggle input:checked + .toggle-track {
  background: rgba(201,169,110,0.2);
  border-color: var(--gold-500);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: var(--gold-400);
  box-shadow: 0 0 6px var(--gold-glow);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--duration-fast);
  background: rgba(255,255,255,0.06);
}

.btn:hover::after { opacity: 1; }

.btn:active { transform: scale(0.98); }

.btn svg { width: 15px; height: 15px; }

/* Primary Gold Button */
.btn-primary {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  color: var(--bg-void);
  box-shadow: 0 2px 12px var(--gold-glow), 0 1px 3px rgba(0,0,0,0.4);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px var(--gold-glow), 0 2px 8px rgba(0,0,0,0.5);
  transform: translateY(-1px);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-soft);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Danger Button */
.btn-danger {
  background: rgba(196,107,90,0.15);
  color: var(--error);
  border: 1px solid rgba(196,107,90,0.2);
}

.btn-danger:hover {
  background: rgba(196,107,90,0.25);
}

/* Button Sizes */
.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: 12px; }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: 14px; }
.btn-xl { padding: var(--sp-5) var(--sp-10); font-size: 15px; }
.btn-block { width: 100%; }

/* Loading State */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading .btn-text { opacity: 0.7; }

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn.loading .btn-spinner { display: inline-block; }

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

/* ============================================================
   PALETTE SWATCHES
   ============================================================ */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--sp-3);
}

.palette-card {
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  overflow: hidden;
  position: relative;
}

.palette-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.palette-card.selected {
  border-color: var(--gold-400);
  box-shadow: 0 0 0 1px var(--gold-400), var(--shadow-gold);
}

.palette-preview {
  height: 72px;
  display: flex;
}

.palette-swatch {
  flex: 1;
  transition: flex var(--duration-base) var(--ease-out);
}

.palette-card:hover .palette-swatch:first-child { flex: 1.4; }

.palette-info {
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
}

.palette-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.palette-category {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
   ARTWORK PREVIEW
   ============================================================ */
.preview-panel {
  position: sticky;
  top: var(--sp-8);
}

.preview-canvas-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  text-align: center;
  padding: var(--sp-8);
}

.preview-placeholder-icon {
  width: 64px;
  height: 64px;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-placeholder-icon svg { width: 28px; height: 28px; color: var(--text-muted); }

.preview-placeholder-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.preview-image.visible { display: block; }

.preview-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

/* Generation Overlay */
.preview-generating {
  position: absolute;
  inset: 0;
  background: rgba(10,10,13,0.85);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  display: none;
}

.preview-generating.visible { display: flex; }

.gen-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--gold-400);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.gen-status {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.gen-progress {
  width: 160px;
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.gen-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300));
  border-radius: 2px;
  transition: width 0.3s var(--ease-out);
  width: 0%;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  transition: all var(--duration-base) var(--ease-out);
}

.stat-card:hover {
  border-color: var(--border-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 18px; height: 18px; }

.stat-icon.gold { background: rgba(201,169,110,0.12); color: var(--gold-400); }
.stat-icon.success { background: rgba(109,174,140,0.12); color: var(--success); }
.stat-icon.info { background: rgba(106,141,196,0.12); color: var(--info); }
.stat-icon.warning { background: rgba(196,150,90,0.12); color: var(--warning); }

.stat-content { flex: 1; }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--sp-1);
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-change {
  font-size: 11px;
  color: var(--success);
  margin-top: var(--sp-1);
}

/* ============================================================
   BATCH PROGRESS
   ============================================================ */
.batch-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  margin-top: var(--sp-4);
}

.batch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.batch-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }

.batch-counter {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-300);
  font-variant-numeric: tabular-nums;
}

.batch-counter-label { font-size: 11px; color: var(--text-muted); }

.progress-bar-wrap {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: var(--sp-3);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300));
  border-radius: 3px;
  transition: width 0.4s var(--ease-out);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background: var(--gold-300);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold-glow);
}

.batch-log {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  height: 140px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.8;
}

.batch-log-entry { display: block; }
.batch-log-entry.success { color: var(--success); }
.batch-log-entry.error { color: var(--error); }
.batch-log-entry.info { color: var(--gold-300); }

/* ============================================================
   BRUSH LIBRARY
   ============================================================ */
.brush-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-3);
}

.brush-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
}

.brush-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.brush-card.selected {
  border-color: var(--gold-400);
  background: rgba(201,169,110,0.05);
}

.brush-preview {
  height: 60px;
  margin-bottom: var(--sp-3);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brush-stroke-svg {
  width: 100%;
  height: 100%;
}

.brush-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.brush-type {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brush-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.brush-tag {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
   TEXTURE LIBRARY
   ============================================================ */
.texture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-3);
}

.texture-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
}

.texture-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-medium); }

.texture-card.selected { border-color: var(--gold-400); }

.texture-preview {
  height: 80px;
  position: relative;
  overflow: hidden;
}

.texture-canvas-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.texture-info {
  padding: var(--sp-3);
}

.texture-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.texture-type { font-size: 10px; color: var(--text-muted); text-transform: capitalize; }

.texture-intensity {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.intensity-track {
  flex: 1;
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.intensity-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-600), var(--gold-300));
  border-radius: 2px;
}

/* ============================================================
   HISTORY TABLE
   ============================================================ */
.history-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.history-table th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.history-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.history-table tr:last-child td { border-bottom: none; }

.history-table tr:hover td {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.history-thumb {
  width: 40px;
  height: 54px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.history-thumb-placeholder {
  width: 40px;
  height: 54px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-thumb-placeholder svg { width: 14px; height: 14px; color: var(--text-muted); }

.history-id {
  font-family: 'Courier New', monospace;
  color: var(--gold-400);
  font-size: 11px;
}

/* ============================================================
   EXPORT CENTER
   ============================================================ */
.export-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.export-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-soft);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  transition: all var(--duration-fast);
}

.export-filter-btn:hover,
.export-filter-btn.active {
  background: rgba(201,169,110,0.12);
  border-color: var(--gold-500);
  color: var(--gold-300);
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
}

.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
}

.export-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.export-card-image {
  aspect-ratio: 3/4;
  object-fit: cover;
  width: 100%;
  display: block;
  background: var(--bg-elevated);
}

.export-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(6,6,8,0.9) 30%, transparent);
  opacity: 0;
  transition: opacity var(--duration-base);
  display: flex;
  align-items: flex-end;
  padding: var(--sp-3);
}

.export-card:hover .export-card-overlay { opacity: 1; }

.export-card-actions { display: flex; gap: var(--sp-2); }

.export-card-info {
  padding: var(--sp-3);
}

.export-card-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
}

.export-card-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.format-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.format-badge.jpg { background: rgba(201,169,110,0.15); color: var(--gold-300); }
.format-badge.png { background: rgba(109,174,140,0.15); color: var(--success); }
.format-badge.tiff { background: rgba(106,141,196,0.15); color: var(--info); }
.format-badge.psd { background: rgba(196,150,90,0.15); color: var(--warning); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastIn 0.3s var(--ease-out);
  transition: all 0.3s var(--ease-out);
}

.toast.removing { opacity: 0; transform: translateX(100%); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }

.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.toast-message { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.toast.success .toast-icon { color: var(--success); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--error); }
.toast.error .toast-icon { color: var(--error); }
.toast.info    { border-left: 3px solid var(--gold-400); }
.toast.info .toast-icon { color: var(--gold-400); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6,6,8,0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-base) var(--ease-out);
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(20px);
  transition: transform var(--duration-base) var(--ease-out);
}

.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: var(--sp-2); border-radius: var(--radius-sm); transition: color var(--duration-fast); }
.modal-close:hover { color: var(--text-primary); background: var(--bg-elevated); }

.modal-body { padding: var(--sp-6); overflow-y: auto; flex: 1; }
.modal-footer { padding: var(--sp-5) var(--sp-6); border-top: 1px solid var(--border-subtle); display: flex; gap: var(--sp-3); justify-content: flex-end; flex-shrink: 0; }

/* ============================================================
   PALETTE BUILDER
   ============================================================ */
.palette-builder {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-6);
  align-items: start;
}

.color-swatch-row {
  display: flex;
  gap: var(--sp-2);
  align-items: stretch;
  height: 100px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  margin-bottom: var(--sp-4);
}

.color-swatch-item {
  flex: 1;
  cursor: pointer;
  position: relative;
  transition: flex var(--duration-base) var(--ease-out);
  display: flex;
  align-items: flex-end;
  padding: var(--sp-2);
}

.color-swatch-item:hover { flex: 1.5; }

.color-swatch-item.active { flex: 2; }

.color-swatch-hex {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.4);
  padding: 2px 5px;
  border-radius: 3px;
  backdrop-filter: blur(4px);
  display: none;
}

.color-swatch-item:hover .color-swatch-hex,
.color-swatch-item.active .color-swatch-hex { display: block; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-section {
  margin-bottom: var(--sp-8);
}

.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.settings-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--sp-6);
}

.settings-row:last-child { border-bottom: none; }

.settings-row-info { flex: 1; }
.settings-row-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.settings-row-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.settings-row-control { flex-shrink: 0; min-width: 200px; }

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-20) var(--sp-8);
  text-align: center;
  gap: var(--sp-4);
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-2xl);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg { width: 28px; height: 28px; color: var(--text-muted); }

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
}

/* ============================================================
   DIVIDERS & HELPERS
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-6) 0;
}

.text-gold { color: var(--gold-300); }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-mono { font-family: 'Courier New', monospace; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mt-4 { margin-top: var(--sp-4); }
.w-full { width: 100%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .generator-layout { grid-template-columns: 340px 1fr; }
  .palette-builder { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 200px; }
  .generator-layout { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "header" "main";
  }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   SPECIAL EFFECTS
   ============================================================ */
.glow-gold { box-shadow: var(--shadow-gold); }
.glow-text { text-shadow: 0 0 20px rgba(201,169,110,0.4); }

/* Shimmer loading skeleton */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

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

/* Animated gradient border on active generation */
.generating-border {
  position: relative;
}

.generating-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-xl) + 2px);
  background: conic-gradient(
    from var(--angle, 0deg),
    var(--gold-600), var(--gold-300), var(--gold-500), var(--gold-600)
  );
  z-index: -1;
  animation: rotate-gradient 2s linear infinite;
}

@keyframes rotate-gradient {
  to { --angle: 360deg; }
}

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
