/* ==========================================================================
   ARITHMOPULSE — STUDIO LAYOUT & HARDWARE CHASSIS DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Paleta Hardware Analógico */
  --chassis-dark: #080a0f;
  --chassis-metal: #121620;
  --panel-bg: #151a26;
  --panel-border: rgba(255, 255, 255, 0.09);
  --panel-inset: #0c0f17;

  /* Cores de Iluminação LED & Válvulas */
  --led-amber: #ffb703;
  --led-cyan: #00f2fe;
  --led-red: #ff0055;
  --led-green: #00f5a0;
  --led-off: rgba(255, 255, 255, 0.08);

  /* Tipografia */
  --font-display: 'Orbitron', -apple-system, sans-serif;
  --font-ui: 'Space Grotesk', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Sombras & Acabamentos */
  --shadow-rack: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --shadow-inset: inset 0 2px 6px rgba(0, 0, 0, 0.8);
  --transition-fast: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body.studio-chassis {
  background-color: var(--chassis-dark);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(0, 242, 254, 0.04) 0%, transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  color: #e2e8f0;
  font-family: var(--font-ui);
  min-height: 100vh;
  padding: 20px 32px 60px 32px;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Master Rack & Header de Controle
   -------------------------------------------------------------------------- */
.master-rack {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow-rack);
  position: relative;
  margin-bottom: 24px;
}

/* Parafusos de Montagem em Rack */
.screw {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #475569, #1e293b);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.8);
}
.screw-tl { top: 8px; left: 8px; }
.screw-bl { bottom: 8px; left: 8px; }

/* Branding */
.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding-right: 16px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--led-cyan);
  box-shadow: 0 0 10px var(--led-cyan), 0 0 2px #fff;
  animation: led-pulse 3s infinite ease-in-out;
}

@keyframes led-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; filter: brightness(1.3); }
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fff;
  background: linear-gradient(180deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-model {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--led-amber);
  letter-spacing: 0.12em;
  margin-left: 20px;
}

.studio-status {
  margin-top: 8px;
  margin-left: 20px;
}

.status-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.25);
  color: var(--led-cyan);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Painel de Transporte Central */
.transport-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 10px;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transport-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1e2638;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: var(--transition-fast);
}

.transport-btn:hover {
  background: #273147;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.play-btn {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-color: #34d399;
  color: #fff;
}

.play-btn:hover {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

.play-btn.playing {
  background: linear-gradient(180deg, #eab308 0%, #ca8a04 100%);
  border-color: #facc15;
}

.stop-btn:hover {
  color: var(--led-red);
}

.rec-btn {
  border-color: rgba(255, 0, 85, 0.35);
  background: rgba(255, 0, 85, 0.08);
  color: #ff3377;
}

.rec-btn:hover {
  background: rgba(255, 0, 85, 0.18);
  border-color: #ff0055;
}

.rec-btn.recording {
  background: #ff0055;
  color: #fff;
  animation: rec-blink 1s infinite alternate;
}

@keyframes rec-blink {
  from { box-shadow: 0 0 4px #ff0055; }
  to { box-shadow: 0 0 18px #ff0055; }
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Display Digital de BPM */
.digital-display-box {
  background: var(--panel-inset);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-inset);
}

.digital-readout {
  display: flex;
  align-items: center;
  gap: 20px;
}

.readout-group {
  display: flex;
  flex-direction: column;
}

.readout-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: #64748b;
}

.readout-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--led-cyan);
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

.readout-val.neon-amber {
  color: var(--led-amber);
  text-shadow: 0 0 8px rgba(255, 183, 3, 0.4);
}

.bpm-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tempo-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: #64748b;
}

.hw-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.hw-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--led-cyan);
  cursor: pointer;
}

.mini-hw-btn {
  background: #1e2638;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #c0c8de;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mini-hw-btn:hover {
  background: #2b354d;
  color: #fff;
}

.mini-hw-btn.active {
  border-color: var(--led-cyan);
  color: var(--led-cyan);
  background: rgba(0, 242, 254, 0.12);
}

.mini-hw-btn.highlight {
  border-color: var(--led-amber);
  color: var(--led-amber);
  background: rgba(255, 183, 3, 0.1);
}

.master-faders {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Painel Central: Arithmo-Matrix
   -------------------------------------------------------------------------- */
.arithmo-matrix-panel {
  background: var(--panel-bg);
  border: 1px solid rgba(0, 242, 254, 0.2);
  border-radius: 12px;
  padding: 18px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(0, 242, 254, 0.15);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.matrix-glyph {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--led-cyan);
}

.panel-title-group h2 {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.1em;
  color: #fff;
}

.panel-info {
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.matrix-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1fr;
  gap: 20px;
}

.matrix-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin-bottom: 6px;
}

.input-action-bar {
  display: flex;
  gap: 10px;
}

.matrix-text-input {
  flex: 1;
  background: var(--panel-inset);
  border: 1px solid rgba(0, 242, 254, 0.3);
  color: var(--led-cyan);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  box-shadow: var(--shadow-inset);
  transition: var(--transition-fast);
}

.matrix-text-input:focus {
  border-color: var(--led-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.35);
}

.generate-loop-btn {
  position: relative;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  border: none;
  color: #050608;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
  transition: var(--transition-fast);
}

.generate-loop-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 242, 254, 0.6);
}

.preset-buttons-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.preset-btn.active {
  border-color: var(--led-amber);
  color: var(--led-amber);
  background: rgba(255, 183, 3, 0.1);
}

.matrix-routing-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.routing-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.routing-label {
  font-family: var(--font-mono);
  font-size: 8px;
  color: #64748b;
  letter-spacing: 0.1em;
}

.hw-select {
  background: var(--panel-inset);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 6px;
  outline: none;
}

.mapping-indicator-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ind-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #64748b;
  padding: 2px 6px;
  border-radius: 4px;
}

.ind-pill.active {
  border-color: rgba(0, 242, 254, 0.3);
  color: var(--led-cyan);
  background: rgba(0, 242, 254, 0.05);
}

/* --------------------------------------------------------------------------
   Rack de Módulos de Instrumentos
   -------------------------------------------------------------------------- */
.instruments-rack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rack-module {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow-rack);
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.module-title-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.module-code {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--led-amber);
  background: rgba(255, 183, 3, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.module-title-bar h3 {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #fff;
}

.module-quick-actions {
  display: flex;
  gap: 8px;
}

/* Oculto / Utilitário */
.hidden {
  display: none !important;
}

/* Toast */
.studio-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(18, 22, 34, 0.95);
  border: 1px solid var(--led-cyan);
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 242, 254, 0.3);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: var(--transition-fast);
  z-index: 100;
}

.studio-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsividade */
@media (max-width: 1100px) {
  .master-rack {
    grid-template-columns: 1fr;
  }
  .matrix-grid {
    grid-template-columns: 1fr;
  }
}
