/* ═══════════════════════════════════════════════════════
   BlueRidgeCustomCo — Decal Designer v2
   "Warm Studio" — Dark workspace, Mountain Workshop accents
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=DM+Sans:opsz,wght@9..40,300..700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  /* ── Studio Palette ── */
  --studio-bg:       #1C1B1F;
  --studio-surface:  #252429;
  --studio-raised:   #2E2D33;
  --studio-elevated: #38363E;
  --studio-border:   rgba(255,255,255,0.07);
  --studio-border-h: rgba(255,255,255,0.14);

  /* Mountain Workshop accents */
  --accent:          #D4A373;
  --accent-hover:    #C9956A;
  --accent-dim:      rgba(212,163,115,0.12);
  --accent-glow:     rgba(212,163,115,0.25);
  --forest:          #2D6A4F;
  --forest-bright:   #40916C;
  --forest-dim:      rgba(45,106,79,0.15);
  --forest-glow:     rgba(45,106,79,0.3);
  --terracotta:      #C1694F;
  --cream:           #FAF8F5;
  --cream-dim:       rgba(250,248,245,0.06);

  /* Text hierarchy */
  --text-0:  #F0ECE6;
  --text-1:  #C4BCAF;
  --text-2:  #8A8279;
  --text-3:  #5E574F;

  /* Semantic */
  --color-primary:       var(--forest-bright);
  --color-primary-hover: var(--forest);
  --color-primary-light: var(--forest-dim);
  --color-danger:        #E55B4A;
  --color-danger-dim:    rgba(229,91,74,0.12);
  --color-warning:       #E5A53E;
  --color-success:       #4CAF74;

  /* Backgrounds (mapped for backwards compat) */
  --bg-primary:    var(--studio-surface);
  --bg-secondary:  var(--studio-bg);
  --bg-tertiary:   var(--studio-raised);
  --bg-dark:       #0F0E12;

  /* Borders */
  --border-color:    var(--studio-border);
  --border-radius:   8px;
  --border-radius-sm: 6px;
  --border-radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow:    0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* Typography */
  --font-display: 'Bricolage Grotesque', Georgia, serif;
  --font-sans:    'DM Sans', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ═══════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-1);
  background: var(--studio-bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-0);
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }

::selection {
  background: var(--accent-dim);
  color: var(--text-0);
}

/* Subtle grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ═══════════════════════════════════════
   Layout
   ═══════════════════════════════════════ */
.designer-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ═══════════════════════════════════════
   Header
   ═══════════════════════════════════════ */
.designer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem var(--space-5);
  background: var(--studio-surface);
  border-bottom: 1px solid var(--studio-border);
  z-index: 100;
}

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

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.back-button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius-sm);
  color: var(--text-2);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--studio-border);
  transition: var(--transition);
  font-size: 0.82rem;
}
.back-button:hover {
  background: var(--studio-raised);
  color: var(--text-0);
  border-color: var(--studio-border-h);
}

.designer-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-0);
  letter-spacing: -0.02em;
}

.canvas-size-indicator {
  padding: var(--space-1) var(--space-4);
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(212,163,115,0.15);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.header-button {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--text-1);
  font-weight: 600;
  font-size: 0.82rem;
  transition: var(--transition);
}
.header-button:hover {
  background: var(--studio-raised);
  border-color: var(--studio-border-h);
  color: var(--text-0);
}

.header-button.primary {
  background: var(--forest-bright);
  color: var(--cream);
  border-color: var(--forest-bright);
}
.header-button.primary:hover {
  background: var(--forest);
  border-color: var(--forest);
  box-shadow: 0 0 16px var(--forest-glow);
}

/* ═══════════════════════════════════════
   Main Content Area
   ═══════════════════════════════════════ */
.designer-main {
  display: grid;
  grid-template-columns: 280px 1fr 290px;
  gap: 0;
  flex: 1;
  overflow: hidden;
  background: var(--bg-dark);
}

/* ═══════════════════════════════════════
   Sidebars
   ═══════════════════════════════════════ */
.designer-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  background: var(--studio-bg);
  border-right: 1px solid var(--studio-border);
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.designer-sidebar::-webkit-scrollbar { width: 4px; }
.designer-sidebar::-webkit-scrollbar-track { background: transparent; }
.designer-sidebar::-webkit-scrollbar-thumb {
  background: var(--studio-elevated);
  border-radius: 4px;
}
.designer-sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

.designer-sidebar.right {
  border-right: none;
  border-left: 1px solid var(--studio-border);
}

/* ═══════════════════════════════════════
   Panels
   ═══════════════════════════════════════ */
.panel {
  background: var(--studio-surface);
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  max-height: 420px;
  border-bottom: 1px solid var(--studio-border);
}

.designer-sidebar.right .panel { max-height: 460px; }
.designer-sidebar.right .vinyl-panel { max-height: 360px; }
.designer-sidebar.right .templates-panel { max-height: 320px; }

.panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border-bottom: 1px solid var(--studio-border);
  flex-shrink: 0;
}
.panel-header i {
  color: var(--accent);
  font-size: 0.82rem;
}
.panel-header h2 {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
}

.panel-content {
  padding: var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  scroll-behavior: smooth;
}

.panel-content::-webkit-scrollbar { width: 4px; }
.panel-content::-webkit-scrollbar-track { background: transparent; }
.panel-content::-webkit-scrollbar-thumb {
  background: var(--studio-elevated);
  border-radius: 4px;
}

/* ═══════════════════════════════════════
   AI Panel
   ═══════════════════════════════════════ */
.ai-panel {
  background: var(--studio-surface);
  border: none;
  position: relative;
  overflow: hidden;
}
.ai-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--forest-bright), var(--accent));
}

.ai-panel .panel-header {
  background: transparent;
  border-bottom-color: var(--studio-border);
}
.ai-panel .panel-header i { color: var(--accent); }
.ai-panel .panel-header h2 { color: var(--text-1); }

.ai-suggestions {
  background: var(--studio-raised);
  padding: var(--space-3);
  border-radius: var(--border-radius-sm);
  min-height: 80px;
  margin-bottom: var(--space-3);
  border: 1px solid var(--studio-border);
}

.ai-intro {
  color: var(--text-2);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
}

.ai-suggestion-item {
  padding: var(--space-3);
  background: var(--accent-dim);
  border-left: 2px solid var(--accent);
  border-radius: var(--border-radius-sm);
  margin-bottom: var(--space-2);
}
.ai-suggestion-item:last-child { margin-bottom: 0; }
.ai-suggestion-item strong {
  display: block;
  color: var(--accent);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-1);
}
.ai-suggestion-item p {
  margin: 0;
  color: var(--text-1);
  font-size: 0.82rem;
  line-height: 1.45;
}

.btn-ai {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--accent);
  color: var(--studio-bg);
  border: none;
  border-radius: var(--border-radius);
  font-weight: 700;
  font-size: 0.82rem;
  transition: var(--transition);
}
.btn-ai:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════
   Catalog Panel
   ═══════════════════════════════════════ */
.search-box {
  position: relative;
  margin-bottom: var(--space-3);
}
.search-box i {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  font-size: 0.8rem;
}
.search-input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius);
  background: var(--studio-raised);
  color: var(--text-0);
  transition: var(--transition);
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--studio-elevated);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.category-filter { margin-bottom: var(--space-3); }

.category-select,
.control-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius);
  background: var(--studio-raised);
  color: var(--text-0);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.82rem;
}
.category-select:focus,
.control-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.catalog-item {
  aspect-ratio: 1;
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  cursor: grab;
  transition: var(--transition);
  background: var(--studio-raised);
  padding: 4px;
}
.catalog-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
  transform: scale(1.06);
}
.catalog-item:active { cursor: grabbing; }
.catalog-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  border-radius: 3px;
}

.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  color: var(--text-3);
  text-align: center;
}
.loading-state i {
  font-size: 1.5rem;
  margin-bottom: var(--space-3);
  color: var(--accent);
}

/* ═══════════════════════════════════════
   Quick Actions
   ═══════════════════════════════════════ */
.quick-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px dashed var(--studio-border-h);
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.82rem;
  transition: var(--transition);
  margin-bottom: var(--space-2);
}
.quick-action-btn:last-child { margin-bottom: 0; }
.quick-action-btn:hover {
  border-color: var(--forest-bright);
  background: var(--forest-dim);
  color: var(--forest-bright);
  border-style: solid;
}
.quick-action-btn i { font-size: 1rem; }

/* ═══════════════════════════════════════
   Canvas Area
   ═══════════════════════════════════════ */
.designer-canvas-area {
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
  overflow: hidden;
}

.canvas-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--studio-surface);
  border-bottom: 1px solid var(--studio-border);
}

.control-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.control-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.82rem;
  transition: var(--transition);
}
.icon-btn:hover {
  background: var(--studio-raised);
  border-color: var(--studio-border-h);
  color: var(--text-0);
}
.icon-btn.danger:hover {
  background: var(--color-danger-dim);
  border-color: var(--color-danger);
  color: var(--color-danger);
}
.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Canvas workspace */
.canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  overflow: auto;
  background:
    radial-gradient(ellipse 60% 50% at 30% 40%, rgba(212,163,115,0.03) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 70% 60%, rgba(45,106,79,0.03) 0%, transparent 70%),
    repeating-conic-gradient(var(--studio-bg) 0% 25%, rgba(255,255,255,0.012) 0% 50%) 50% / 24px 24px;
}

#designCanvas {
  box-shadow:
    0 0 0 1px var(--studio-border),
    var(--shadow-xl),
    0 0 80px rgba(0,0,0,0.3);
  background: white;
  border-radius: 2px;
}

.canvas-info-bar {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-2) var(--space-5);
  background: var(--studio-surface);
  border-top: 1px solid var(--studio-border);
  font-size: 0.75rem;
}

.info-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-3);
}
.info-item i {
  color: var(--text-3);
  font-size: 0.7rem;
}

/* ═══════════════════════════════════════
   Properties Panel
   ═══════════════════════════════════════ */
.no-selection {
  color: var(--text-3);
  font-style: italic;
  text-align: center;
  margin: var(--space-4) 0;
  font-size: 0.82rem;
}

.property-group { margin-bottom: var(--space-4); }
.property-group:last-child { margin-bottom: 0; }

.property-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: var(--space-2);
}

.property-control {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius-sm);
  background: var(--studio-raised);
  color: var(--text-0);
  font-size: 0.82rem;
}
.property-control:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--studio-elevated);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.property-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--studio-elevated);
  outline: none;
}
.property-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--studio-surface);
  box-shadow: 0 0 6px var(--accent-glow);
}

.property-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.property-btn {
  padding: var(--space-2);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.8rem;
  transition: var(--transition);
}
.property-btn:hover {
  background: var(--forest-dim);
  border-color: var(--forest-bright);
  color: var(--forest-bright);
}

/* Alignment buttons — 3-column grid */
.property-buttons.alignment-grid {
  grid-template-columns: repeat(3, 1fr);
}

/* ═══════════════════════════════════════
   Layers Panel
   ═══════════════════════════════════════ */
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 300px;
  overflow-y: auto;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}
.layer-item:hover {
  background: var(--cream-dim);
  border-color: var(--studio-border);
}
.layer-item.active {
  background: var(--accent-dim);
  border-color: rgba(212,163,115,0.2);
}

.layer-icon {
  font-size: 0.85rem;
  color: var(--text-3);
  width: 20px;
  text-align: center;
}
.layer-item.active .layer-icon { color: var(--accent); }

.layer-info { flex: 1; }
.layer-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-1);
}
.layer-item.active .layer-name { color: var(--text-0); }
.layer-type {
  font-size: 0.68rem;
  color: var(--text-3);
}

.layer-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.layer-item:hover .layer-actions { opacity: 1; }

.layer-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  font-size: 0.72rem;
  transition: var(--transition);
}
.layer-action-btn:hover { color: var(--text-0); background: var(--studio-raised); }
.layer-action-btn.delete:hover { color: var(--color-danger); background: var(--color-danger-dim); }

/* ═══════════════════════════════════════
   Vinyl Color Swatches
   ═══════════════════════════════════════ */
.palette-selector { margin-bottom: var(--space-3); }

.color-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.color-swatch {
  aspect-ratio: 1;
  border: 2px solid var(--studio-border);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.color-swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
  z-index: 1;
  border-color: var(--studio-border-h);
}
.color-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--studio-bg), 0 0 0 4px var(--accent), 0 0 12px var(--accent-glow);
  transform: scale(1.15);
  z-index: 2;
}
.color-swatch::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  background: var(--studio-elevated);
  color: var(--text-0);
  font-size: 0.62rem;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  border: 1px solid var(--studio-border);
}
.color-swatch:hover::after { opacity: 1; }

/* ═══════════════════════════════════════
   Templates
   ═══════════════════════════════════════ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}
.template-card:hover {
  border-color: var(--forest-bright);
  background: var(--forest-dim);
}

.template-preview {
  width: 52px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px;
  background: var(--studio-raised);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--studio-border);
}
.template-preview.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.template-box {
  background: var(--text-3);
  border-radius: 2px;
}
.template-box.centered { width: 26px; height: 26px; }
.template-box.image { width: 100%; height: 20px; }
.template-box.text { width: 100%; height: 6px; }
.template-box.small { width: 100%; height: 10px; }
.template-box.tiny { width: 100%; height: 100%; }

.template-card span {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
}
.template-card:hover span { color: var(--forest-bright); }

/* ═══════════════════════════════════════
   Modal
   ═══════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border-h);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--studio-border);
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-0);
}
.modal-header button {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 1.1rem;
  padding: 4px;
  transition: var(--transition);
}
.modal-header button:hover { color: var(--text-0); }

.modal-body {
  flex: 1;
  padding: var(--space-5);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-5);
  border-top: 1px solid var(--studio-border);
}

/* ═══════════════════════════════════════
   Form Elements
   ═══════════════════════════════════════ */
.form-group { margin-bottom: var(--space-4); }
.form-group:last-child { margin-bottom: 0; }

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius);
  background: var(--studio-raised);
  color: var(--text-0);
  transition: var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--studio-elevated);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-3);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.button-group {
  display: flex;
  gap: 4px;
}

.toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.82rem;
  transition: var(--transition);
}
.toggle-btn:hover {
  background: var(--studio-raised);
  border-color: var(--studio-border-h);
}
.toggle-btn.active {
  background: var(--forest-bright);
  border-color: var(--forest-bright);
  color: var(--cream);
}

.btn {
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--studio-border);
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
}
.btn.secondary {
  background: transparent;
  color: var(--text-1);
}
.btn.secondary:hover {
  background: var(--studio-raised);
  border-color: var(--studio-border-h);
}
.btn.primary {
  background: var(--forest-bright);
  border-color: var(--forest-bright);
  color: var(--cream);
}
.btn.primary:hover {
  background: var(--forest);
  border-color: var(--forest);
  box-shadow: 0 0 12px var(--forest-glow);
}

/* ═══════════════════════════════════════
   Loading Overlay
   ═══════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 27, 31, 0.92);
  backdrop-filter: blur(8px);
}
.loading-overlay[hidden] { display: none; }

.loading-spinner { text-align: center; }
.loading-spinner i {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: var(--space-4);
}
.loading-spinner p {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-1);
}

/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */
@media (max-width: 1280px) {
  .designer-main { grid-template-columns: 260px 1fr 260px; }
}

@media (max-width: 1024px) {
  .designer-main { grid-template-columns: 1fr; }
  .designer-sidebar { display: none; }
  .designer-sidebar.active {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 300px;
    z-index: 500;
    box-shadow: var(--shadow-xl);
  }
}

@media (max-width: 768px) {
  .designer-header { padding: var(--space-2) var(--space-3); }
  .header-button span, .back-button span { display: none; }
  .designer-title { font-size: 0.9rem; }
  .canvas-size-indicator {
    font-size: 0.68rem;
    padding: 2px var(--space-2);
  }
}
