/* ==========================================================================
   YAYOI KUSAMA ATELIER - INFINITY DOTS & KABOCHA PUMPKIN STUDIO
   Hypnotic Polka Dots, Mirrored Chambers & Contemporary Japanese Avant-Garde
   ========================================================================== */

:root {
  --c-bg: #0A0A0C;
  --c-surface: #141418;
  --c-surface-card: #1E1E24;
  --c-border: rgba(255, 255, 255, 0.1);
  --c-border-highlight: #FACC15;

  --kusama-yellow: #FACC15;
  --kusama-red: #EF4444;
  --kusama-black: #111114;
  --kusama-white: #FFFFFF;
  --kusama-cyan: #06B6D4;
  --kusama-pink: #EC4899;

  --c-text-main: #FFFFFF;
  --c-text-muted: #9CA3AF;

  --font-display: 'Syne', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'Rubik', -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: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}
::-webkit-scrollbar-thumb {
  background: var(--kusama-yellow);
  border-radius: 3px;
}

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

.studio-header {
  height: 66px;
  background: #111116;
  border-bottom: 2px solid #22222A;
  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.6);
}

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

.brand-crest {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid #000;
  background: var(--kusama-yellow);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.4);
}

.brand-titles h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #FFF;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-titles h1 span {
  font-size: 0.75rem;
  color: var(--kusama-yellow);
  font-family: var(--font-mono);
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
}

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

/* Button Stylings */
.btn-kusama-action {
  background: #1E1E26;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFF;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-kusama-action:hover {
  background: #2A2A36;
  border-color: var(--kusama-yellow);
  color: var(--kusama-yellow);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.25);
}

.btn-kusama-action.active {
  background: var(--kusama-yellow);
  color: #000;
  border-color: var(--kusama-yellow);
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.5);
  font-weight: 700;
}

.btn-kusama-primary {
  background: linear-gradient(135deg, #EF4444, #FACC15);
  color: #000;
  border: none;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
  transition: all 0.2s ease;
}

.btn-kusama-primary:hover {
  box-shadow: 0 0 25px rgba(250, 204, 21, 0.6);
  transform: translateY(-1px);
}

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

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

/* LEFT SIDEBAR */
.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.1em;
  color: var(--kusama-yellow);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Masterpiece Themes */
.theme-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-card-btn {
  background: var(--c-surface-card);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  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: rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.05);
}

.theme-card-btn.active {
  border-color: var(--kusama-yellow);
  background: rgba(250, 204, 21, 0.1);
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.2);
}

.theme-icon-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.theme-info h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: #FFF;
  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: #0E0E12;
  padding: 4px;
  border-radius: 20px;
  border: 1px solid var(--c-border);
}

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

.cat-tab.active {
  background: var(--kusama-yellow);
  color: #000;
}

/* Spawner 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);
  border-radius: 10px;
  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 {
  background: rgba(250, 204, 21, 0.08);
  border-color: var(--kusama-yellow);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px 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;
  font-weight: 600;
  color: #FFF;
  text-align: center;
}

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

.canvas-viewport {
  background: #08080A;
  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.9), 0 0 40px rgba(250, 204, 21, 0.15);
  border-radius: 6px;
}

.kusama-frame-border {
  position: absolute;
  inset: -14px;
  border: 14px solid #111116;
  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: #111116;
  cursor: crosshair;
}

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

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

.kusama-entity:hover {
  filter: drop-shadow(0 0 14px rgba(250, 204, 21, 0.8));
}

.kusama-entity.selected {
  outline: 2px dashed var(--kusama-yellow);
  outline-offset: 6px;
  filter: drop-shadow(0 0 20px rgba(250, 204, 21, 0.9));
}

.kusama-entity.entity-sequencer-hit {
  transform: scale(1.1);
  filter: drop-shadow(0 0 26px #FFF) brightness(1.4);
  transition: all 0.08s ease;
}

/* Scanline */
.kusama-scanline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--kusama-yellow);
  box-shadow: 0 0 16px 3px rgba(250, 204, 21, 0.85);
  pointer-events: none;
  z-index: 30;
  display: none;
  left: 0;
}

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

/* Canvas HUD */
.canvas-hud {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  background: rgba(17, 17, 22, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--c-border);
  padding: 6px 18px;
  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(--kusama-yellow);
  font-weight: 700;
}

/* ==========================================================================
   RIGHT SIDEBAR: 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);
  border-radius: 10px;
  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: #FFF;
  display: flex;
  align-items: center;
  gap: 6px;
}

.value-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--kusama-yellow);
  font-weight: 700;
}

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

/* Sliders */
input[type="range"] {
  width: 100%;
  accent-color: var(--kusama-yellow);
  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);
  color: #FFF;
  padding: 8px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-action-icon:hover {
  background: rgba(250, 204, 21, 0.2);
  border-color: var(--kusama-yellow);
  color: var(--kusama-yellow);
}

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

/* Exhibition Hall Buttons */
.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);
  color: var(--c-text-muted);
  padding: 8px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.backdrop-opt-btn.active {
  background: rgba(250, 204, 21, 0.2);
  border-color: var(--kusama-yellow);
  color: var(--kusama-yellow);
}

/* ==========================================================================
   MODALS: MOCKUP & PRINT STUDIO
   ========================================================================== */

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

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

.modal-dialog {
  background: #141418;
  border: 1px solid var(--c-border);
  border-radius: 14px;
  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);
}

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

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

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

.modal-close-btn:hover {
  color: var(--kusama-yellow);
}

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

/* Interior Mockup Environments */
.scene-environment {
  width: 100%;
  height: 400px;
  border-radius: 10px;
  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-naoshima {
  background: linear-gradient(180deg, #1E293B 0%, #38BDF8 40%, #0284C7 65%, #0F172A 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.scene-environment.scene-mirror_room {
  background: radial-gradient(circle, #2E1065 0%, #0F0728 50%, #000000 100%);
  background-image: radial-gradient(#FACC15 10%, transparent 11%), radial-gradient(#EC4899 10%, transparent 11%);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.scene-environment.scene-white_cube {
  background: #F1F5F9;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

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

/* ==========================================================================
   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: 6px;
  background: #181820;
  color: #FFF;
  font-family: var(--font-sans);
  outline: none;
}

.select-compact:focus, .input-compact:focus {
  border-color: var(--kusama-yellow);
}

.custom-dimensions-box {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: rgba(250, 204, 21, 0.05);
  padding: 10px;
  border-radius: 8px;
  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: 700;
  background: #181820;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  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(--kusama-yellow);
  color: #000;
  border-color: var(--kusama-yellow);
}

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

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

.frame-yellow {
  background: #CA8A04 !important;
  border: 16px solid #FACC15 !important;
  box-shadow: 0 15px 40px rgba(250, 204, 21, 0.45) !important;
}

.frame-walnut {
  background: #3E2723 !important;
  border: 16px solid #4E342E !important;
  box-shadow: 0 15px 40px rgba(62, 39, 35, 0.55) !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 Boards */
.mat-none { padding: 0px !important; }
.mat-slim { padding: 12px !important; }
.mat-classic { padding: 22px !important; }
.mat-wide { padding: 34px !important; }

/* Hidden on 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: #111116;
  }

  .print-museum-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 1cm;
    border-top: 2px solid #000;
    padding-top: 0.4cm;
    font-family: 'Space Mono', monospace;
    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: #333;
  }
}

/* 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;
  }
}
