/* ==========================================================================
   GUSTAV KLIMT ATELIER - WIEN 1900
   Viennese Secession & Golden Phase Interactive Canvas Styles
   ========================================================================== */

:root {
  --c-bg: #0C0A09;
  --c-surface: #171412;
  --c-surface-card: #201C19;
  --c-border: rgba(212, 175, 55, 0.25);
  --c-border-subtle: rgba(255, 255, 255, 0.08);
  --c-border-highlight: rgba(212, 175, 55, 0.6);

  --c-gold-leaf: #E5B80B;
  --c-gold-bright: #FCD34D;
  --c-gold-burnished: #B45309;
  --c-gold-champagne: #FEF3C7;
  --c-crimson: #9F1239;
  --c-emerald: #064E3B;
  --c-byzantine: #581C87;

  --c-text-main: #F3E8D0;
  --c-text-muted: #A8A29E;

  --font-serif-title: 'Cinzel Decorative', 'Cinzel', serif;
  --font-serif-body: 'Playfair Display', Georgia, serif;
  --font-mono: 'Space Mono', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--c-bg);
  color: var(--c-text-main);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--c-gold-leaf);
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.studio-header {
  height: 64px;
  background: #110E0C;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-crest {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--c-gold-leaf);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #3D2914 0%, #171412 100%);
  color: var(--c-gold-bright);
  font-size: 1.25rem;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}

.brand-titles h1 {
  font-family: var(--font-serif-title);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--c-gold-champagne);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-subtitle {
  font-family: var(--font-serif-body);
  font-size: 0.74rem;
  color: var(--c-gold-leaf);
  font-style: italic;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Button Stylings */
.btn-gold-action {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--c-border);
  color: var(--c-gold-champagne);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-gold-action:hover {
  background: rgba(212, 175, 55, 0.22);
  border-color: var(--c-gold-leaf);
  color: #FFF;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.3);
}

.btn-gold-action.active {
  background: linear-gradient(135deg, #B45309, #E5B80B);
  color: #000;
  border-color: var(--c-gold-bright);
  box-shadow: 0 0 16px rgba(229, 184, 11, 0.6);
  font-weight: 700;
}

.btn-gold-primary {
  background: linear-gradient(135deg, #E5B80B, #B45309);
  color: #000;
  border: 1px solid var(--c-gold-bright);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(229, 184, 11, 0.4);
  transition: all 0.2s ease;
}

.btn-gold-primary:hover {
  box-shadow: 0 0 25px rgba(229, 184, 11, 0.7);
  transform: translateY(-1px);
}

/* ==========================================================================
   APP WORKSPACE LAYOUT
   ========================================================================== */

.app-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 290px 1fr 290px;
  overflow: hidden;
}

/* SIDEBAR LEFT: THEMES & ARTIFACT SPAWNER */
.sidebar-left {
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--c-gold-leaf);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Master Theme Buttons */
.theme-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-card-btn {
  background: var(--c-surface-card);
  border: 1px solid var(--c-border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.theme-card-btn:hover {
  border-color: var(--c-border-highlight);
  background: rgba(212, 175, 55, 0.08);
}

.theme-card-btn.active {
  border-color: var(--c-gold-leaf);
  background: rgba(212, 175, 55, 0.15);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

.theme-card-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--c-gold-leaf);
}

.theme-icon-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.theme-info h4 {
  font-family: var(--font-serif-title);
  font-size: 0.78rem;
  color: var(--c-text-main);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.theme-info p {
  font-size: 0.68rem;
  color: var(--c-text-muted);
}

/* Category Filter Tabs */
.category-filter-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--c-border-subtle);
}

.cat-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--c-text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-tab.active {
  background: rgba(212, 175, 55, 0.2);
  color: var(--c-gold-bright);
}

/* Spawner Artifact Grid */
.spawner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.spawner-card {
  background: var(--c-surface-card);
  border: 1px solid var(--c-border-subtle);
  border-radius: 8px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.spawner-card:hover {
  border-color: var(--c-gold-leaf);
  background: rgba(212, 175, 55, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.spawner-preview {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spawner-preview svg {
  width: 100%;
  height: 100%;
}

.spawner-label {
  font-size: 0.68rem;
  color: var(--c-text-main);
  text-align: center;
  font-weight: 500;
}

/* ==========================================================================
   CENTER CANVAS WORKSPACE
   ========================================================================== */

.canvas-viewport {
  background: #090807;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.canvas-stage-wrapper {
  width: 100%;
  max-width: 680px;
  aspect-ratio: 1 / 1;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(212, 175, 55, 0.15);
  border-radius: 4px;
}

.klimt-frame-border {
  position: absolute;
  inset: -14px;
  border: 14px solid #14100D;
  outline: 1px solid var(--c-border);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8), 0 10px 30px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 20;
}

.stage-surface {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #110E0C;
  cursor: crosshair;
}

/* Backdrop Underlay SVG */
.backdrop-svg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Interactive Entities */
.klimt-entity {
  position: absolute;
  cursor: move;
  user-select: none;
  transform-origin: center center;
  transition: filter 0.2s ease;
  z-index: 10;
}

.klimt-entity:hover {
  filter: drop-shadow(0 0 10px rgba(229, 184, 11, 0.6));
}

.klimt-entity.selected {
  outline: 2px dashed var(--c-gold-leaf);
  outline-offset: 4px;
  filter: drop-shadow(0 0 16px rgba(229, 184, 11, 0.8));
}

.klimt-entity.entity-sequencer-hit {
  filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.95)) brightness(1.4);
  transform: scale(1.05);
  transition: all 0.1s ease;
}

/* Play the Painting Scanline */
.klimt-scanline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, #FFF 20%, var(--c-gold-bright) 50%, #FFF 80%, transparent);
  box-shadow: 0 0 14px 2px rgba(252, 211, 77, 0.8);
  pointer-events: none;
  z-index: 30;
  display: none;
  left: 0;
}

.klimt-scanline.active {
  display: block;
}

/* Bottom Canvas HUD */
.canvas-hud {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  background: rgba(17, 14, 12, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--c-border);
  padding: 6px 16px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--c-text-muted);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  z-index: 40;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hud-label {
  color: var(--c-gold-leaf);
  font-weight: 700;
}

/* ==========================================================================
   SIDEBAR RIGHT: INSPECTOR & CONTROLS
   ========================================================================== */

.sidebar-right {
  background: var(--c-surface);
  border-left: 1px solid var(--c-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.inspector-card {
  background: var(--c-surface-card);
  border: 1px solid var(--c-border-subtle);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-row label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--c-text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.value-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--c-gold-leaf);
}

/* Arbitrary Hex Color Picker */
.styled-color-input {
  -webkit-appearance: none;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  padding: 2px;
}
.styled-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.styled-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

/* Sliders */
input[type="range"] {
  width: 100%;
  accent-color: var(--c-gold-leaf);
  cursor: pointer;
}

/* Action Buttons Grid */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.btn-action-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--c-border-subtle);
  color: var(--c-text-main);
  padding: 8px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-action-icon:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--c-gold-leaf);
  color: var(--c-gold-bright);
}

.btn-action-icon.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #EF4444;
  color: #F87171;
}

/* Backdrop / Exhibition Hall Grid */
.backdrop-style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.backdrop-opt-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--c-border-subtle);
  color: var(--c-text-muted);
  padding: 8px 4px;
  font-size: 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.backdrop-opt-btn.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--c-gold-leaf);
  color: var(--c-gold-bright);
  font-weight: 600;
}

/* ==========================================================================
   MODAL WINDOWS (INTERIOR GALLERY & PRINT FOUNDRY)
   ========================================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.open {
  display: flex;
}

.modal-dialog {
  background: #151210;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  width: 90%;
  max-width: 820px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 40px rgba(212, 175, 55, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  background: #1A1613;
}

.modal-title {
  font-family: var(--font-serif-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-gold-champagne);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--c-text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: var(--c-gold-leaf);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* Interior Mockup Environments */
.scene-environment {
  width: 100%;
  height: 400px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

.scene-environment.scene-belvedere {
  background: linear-gradient(180deg, #1A130D 0%, #2A1D13 40%, #0F0A06 100%);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.scene-environment.scene-secession {
  background: linear-gradient(180deg, #262422 0%, #383430 45%, #181614 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.scene-environment.scene-salon {
  background: linear-gradient(180deg, #1C1113 0%, #2D1B1F 45%, #110B0C 100%);
  border: 1px solid rgba(159, 18, 57, 0.3);
}

.artwork-clone-viewport {
  width: 240px;
  aspect-ratio: 1 / 1;
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   FINE ART FRAME & PRINT SIZING STUDIO STYLES
   ========================================================================== */

.print-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.control-group-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-group-compact label {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #CCC;
  display: flex;
  align-items: center;
  gap: 5px;
}

.select-compact, .input-compact {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: #1B1714;
  color: #FFF;
  font-family: var(--font-sans);
  outline: none;
}

.select-compact:focus, .input-compact:focus {
  border-color: var(--c-gold-leaf);
}

.custom-dimensions-box {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: rgba(212, 175, 55, 0.05);
  padding: 10px;
  border-radius: 6px;
  border: 1px dashed var(--c-border);
  margin-top: 10px;
}

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

.orient-pill {
  flex: 1;
  padding: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--c-border-subtle);
  border-radius: 4px;
  color: var(--c-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.orient-pill.active {
  background: var(--c-gold-leaf);
  color: #000;
  border-color: var(--c-gold-leaf);
  font-weight: 700;
}

/* Frame Finishes */
.frame-gold {
  background: #B45309 !important;
  border: 16px solid #D4AF37 !important;
  box-shadow: 0 15px 40px rgba(212, 175, 55, 0.45) !important;
}

.frame-black {
  background: #111111 !important;
  border: 16px solid #111111 !important;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.65) !important;
}

.frame-walnut {
  background: #3E2723 !important;
  border: 16px solid #4E342E !important;
  box-shadow: 0 15px 40px rgba(62, 39, 35, 0.55) !important;
}

.frame-white {
  background: #FDFBF7 !important;
  border: 16px solid #E5E7EB !important;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3) !important;
}

.frame-frameless {
  background: transparent !important;
  border: 0px none !important;
  padding: 0 !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35) !important;
}

/* Mat Board Classes */
.mat-none { padding: 0px !important; }
.mat-slim { padding: 12px !important; }
.mat-classic { padding: 22px !important; }
.mat-wide { padding: 34px !important; }

/* Hidden on normal screen view */
.printable-art-container {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  .printable-art-container,
  .printable-art-container * {
    visibility: visible;
  }

  .printable-art-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    background: #FFF;
    box-sizing: border-box;
  }

  .print-border-frame {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 1.5cm;
    background: #FFF;
  }

  .print-inner-canvas {
    flex: 1;
    width: 100%;
    position: relative;
    border: 4px solid #000;
    overflow: hidden;
    background: #110E0C;
  }

  .print-museum-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 1cm;
    border-top: 2px solid #000;
    padding-top: 0.4cm;
    font-family: 'Cinzel', Georgia, serif;
    color: #000;
  }

  .print-museum-footer h3 {
    font-size: 14pt;
    font-weight: 800;
    letter-spacing: 0.05em;
  }

  .print-museum-footer p {
    font-size: 8.5pt;
    color: #222;
  }
}

/* Mobile studio shell */
@media (max-width: 900px) {
  html, body { height: 100dvh; }
  .studio-header {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
  }
  .brand-subtitle, .edition-badge, .brand-titles p { display: none; }
  .studio-header button { min-width: 40px; min-height: 40px; }
  .export-body, .export-modal-body, .modal-body, .print-controls-grid { grid-template-columns: 1fr; }
  .export-modal-container, .export-modal-dialog, .modal-dialog, .modal-card, .interior-modal-container {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: 88dvh;
  }
  .sofa-silhouette { width: min(580px, 100%); }
  .picasso-stage, .kandinsky-stage, .monet-art-stage, .dali-art-stage,
  .stage-surface, .emin-stage-surface, .mondrian-grid,
  .stage-collage-surface, .stage-flora-surface, .stage-dali-surface,
  .p-collage-item, .m-flora-item, .dali-entity, .klimt-entity, .kusama-entity,
  .kahlo-entity, .haring-entity, .emin-entity, .k-entity {
    touch-action: none;
  }
}
