/* DIEPXD Gear Control Terminal Stylesheet - v0.6 */

:root {
  color-scheme: dark;
  --bg: #07080a;
  --ink: #f4f0e7;
  --soft: #d6d2c8;
  --muted: #979b9e;
  --faint: #5f676d;
  --line: rgba(244, 240, 231, 0.12);
  --line-strong: rgba(244, 240, 231, 0.23);
  --panel: rgba(15, 17, 20, 0.72);
  --panel-strong: rgba(22, 25, 29, 0.92);
  
  /* Cyber Tech Highlights */
  --acid: #ff7a1a;
  --acid-soft: #ffb36d;
  --cyan: #00e5ff;
  --cyan-soft: #80f2ff;
  --gold: #ffb300;
  
  --shadow: rgba(0, 0, 0, 0.45);
  
  /* Typography */
  --display: "Space Grotesk", "Pretendard Variable", Pretendard, "Segoe UI", sans-serif;
  --sans: "Pretendard Variable", Pretendard, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    linear-gradient(90deg, rgba(244, 240, 231, 0.015) 1px, transparent 1px),
    linear-gradient(rgba(244, 240, 231, 0.015) 1px, transparent 1px),
    linear-gradient(135deg, rgba(0, 229, 255, 0.04), transparent 520px),
    linear-gradient(225deg, rgba(255, 122, 26, 0.02), transparent 560px),
    #07080a;
  background-size: 64px 64px, 64px 64px, auto, auto, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(244, 240, 231, 0.04);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Shell Layout */
.terminal-shell {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 30px;
  width: min(1440px, calc(100% - 36px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 0;
}

/* Side Rail */
.side-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 24px 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
}

.side-rail .mark {
  font-weight: 700;
  font-family: var(--display);
  font-size: 20px;
  color: var(--cyan);
  margin-bottom: 24px;
}

.side-rail span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-transform: uppercase;
  color: var(--faint);
  letter-spacing: 2px;
  cursor: pointer;
  transition: color 150ms ease;
}

.side-rail span:hover,
.side-rail span.active {
  color: var(--cyan);
}

/* Workspace */
.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  gap: 20px;
}

.topbar .kicker {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.topbar h1 {
  margin: 4px 0 0 0;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -1px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border: 1px solid var(--line);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 160ms ease;
}

.tab-btn:hover {
  color: var(--ink);
  background: rgba(244, 240, 231, 0.05);
}

.tab-btn.active {
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.1);
  font-weight: 500;
  border-bottom: 2px solid var(--cyan);
}

.tab-btn.highlight:hover {
  background: rgba(255, 179, 0, 0.05);
}

.tab-btn.highlight.active {
  color: var(--gold);
  background: rgba(255, 179, 0, 0.1);
  border-bottom-color: var(--gold);
}

.session-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--mono);
  font-size: 11px;
  min-width: 90px;
}

.session-state span {
  color: var(--faint);
  text-transform: uppercase;
}

.session-state strong.ok {
  color: var(--cyan);
  font-size: 15px;
}

/* Metrics Strip */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  min-height: 80px;
}

.metric {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(15, 17, 20, 0.45);
  animation: fadeLift 350ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.metric span {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.metric strong {
  display: block;
  font-size: 20px;
  font-family: var(--mono);
  color: var(--ink);
  font-weight: 600;
}

.metric strong.ok {
  color: var(--cyan);
}

.metric em {
  display: block;
  margin-top: 2px;
  font-family: var(--sans);
  font-size: 11px;
  font-style: normal;
  color: var(--muted);
}

.metric em.ok {
  color: rgba(0, 229, 255, 0.85);
}

/* Viewport Stage and Tabs */
.viewport-stage {
  min-height: 480px;
  display: grid;
}

.tab-content {
  display: none;
  animation: tabReveal 300ms ease;
}

.tab-content.active {
  display: grid;
}

/* Generic Panel styles */
.panel {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  text-transform: uppercase;
}

.panel-head h2 {
  margin: 2px 0 0 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
}

.panel-head.compact {
  padding: 10px 16px;
}

.panel-head .table-note {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  background: rgba(244, 240, 231, 0.05);
  border: 1px solid var(--line);
}

.panel-head .table-note.ok {
  color: var(--cyan);
  border-color: rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.04);
}

.panel-head .table-note.error {
  color: #ff5252;
  border-color: rgba(255, 82, 82, 0.35);
  background: rgba(255, 82, 82, 0.04);
}

/* ==========================================
   TAB 1: ELECTRONICS & DANAWA CONFIGURATOR
   ========================================== */
.electronics-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 18px;
}

.search-bar input {
  background: #0d0f12;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 12px;
  font-family: var(--sans);
  font-size: 12px;
  outline: none;
  width: 220px;
  transition: border-color 150ms ease;
}

.search-bar input:focus {
  border-color: var(--cyan);
}

.filter-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 150ms ease;
}

.filter-btn:hover {
  color: var(--ink);
  background: rgba(244, 240, 231, 0.03);
}

.filter-btn.active {
  background: rgba(0, 229, 255, 0.06);
  border-color: var(--cyan);
  color: var(--cyan);
}

.inventory-list {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  height: 520px;
  overflow-y: auto;
}

.inventory-card {
  border: 1px solid var(--line);
  background: rgba(244, 240, 231, 0.015);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 160ms ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.inventory-card:hover {
  background: rgba(0, 229, 255, 0.04);
  border-color: rgba(0, 229, 255, 0.35);
}

.inventory-card.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--cyan);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.category-badge {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
  background: rgba(244, 240, 231, 0.05);
  padding: 2px 4px;
}

.power-badge {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--gold);
}

.inventory-card h4 {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.25;
}

.inventory-card p {
  margin: 0 0 8px 0;
  font-size: 11px;
  color: var(--muted);
}

.card-price-tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  text-align: right;
  border-top: 1px dashed rgba(244, 240, 231, 0.05);
  padding-top: 4px;
}

/* Danawa Table styles */
.danawa-stage {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}

.danawa-table {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.table-row-head,
.table-row-item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 110px 42px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.table-row-head {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  background: rgba(244, 240, 231, 0.02);
}

.table-row-item .category {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

.table-row-item .name {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-row-item .price {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--faint);
  font-size: 12px;
  cursor: pointer;
  transition: color 150ms ease;
}

.btn-clear:hover {
  color: #ff5252;
}

.danawa-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 179, 0, 0.05);
  border: 1px solid rgba(255, 179, 0, 0.25);
  font-family: var(--display);
  font-size: 16px;
}

.gold-text {
  color: var(--gold);
  font-weight: 700;
  font-family: var(--mono);
}

.schematic-viewer-compact {
  height: 150px;
  background: 
    radial-gradient(circle, rgba(244, 240, 231, 0.02) 1px, transparent 1px),
    #0c0e12;
  background-size: 12px 12px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.chassis-diagram-expanded {
  width: 95%;
  height: 95%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
}

.sch-part {
  border: 1px dashed var(--line);
  background: rgba(244, 240, 231, 0.015);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
  transition: all 250ms ease;
  user-select: none;
}

.sch-part.active {
  border-style: solid;
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.05);
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.15);
}

.sch-part.cpu { grid-column: 3; grid-row: 1 / 3; }
.sch-part.cooler { grid-column: 1 / 3; grid-row: 1; }
.sch-part.ram { grid-column: 4; grid-row: 1 / 3; }
.sch-part.gpu { grid-column: 1 / 4; grid-row: 3; }
.sch-part.psu { grid-column: 4; grid-row: 3; }
.sch-part.motherboard { grid-column: 1 / 3; grid-row: 2; }


/* ==========================================
   TAB 2: DESK SETUP PLANNER & SPACING FIX
   ========================================== */
.desk-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.desk-canvas-expanded {
  background: 
    radial-gradient(circle, rgba(0, 229, 255, 0.02) 1px, transparent 1px),
    #0a0b0e;
  background-size: 16px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 36px 24px;
  flex-grow: 1;
  min-height: 400px;
}

.desk-surface-proportional {
  width: 88%;
  height: 250px;
  border: 2px solid var(--line-strong);
  background: #2c1e14; /* Walnut */
  border-radius: 8px;
  position: relative;
  box-shadow: 0 20px 50px var(--shadow);
  transition: all 450ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Proportional elements spacing */
.monitors-proportional {
  width: 290px;
  height: 12px;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pc-tower-proportional {
  width: 36px;
  height: 80px;
  background: #15181e;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  opacity: 0;
  transform: translateY(20px);
}

.pc-tower-proportional.on-desk {
  top: 20px;
  right: 32px;
  opacity: 1;
  transform: translateY(0);
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
}

.keyboard-proportional {
  width: 90px;
  height: 32px;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #181a20;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 4px;
  display: flex;
  align-items: center;
}

.keyboard-proportional.hhkb {
  width: 80px;
  border-color: var(--cyan);
}

.keyboard-proportional.split {
  width: 100px;
  border-color: var(--gold);
  clip-path: polygon(0 0, 48% 0, 50% 10%, 52% 0, 100% 0, 100% 100%, 0 100%);
}

.keyboard-proportional.full-size {
  width: 136px;
  border-color: var(--faint);
}

/* Adjust layout positions of speakers to look roomy */
.speaker.speaker-left { left: 45px; }
.speaker.speaker-right { right: 45px; }

/* Desk Plant spacing */
.desk-plant {
  top: 25px;
  left: 110px;
  font-size: 16px;
}


/* ==========================================
   TAB 3: MASSIFY AUDIO shop CATALOG
   ========================================== */
.audio-grid-expanded {
  display: flex;
  flex-direction: column;
}

.audio-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.audio-search-header {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--line);
}

.audio-search-header input {
  background: #0d0f12;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
  width: 100%;
  transition: border-color 150ms ease;
}

.audio-search-header input:focus {
  border-color: var(--cyan);
}

.audio-product-list {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
}

.audio-item-card {
  border: 1px solid var(--line);
  background: rgba(244, 240, 231, 0.015);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 160ms ease;
}

.audio-item-card:hover {
  background: rgba(0, 229, 255, 0.04);
  border-color: rgba(0, 229, 255, 0.3);
}

.audio-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.aud-badge-shop {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.05);
  padding: 2px 6px;
}

.aud-price {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gold);
}

.audio-item-card h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}

.aud-brand {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.aud-meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.aud-cat-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
  text-transform: uppercase;
}

.aud-spec {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aud-desc {
  margin: 0;
  font-size: 12px;
  color: var(--soft);
  line-height: 1.45;
}


/* ==========================================
   TAB 4: 3D COZY ROOM VIEWPORT STYLING
   ========================================== */
.three-stage-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 0;
  background: #0a0b0e;
  border: 1px solid var(--line);
}

.three-canvas-panel {
  position: relative;
  height: 520px;
  background: #090a0d;
}

#three-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Loading overlay */
.three-loading {
  position: absolute;
  inset: 0;
  background: rgba(7, 8, 10, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10;
}

.loader-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: fanSpin 1s linear infinite;
}

.three-loading span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
}

/* Controls Panel */
.three-controls-panel {
  border: none;
  border-left: 1px solid var(--line);
  background: rgba(15, 17, 20, 0.4);
}

.three-controls {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.color-picker-grid {
  display: flex;
  gap: 10px;
}

.color-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}

.color-btn:hover {
  transform: scale(1.15);
}

.color-btn.active {
  border-color: var(--ink);
  transform: scale(1.1);
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--soft);
}

/* Keyframe Animations */
@keyframes fanSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spkPulse {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(1.08); opacity: 1; }
}

@keyframes spectrumPulse {
  0% { transform: scaleY(0.35); }
  100% { transform: scaleY(1); }
}

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

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

/* Responsiveness */
@media (max-width: 1100px) {
  .audio-product-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 980px) {
  .terminal-shell {
    grid-template-columns: 1fr;
    width: min(100% - 24px, 1220px);
    padding-top: 24px;
  }

  .side-rail {
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-left: none;
    border-right: none;
  }

  .side-rail .mark {
    margin-bottom: 0;
  }

  .side-rail span {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .electronics-grid,
  .desk-grid,
  .three-stage-grid {
    grid-template-columns: 1fr;
  }
  
  .three-controls-panel {
    border-left: none;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .session-state {
    align-items: flex-start;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .inventory-list {
    grid-template-columns: 1fr;
  }

  .audio-product-list {
    grid-template-columns: 1fr;
  }

  .table-row-head,
  .table-row-item {
    grid-template-columns: 80px minmax(0, 1fr) 90px 30px;
    font-size: 11px;
  }
}
