/* ══════════════════════════════════════════════════════════════════
   SHADOW LAMP GENERATOR — style.css
   ProSlicer Plugin · All 4 themes
   ══════════════════════════════════════════════════════════════════ */

/* ─── GOOGLE FONTS already loaded via HTML ──────────────────────── */

/* ════════════════════════════  CSS CUSTOM PROPERTIES  ════════════ */
:root {
  --ff-body: 'Inter', system-ui, sans-serif;
  --ff-mono: 'JetBrains Mono', monospace;
  --ff-brand: 'Orbitron', sans-serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.18);
  --shadow-md: 0 6px 24px rgba(0,0,0,.28);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.38);
}

/* ─── THEME: DARK (default) ────────────────────────────────────── */
.theme-dark {
  --bg:          #0d0d14;
  --bg2:         #13131f;
  --bg3:         #1c1c2e;
  --bg4:         #242438;
  --surface:     #1a1a2e;
  --surface2:    #22223a;
  --border:      #2e2e4a;
  --border2:     #3a3a5e;
  --text:        #e8e8f5;
  --text2:       #a0a0c0;
  --text3:       #6060a0;
  --accent:      #7c6bff;
  --accent2:     #5b4fe0;
  --accent-glow: rgba(124,107,255,.35);
  --highlight:   #ff6b9d;
  --success:     #4ecca3;
  --warn:        #ffb347;
  --canvas-bg:   #111120;
  --header-bg:   rgba(13,13,20,.92);
}

/* ─── THEME: LIGHT ──────────────────────────────────────────────── */
.theme-light {
  --bg:          #f0f4ff;
  --bg2:         #e8ecff;
  --bg3:         #dde3ff;
  --bg4:         #d0d8ff;
  --surface:     #ffffff;
  --surface2:    #f5f7ff;
  --border:      #c8d0f0;
  --border2:     #a0aadd;
  --text:        #1a1a40;
  --text2:       #4a4a80;
  --text3:       #8080b0;
  --accent:      #5c4fd0;
  --accent2:     #4030b0;
  --accent-glow: rgba(92,79,208,.2);
  --highlight:   #e0336b;
  --success:     #1a9e78;
  --warn:        #e08000;
  --canvas-bg:   #eaefff;
  --header-bg:   rgba(240,244,255,.95);
}

/* ─── THEME: VIBRANT ────────────────────────────────────────────── */
.theme-vibrant {
  --bg:          #0f0620;
  --bg2:         #160a2e;
  --bg3:         #1f1040;
  --bg4:         #281650;
  --surface:     #1a0e38;
  --surface2:    #221450;
  --border:      #3d1d7a;
  --border2:     #5c30a0;
  --text:        #f0e8ff;
  --text2:       #c0a8ee;
  --text3:       #8060b0;
  --accent:      #ff6b6b;
  --accent2:     #e0404a;
  --accent-glow: rgba(255,107,107,.4);
  --highlight:   #4ecdc4;
  --success:     #4ecdc4;
  --warn:        #ffe66d;
  --canvas-bg:   #0d0520;
  --header-bg:   rgba(15,6,32,.94);
}

/* ─── THEME: PRO-TECH (Cyber / HUD) ────────────────────────────── */
.theme-protech {
  --bg:          #000d06;
  --bg2:         #001a0a;
  --bg3:         #002212;
  --bg4:         #002e18;
  --surface:     #001a0a;
  --surface2:    #002812;
  --border:      #00501e;
  --border2:     #00802e;
  --text:        #c8ffdc;
  --text2:       #70d090;
  --text3:       #30804a;
  --accent:      #00ff7a;
  --accent2:     #00cc60;
  --accent-glow: rgba(0,255,122,.35);
  --highlight:   #00d4ff;
  --success:     #00ff7a;
  --warn:        #ffcc00;
  --canvas-bg:   #000d06;
  --header-bg:   rgba(0,13,6,.96);
  --ff-body:     'JetBrains Mono', monospace;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background var(--transition), color var(--transition);
}

.theme-protech body,
.theme-protech * { font-family: var(--ff-mono) !important; }

/* ════════════════════════════  HEADER  ═══════════════════════════ */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 58px;
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-brand { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.brand-icon {
  width: 38px; height: 38px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.brand-icon svg { width:100%; height:100%; }
.brand-dot { animation: pulse-brand 2s ease-in-out infinite; }
@keyframes pulse-brand {
  0%,100% { r:4; opacity:1; }
  50%      { r:5; opacity:.7; }
}

.brand-text { display:flex; flex-direction:column; }
.brand-name {
  font-family: var(--ff-brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text);
  line-height: 1.2;
}
.brand-sub { font-size: 9px; color: var(--text3); letter-spacing:.12em; text-transform:uppercase; }

.header-nav { display:flex; gap:4px; margin: 0 auto; }
.nav-btn {
  padding: 6px 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text2);
  font-family: var(--ff-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: .03em;
}
.nav-btn:hover { border-color: var(--accent); color: var(--text); background: var(--bg3); }
.nav-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

.header-actions { display:flex; align-items:center; gap:12px; flex-shrink:0; }

.theme-switcher { display:flex; gap:6px; align-items:center; }
.theme-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
  padding: 0;
}
.theme-dot:hover { transform: scale(1.25); border-color: var(--text); }
.theme-dot.active { border-color: var(--accent); transform: scale(1.2); }

.export-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 0 16px var(--accent-glow);
}
.export-btn svg { width:16px; height:16px; }
.export-btn:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.export-btn:active { transform: translateY(0); }

/* ════════════════════════════  MAIN LAYOUT  ══════════════════════ */
.app-main {
  display: grid;
  grid-template-columns: auto 1fr 240px;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 58px - 30px);
}

/* ─── SIDEBAR ──────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
  width: 320px;
  min-width: 250px;
  max-width: 50vw;
  resize: horizontal;
  min-height: 0;
  height: 100%;
}

.ctrl-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color var(--transition);
}
.ctrl-section:hover { border-color: var(--border2); }

.ctrl-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctrl-icon { font-size: 14px; }

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-md);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg3);
}
.upload-zone:hover {
  border-color: var(--accent);
  background: var(--bg4);
  box-shadow: 0 0 16px var(--accent-glow);
}
.upload-icon { font-size: 28px; opacity: .6; margin-bottom: 6px; }
.upload-text { font-size: 12px; color: var(--text2); margin-bottom: 3px; }
.upload-sub  { font-size: 10px; color: var(--text3); }

/* SLIDERS */
.slider-group { display:flex; flex-direction:column; gap:7px; }
.inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctrl-label {
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  min-width: 82px;
  flex-shrink: 0;
}
.slider {
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--bg4);
  outline: none;
  cursor: pointer;
  transition: background var(--transition);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
  border: 2px solid var(--bg);
  transition: transform var(--transition);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.3); }
.slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
  border: 2px solid var(--bg);
}
.slider-val {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--accent);
  min-width: 32px;
  text-align: right;
}

/* NUMBER INPUTS (Slicer-style) */
.num-input {
  flex: 1;
  background: var(--bg4);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--ff-mono);
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  outline: none;
  transition: all var(--transition);
}
.num-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.num-input::-webkit-outer-spin-button,
.num-input::-webkit-inner-spin-button {
  opacity: 1; /* always show arrows */
}
.unit-label {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--ff-mono);
}

/* TOGGLE */
.toggle-switch { position:relative; display:inline-block; width:36px; height:20px; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--bg4);
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: var(--text3);
  transition: all var(--transition);
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::before {
  left: 19px;
  background: #fff;
}

/* QUICK ACTIONS */
.quick-actions { display:flex; flex-wrap:wrap; gap:6px; }
.quick-btn {
  padding: 5px 10px;
  border: 1px solid var(--border2);
  border-radius: 14px;
  background: var(--bg3);
  color: var(--text2);
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition);
}
.quick-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--bg4);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ─── VIEWPORT ─────────────────────────────────────────────────── */
.viewport {
  overflow: hidden;
  background: var(--canvas-bg);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  gap: 16px;
  flex-wrap: wrap;
  align-content: flex-start;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.tab-content.active { display: flex; }

/* CANVAS CARDS */
.canvas-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.canvas-wrap:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}
.canvas-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
}
canvas {
  display: block;
  border-radius: var(--radius-sm);
  background: var(--canvas-bg);
  max-width: 100%;
  height: auto;
}

/* ─── PREVIEW TAB ──────────────────────────────────────────────── */
.preview-container { width:100%; display:flex; flex-direction:column; align-items:center; gap:20px; flex:1; }
.preview-room {
  position: relative;
  width: 700px; max-width: 100%;
  height: 500px;
  background: radial-gradient(ellipse at center, #1a1a30 0%, #080810 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
#canvas-wall-preview { position:absolute; inset:0; width:100%; height:100%; border-radius: var(--radius-lg); }
.preview-lamp-box {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
}
.lamp-led {
  position: absolute;
  inset: 50%; transform: translate(-50%,-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 20px 8px rgba(255,240,200,.9);
  transition: all .3s;
}

.preview-controls { display:flex; gap:12px; }
.pill-btn {
  padding: 8px 20px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text2);
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition);
}
.pill-btn:hover, .pill-btn.active { border-color: var(--accent); color:var(--text); background:var(--bg4); box-shadow: 0 0 12px var(--accent-glow); }

/* ─── EXPORT TAB ───────────────────────────────────────────────── */
.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}
.export-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all var(--transition);
}
.export-card:hover { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }
.exp-icon { font-size: 28px; opacity: .7; }
.export-card h4 { font-size: 14px; font-weight: 600; }
.exp-dim { font-size: 11px; color: var(--text3); font-family: var(--ff-mono); }
.exp-preview { border-radius: var(--radius-sm); overflow: hidden; background: var(--canvas-bg); }
.exp-btn {
  width: 100%;
  padding: 9px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.exp-btn:hover { background: var(--accent2); box-shadow: 0 0 16px var(--accent-glow); }

.export-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.big-export-btn {
  display: flex; align-items:center; gap:10px;
  padding: 14px 40px;
  background: linear-gradient(135deg, var(--accent), var(--highlight));
  color: #fff;
  border: none;
  border-radius: var(--radius-xl);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .04em;
  transition: all var(--transition);
  box-shadow: 0 4px 24px var(--accent-glow);
}
.big-export-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 36px var(--accent-glow); }
.export-note { font-size: 11px; color: var(--text3); text-align:center; max-width: 500px; }

/* ─── INFO PANEL ───────────────────────────────────────────────── */
.info-panel {
  background: var(--bg2);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
  min-height: 0;
  height: 100%;
}
.info-header h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text3);
}
.stat-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--accent); }
.stat-label { font-size: 9px; color: var(--text3); text-transform:uppercase; letter-spacing:.08em; }
.stat-val { font-family: var(--ff-mono); font-size: 13px; color: var(--accent); font-weight: 600; }

.info-section { display:flex; flex-direction:column; gap:8px; }
.info-section h4 { font-size: 10px; font-weight:700; text-transform:uppercase; letter-spacing:.1em; color:var(--text3); }

.formula-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--ff-mono);
  font-size: 10px;
  color: var(--accent);
  text-align:center;
  line-height: 1.8;
}
.rec-list, .asm-list { display:flex; flex-direction:column; gap:4px; padding-left: 0; list-style:none; }
.rec-item, .asm-list li {
  font-size: 10.5px;
  color: var(--text2);
  padding: 5px 8px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.asm-list { list-style-type:decimal; padding-left:16px; }
.asm-list li { background:none; border:none; padding:3px 0; }

/* ─── STATUS BAR ───────────────────────────────────────────────── */
.status-bar {
  height: 30px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%,100% { opacity:1; box-shadow: 0 0 8px var(--success); }
  50%      { opacity:.5; box-shadow: 0 0 3px var(--success); }
}
.status-right { margin-left:auto; font-size: 10px; opacity:.5; }

/* ─── LOADING OVERLAY ──────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 9999;
}
.loading-spinner {
  width: 50px; height: 50px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg); } }
.loading-text { color: var(--text2); font-size: 14px; font-family: var(--ff-mono); }

/* ─── SCROLLBAR ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text3); }

/* ─── GLOW ANIMATIONS ──────────────────────────────────────────── */
@keyframes glow-pulse {
  0%,100% { box-shadow: 0 0 20px var(--accent-glow); }
  50%      { box-shadow: 0 0 40px var(--accent-glow), 0 0 80px var(--accent-glow); }
}

/* ─── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .app-main { grid-template-columns: auto 1fr; }
  .info-panel { display:none; }
}
@media (max-width: 768px) {
  .header { flex-wrap: wrap; height: auto; padding: 10px; gap: 10px; }
  .header-nav { width: 100%; justify-content: center; }
  .header-actions { width: 100%; justify-content: center; }
  
  .app-main { 
    display: flex; 
    flex-direction: column; 
    height: auto; 
    overflow-y: auto; 
  }
  
  .sidebar {
    width: 100% !important;
    max-width: 100% !important;
    resize: none;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }
  
  .viewport {
    height: auto;
    min-height: 80vh;
    overflow: visible;
  }
  
  .info-panel {
    display: flex;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    height: auto;
    overflow: visible;
  }
  
  .tab-content {
    overflow: visible;
  }
  
  .export-grid {
    grid-template-columns: 1fr;
  }
}
