/* ==========================================================================
   PIONEER PREMIER DEH-P9400MP / ORGANIC OEL (LAYOUT #1 SHOWCASE EXACT STYLE)
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: radial-gradient(circle at 50% 20%, #172033 0%, #080c14 100%);
  color: #f1f5f9;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-x: hidden;
}

/* CONTAINER PRINCIPAL DO SOM DO CARRO */
.car-audio-app {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* =========================================================================
   1-DIN HARDWARE CHASSIS COMMON SHELL (Standard Automotive 180mm x 50mm)
   ========================================================================= */
.din-chassis {
  width: 100%;
  background: linear-gradient(180deg, #242730 0%, #15171d 50%, #1d1f27 100%);
  border: 3px solid #363a47;
  border-radius: 12px;
  padding: 14px 18px 10px 18px;
  position: relative;
  box-shadow: 
    0 25px 50px -10px rgba(0, 0, 0, 0.9),
    0 0 0 1px #22252e,
    inset 0 2px 4px rgba(255, 255, 255, 0.15),
    inset 0 -3px 8px rgba(0, 0, 0, 0.9);
  user-select: none;
}

.din-outer-bezel {
  background: linear-gradient(135deg, #181a22 0%, #0d0f14 100%);
  border: 2px solid #090a0d;
  border-radius: 8px;
  padding: 12px 16px 14px 16px;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.95);
}

/* TOP BAR (LOGO PIONEER + BADGES/MICRO-BOTÕES) */
.l1-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.l1-brand {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #f1f5f9;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.l1-brand span {
  color: #38bdf8;
  font-size: 0.8rem;
  margin-left: 6px;
  letter-spacing: 1px;
}

.l1-badges {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 700;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* MICRO-BOTÕES TÁTEIS DA LINHA SUPERIOR (BSM & MENU) */
.micro-badge-btn {
  background: #1e2533;
  border: 1px solid #333d52;
  color: #94a3b8;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}

.micro-badge-btn:hover {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.micro-badge-btn.btn-bsm-top {
  border-color: #7c2d12;
  color: #f97316;
}

.micro-badge-btn.btn-bsm-top:hover, .micro-badge-btn.btn-bsm-top.bsm-active {
  background: #ea580c;
  color: #fff;
  border-color: #fb923c;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.7);
}

/* CD SLOT */
.l1-cd-slot {
  height: 5px;
  background: #000;
  border-radius: 3px;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 2px #000, 0 1px 0 rgba(255,255,255,0.06);
}

/* MAIN DECK GRID (KNOB + DISPLAY OEL) */
.l1-main-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  align-items: center;
}

/* Pioneer Rotary Knob with Rotary Marker & Power Inner */
.l1-knob-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.l1-knob-outer {
  width: 96px;
  height: 96px;
  background: conic-gradient(from 0deg, #1c1e24, #3d4251, #1c1e24, #3d4251, #1c1e24);
  border-radius: 50%;
  border: 3px solid #111317;
  box-shadow: 0 8px 18px rgba(0,0,0,0.85), inset 0 2px 3px rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: ns-resize;
  touch-action: none;
  transition: transform 0.05s ease-out;
}

.l1-knob-outer:active {
  cursor: grabbing;
}

.l1-knob-indicator {
  position: absolute;
  top: 5px;
  width: 4px;
  height: 12px;
  background: #38bdf8;
  border-radius: 2px;
  box-shadow: 0 0 8px #38bdf8;
  pointer-events: none;
  transform-origin: 50% 43px;
  transition: transform 0.05s ease-out;
}

.l1-knob-inner {
  width: 52px;
  height: 52px;
  background: radial-gradient(circle, #252833 0%, #12141a 90%);
  border-radius: 50%;
  border: 2px solid #363b49;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.7), inset 0 1px 2px rgba(255,255,255,0.2);
  transition: all 0.2s;
  z-index: 2;
}

.l1-knob-inner.powered-on {
  color: #38bdf8;
  border-color: #0284c7;
  background: radial-gradient(circle, #0e304a 0%, #061826 90%);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.6), inset 0 1px 2px rgba(255,255,255,0.3);
  text-shadow: 0 0 10px #38bdf8;
}

.l1-knob-inner.standby {
  color: #f87171;
  border-color: #450a0a;
  background: radial-gradient(circle, #1a1111 0%, #0d0808 90%);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.05);
}

.l1-knob-inner svg {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
  transition: all 0.2s ease;
}

.l1-knob-inner.powered-on svg {
  filter: drop-shadow(0 0 6px #38bdf8);
}

.l1-knob-inner.standby svg {
  filter: drop-shadow(0 0 3px rgba(248, 113, 113, 0.4));
}

.l1-knob-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.62rem;
  color: #64748b;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* Pioneer Deep Blue Organic OEL Display */
.l1-display {
  background: #010813;
  border: 3px solid #1c2432;
  border-radius: 6px;
  padding: 12px 16px;
  box-shadow: inset 0 0 25px rgba(0,0,0,0.98), 0 0 15px rgba(2, 132, 199, 0.15);
  position: relative;
  overflow: hidden;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.l1-display::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 200, 255, 0.04) 0px, rgba(0, 200, 255, 0.04) 1px, transparent 2px, transparent 4px);
  pointer-events: none;
}

/* MODO STANDBY FIEL PIONEER (EXIBE RELÓGIO DIGITAL CENTRALIZADO) */
.l1-display.standby-mode {
  background: #01050b;
  border-color: #0c141f;
  box-shadow: inset 0 0 25px rgba(0,0,0,0.99);
}

.l1-display.standby-mode .l1-screen-top {
  border-bottom: 1px dashed rgba(56, 189, 248, 0.15);
  color: #0e3b5e;
}

.l1-display.standby-mode .l1-station-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 2.1rem;
  font-weight: 700;
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
  text-align: center;
  letter-spacing: 4px;
}

.l1-display.standby-mode .l1-stereo-tag {
  opacity: 0.1;
}

.l1-display.standby-mode .l1-freq-text {
  color: #0e3b5e;
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.l1-screen-top {
  display: flex;
  justify-content: space-between;
  font-family: 'Orbitron', monospace;
  font-size: 0.72rem;
  color: #38bdf8;
  letter-spacing: 1px;
  border-bottom: 1px dashed rgba(56, 189, 248, 0.3);
  padding-bottom: 4px;
}

.l1-screen-center {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0;
}

.l1-station-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.55rem;
  font-weight: 700;
  color: #67e8f9;
  text-shadow: 0 0 12px rgba(103, 232, 249, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.l1-stereo-tag {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 900;
  background: #0284c7;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  box-shadow: 0 0 8px #0284c7;
}

.l1-screen-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.l1-freq-text {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: #38bdf8;
  letter-spacing: 2px;
  line-height: 1;
}

.l1-eq-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 24px;
}

.l1-eq-bar {
  width: 6px;
  background: #083344;
  border-radius: 1px;
  height: 4px;
  transition: height 0.08s ease-out;
}

.l1-eq-bar.active {
  background: linear-gradient(to top, #0284c7, #38bdf8, #f43f5e);
  box-shadow: 0 0 6px #38bdf8;
}

/* =========================================================================
   PIONEER PRESETS ROW (EXATAMENTE 8 BOTÕES: 1-6 + SEEK- + SEEK+)
   ========================================================================= */
.l1-presets-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr) 50px 50px;
  gap: 6px;
  margin-top: 14px;
}

.l1-btn {
  background: linear-gradient(180deg, #2a2e38 0%, #16181f 100%);
  border: 1px solid #3b404e;
  border-radius: 4px;
  color: #94a3b8;
  padding: 8px 4px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.15s;
  min-height: 42px;
}

.l1-btn:hover {
  background: linear-gradient(180deg, #373d4b 0%, #20232d 100%);
  color: #fff;
}

.l1-btn:active {
  transform: translateY(1px);
}

.l1-btn.active {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6), inset 0 1px 2px rgba(255,255,255,0.4);
}

.l1-btn .num {
  font-weight: 900;
  color: #38bdf8;
}

.l1-btn.active .num {
  color: #fff;
}

.l1-btn .lbl {
  font-size: 0.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65px;
}

/* =========================================================================
   GRAVAÇÃO EM BAIXO RELEVO NO ESPAÇO INFERIOR DA MOLDURA
   ========================================================================= */
.chassis-engraving {
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #434b5c;
  text-align: right;
  margin-top: 10px;
  padding-right: 4px;
  text-shadow: 
    0 1px 1px rgba(255, 255, 255, 0.12),
    0 -1px 1px rgba(0, 0, 0, 0.95);
  user-select: none;
  pointer-events: none;
}

/* =========================================================================
   MODAL RETRÔ DE GERENCIAMENTO DE ESTAÇÕES
   ========================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.station-manager-modal {
  background: #111520;
  border: 2px solid #2d3748;
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.9), 0 0 30px rgba(56, 189, 248, 0.2);
  overflow: hidden;
  transform: scale(0.94);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .station-manager-modal {
  transform: scale(1);
}

.modal-header {
  padding: 18px 22px;
  background: #182030;
  border-bottom: 1px solid #2d3748;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: #38bdf8;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: #ef4444;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.add-station-box {
  background: #171d2b;
  border: 1px solid #2a3449;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* BANNER DE LINK PARA BUSCA DE RÁDIOS NO MAPA MUNDI */
.directory-link-banner {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.18) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.directory-link-banner:hover {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.3) 0%, rgba(15, 23, 42, 0.9) 100%);
  border-color: #38bdf8;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

.dir-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.dir-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dir-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #38bdf8;
}

.dir-sub {
  font-size: 0.75rem;
  color: #94a3b8;
}

.box-heading {
  font-size: 0.85rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

.form-input {
  background: #0d121c;
  border: 1px solid #263248;
  border-radius: 8px;
  color: #f8fafc;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}

.form-input:focus {
  border-color: #38bdf8;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: #0284c7;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
}

.station-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.station-item {
  background: #151b27;
  border: 1px solid #263248;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.station-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.station-item-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #f1f5f9;
}

.station-item-url {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.station-item-actions {
  display: flex;
  gap: 6px;
}

.btn-icon-action {
  background: #1f293d;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-icon-action:hover {
  background: #0284c7;
  color: #fff;
}

.btn-icon-action.btn-del:hover {
  background: #ef4444;
  border-color: #f87171;
}

@media (max-width: 768px) {
  .l1-main-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .l1-presets-row {
    grid-template-columns: repeat(4, 1fr);
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}
