/* Concrete Sphere Subwoofer Architecture Designer — CAD aesthetic */

:root {
  --bg: #0e1116;
  --bg-elev: #161b22;
  --bg-panel: #1a212c;
  --border: #2a3444;
  --border-hi: #3d4d66;
  --text: #e6edf5;
  --text-dim: #8b9bb0;
  --text-muted: #5c6b80;
  --accent: #5eb3f0;
  --accent-dim: #2a6a9a;
  --accent-glow: rgba(94, 179, 240, 0.15);
  --warn: #e8a838;
  --warn-bg: rgba(232, 168, 56, 0.12);
  --danger: #e85a5a;
  --danger-bg: rgba(232, 90, 90, 0.12);
  --ok: #4ecb8d;
  --ok-bg: rgba(78, 203, 141, 0.12);
  --concrete: #6b7a8d;
  --concrete-hatch: #4a5568;
  --driver: #c9d4e0;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  color: var(--accent);
  flex-shrink: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--border-hi);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--bg-panel);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-secondary { /* same as default */ }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr minmax(260px, 320px);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }
  .drawing-panel {
    grid-column: 1 / -1;
    order: -1;
  }
}

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .drawing-panel { order: 0; }
}

/* Panels */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-family: var(--mono);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.panel-head h2 { margin: 0; }

.badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

/* Form */
fieldset.field-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 0.85rem 0.9rem;
  margin: 0 0 0.75rem;
}

fieldset.field-group legend {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0 0.35rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.65rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

label.full { margin-top: 0.55rem; }

label span:first-child {
  font-weight: 500;
}

.input-unit {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.15s;
}

.input-unit:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.input-unit input,
select {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 0.4rem 0.5rem;
  width: 100%;
  min-width: 0;
}

.input-unit input:focus,
select:focus {
  outline: none;
}

.input-unit .unit {
  display: flex;
  align-items: center;
  padding: 0 0.45rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

select {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  padding: 0.4rem 0.5rem;
  cursor: pointer;
}

select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* SVG wrap */
.svg-wrap {
  background: #0a0d12;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 5 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.svg-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Metrics */
.metrics {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  background: var(--bg);
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 0.8rem;
}

.metric.hl {
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

.metric .label {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.metric .value {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.85rem;
  text-align: right;
  white-space: nowrap;
}

.metric .value .unit-sm {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.7rem;
  margin-left: 0.2rem;
}

.metric-section {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0.6rem 0 0.2rem;
  padding-left: 0.15rem;
}

.metric-section:first-child { margin-top: 0; }

/* Warnings */
.warnings {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.warning {
  font-size: 0.78rem;
  padding: 0.5rem 0.65rem;
  border-radius: 5px;
  border-left: 3px solid;
  line-height: 1.4;
}

.warning.warn {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: #f0c878;
}

.warning.danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #f0a0a0;
}

.warning.ok {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: #8eddb0;
}

.warning strong {
  font-weight: 600;
}

/* Formula ref */
.formula-ref {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
}

.formula-ref summary {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 0.03em;
}

.formula-ref summary:hover { color: var(--accent); }

.formula-ref ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: var(--mono);
  line-height: 1.65;
}

.formula-ref code {
  font-size: inherit;
}

.app-footer {
  margin-top: 1.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.app-footer p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Print / export friendly */
@media print {
  :root {
    --bg: #fff;
    --bg-elev: #f5f5f5;
    --bg-panel: #fff;
    --border: #ccc;
    --border-hi: #999;
    --text: #111;
    --text-dim: #444;
    --text-muted: #666;
    --accent: #0066aa;
    --accent-dim: #88b0cc;
    --accent-glow: rgba(0, 102, 170, 0.08);
    --shadow: none;
  }

  body { background: #fff; color: #111; }

  .app { max-width: none; padding: 0.5cm; }

  .header-actions,
  .formula-ref,
  .app-footer { display: none !important; }

  .layout {
    grid-template-columns: 1fr 1.4fr;
    gap: 0.4cm;
  }

  .outputs-panel {
    grid-column: 1 / -1;
  }

  .panel {
    box-shadow: none;
    break-inside: avoid;
    border-color: #bbb;
  }

  .svg-wrap {
    background: #fff;
    border-color: #999;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  input, select {
    border: 1px solid #999 !important;
  }

  .btn { display: none; }
}

/* WordPress embed: constrain if needed */
.sphere-sub-designer-embed .app {
  max-width: 100%;
}
