/* ==========================================================================
   Tactical PTT Walkie-Talkie Communicator - Military Spec Styling
   ========================================================================== */

:root {
  /* Chassis Colors */
  --chassis-bg: #11141c;
  --chassis-metal: #191e2b;
  --chassis-border: #2a3245;
  --chassis-inset: #090c12;
  --chassis-highlight: rgba(255, 255, 255, 0.08);

  /* LCD Amber / Green Matrix */
  --lcd-bg: #10160d;
  --lcd-text: #69ff47;
  --lcd-text-amber: #ffaa1d;
  --lcd-text-muted: #2f5424;
  --lcd-border: #25381e;
  --lcd-glow: rgba(105, 255, 71, 0.25);

  /* Tactical LEDs */
  --led-green: #22c55e;
  --led-amber: #f59e0b;
  --led-red: #ef4444;
  --led-red-glow: 0 0 16px #ef4444, 0 0 30px rgba(239, 68, 68, 0.6);
  --led-amber-glow: 0 0 16px #f59e0b, 0 0 30px rgba(245, 158, 11, 0.6);
  --led-green-glow: 0 0 12px #22c55e;

  /* PTT Button Palette */
  --ptt-idle-grad: linear-gradient(145deg, #1e2433 0%, #121622 100%);
  --ptt-idle-border: #3b4661;
  --ptt-tx-grad: radial-gradient(circle, #dc2626 0%, #991b1b 100%);
  --ptt-tx-border: #ef4444;
  --ptt-rx-grad: radial-gradient(circle, #d97706 0%, #92400e 100%);
  --ptt-rx-border: #f59e0b;

  /* Typography */
  --font-lcd: 'Share Tech Mono', monospace;
  --font-display: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

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

body {
  font-family: var(--font-sans);
  background-color: #080a0f;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  padding: 1rem;
}

/* Ambient Backdrops */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
}

.glow-amber {
  width: 500px;
  height: 500px;
  top: -100px;
  left: -50px;
  background: radial-gradient(circle, #f59e0b 0%, transparent 70%);
}

.glow-red {
  width: 600px;
  height: 600px;
  bottom: -150px;
  right: -50px;
  background: radial-gradient(circle, #ef4444 0%, transparent 70%);
}

.hidden {
  display: none !important;
}

/* Base Container */
.app-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  z-index: 1;
}

/* ==========================================================================
   RADIO CHASSIS (HARDWARE FRAME)
   ========================================================================== */
.radio-chassis {
  background: var(--chassis-bg);
  border: 2px solid var(--chassis-border);
  border-radius: 28px;
  box-shadow: 
    0 25px 60px -15px rgba(0, 0, 0, 0.9),
    inset 0 1px 1px var(--chassis-highlight),
    inset 0 -2px 5px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

/* Hardware Top (Antenna + Screws + Volume Knob) */
.chassis-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0.75rem 1.5rem 0.5rem;
  background: #0d1017;
  border-bottom: 2px solid var(--chassis-inset);
}

.antenna-mount {
  width: 24px;
  height: 32px;
  background: #252c3d;
  border: 2px solid #141822;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  position: relative;
}

.antenna-stub {
  width: 12px;
  height: 20px;
  background: #0c0e14;
  margin: -16px auto 0;
  border-radius: 2px;
  border: 1px solid #323c52;
}

.hardware-screws {
  display: flex;
  gap: 1.5rem;
}

.screw {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2e374d;
  box-shadow: inset 1px 1px 2px #4b5879, inset -1px -1px 2px #10131c;
  position: relative;
}

.screw::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 1px;
  right: 1px;
  height: 2px;
  background: #141822;
  transform: rotate(45deg);
}

.volume-knob-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.knob-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #64748b;
}

.volume-slider {
  width: 80px;
  accent-color: var(--led-amber);
  cursor: pointer;
}

/* ==========================================================================
   RADIO BODY
   ========================================================================== */
.radio-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Header & Hardware LEDs */
.radio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: #cbd5e1;
}

.brand-sub {
  display: block;
  font-family: var(--font-lcd);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: #64748b;
}

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

.led-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.led-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1e2430;
  border: 1px solid #2e384d;
  transition: all 0.15s ease;
}

.led-green.active,
.led-indicator#led-pwr .led-green {
  background: var(--led-green);
  box-shadow: var(--led-green-glow);
}

.led-red.active {
  background: var(--led-red);
  box-shadow: var(--led-red-glow);
}

.led-amber.active {
  background: var(--led-amber);
  box-shadow: var(--led-amber-glow);
}

.led-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  color: #64748b;
}

/* ==========================================================================
   LCD SCREEN (EMERALD / AMBER MATRIX)
   ========================================================================== */
.lcd-screen {
  position: relative;
  background: var(--lcd-bg);
  border: 3px solid #1c2617;
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  box-shadow: 
    inset 0 3px 8px rgba(0, 0, 0, 0.8),
    0 0 15px var(--lcd-glow);
  overflow: hidden;
}

.lcd-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.3) 3px,
    rgba(0, 0, 0, 0.3) 4px
  );
  pointer-events: none;
  z-index: 2;
}

.lcd-inner {
  position: relative;
  z-index: 1;
  font-family: var(--font-lcd);
  color: var(--lcd-text);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.lcd-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  border-bottom: 1px dashed var(--lcd-text-muted);
  padding-bottom: 0.4rem;
  color: var(--lcd-text);
}

.sig-bars {
  letter-spacing: 0.1em;
}

.lcd-channel-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.2rem 0;
}

.channel-prefix {
  font-size: 1.2rem;
  color: var(--lcd-text-muted);
}

.channel-code {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 10px rgba(105, 255, 71, 0.7);
  flex: 1;
}

.btn-lcd-copy {
  background: transparent;
  border: 1px solid var(--lcd-text);
  border-radius: var(--radius-sm);
  color: var(--lcd-text);
  font-family: var(--font-lcd);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-lcd-copy:hover {
  background: var(--lcd-text);
  color: var(--lcd-bg);
}

.icon-mini {
  width: 12px;
  height: 12px;
}

/* Status Banner */
.lcd-status-banner {
  background: rgba(47, 84, 36, 0.35);
  border: 1px solid var(--lcd-text-muted);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  transition: all 0.2s ease;
}

.lcd-status-banner.state-tx {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
  color: #fca5a5;
  text-shadow: 0 0 8px #ef4444;
  animation: pulse-tx 1s infinite alternate;
}

.lcd-status-banner.state-rx {
  background: rgba(245, 158, 11, 0.35);
  border-color: #f59e0b;
  color: #fde68a;
  text-shadow: 0 0 8px #f59e0b;
}

@keyframes pulse-tx {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

.lcd-bottom-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  border-top: 1px dashed var(--lcd-text-muted);
  padding-top: 0.4rem;
}

.lcd-bottom-info strong {
  color: #fff;
}

/* ==========================================================================
   SPEAKER GRILL & LED VU METER
   ========================================================================== */
.speaker-grill-section {
  background: var(--chassis-inset);
  border: 1px solid var(--chassis-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.speaker-grill {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.grill-slot {
  height: 3px;
  background: #19202f;
  border-radius: 2px;
  box-shadow: inset 0 1px 1px #000;
}

/* 12-Segment LED VU Meter */
.vu-meter-bar {
  display: flex;
  gap: 3px;
  height: 8px;
}

.vu-segment {
  flex: 1;
  background: #182030;
  border-radius: 1px;
  transition: background 0.05s ease;
}

.vu-segment.active.g1,
.vu-segment.active.g2,
.vu-segment.active.g3,
.vu-segment.active.g4,
.vu-segment.active.g5,
.vu-segment.active.g6 {
  background: #22c55e;
  box-shadow: 0 0 4px #22c55e;
}

.vu-segment.active.a1,
.vu-segment.active.a2,
.vu-segment.active.a3,
.vu-segment.active.a4 {
  background: #f59e0b;
  box-shadow: 0 0 4px #f59e0b;
}

.vu-segment.active.r1,
.vu-segment.active.r2 {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

/* ==========================================================================
   PUSH-TO-TALK HERO BUTTON
   ========================================================================== */
.ptt-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin: 0.5rem 0;
}

.ptt-outer-ring {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, #1c2333 0%, #0d111a 100%);
  border: 4px solid #2b354d;
  box-shadow: 
    0 15px 30px rgba(0, 0, 0, 0.8),
    inset 0 4px 6px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ptt-outer-ring::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px dashed rgba(99, 102, 241, 0.25);
  transition: all 0.3s ease;
  pointer-events: none;
}

/* PTT States */
.ptt-outer-ring.state-tx {
  border-color: var(--led-red);
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.5), inset 0 0 15px rgba(239, 68, 68, 0.4);
}

.ptt-outer-ring.state-tx::before {
  border-color: rgba(239, 68, 68, 0.6);
  animation: rotate-dashed 8s linear infinite;
}

.ptt-outer-ring.state-rx {
  border-color: var(--led-amber);
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.5);
}

.ptt-outer-ring.state-rx::before {
  border-color: rgba(245, 158, 11, 0.6);
}

@keyframes rotate-dashed {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ptt-button {
  width: 175px;
  height: 175px;
  border-radius: 50%;
  border: none;
  background: var(--ptt-idle-grad);
  border: 3px solid var(--ptt-idle-border);
  box-shadow: 
    0 10px 20px rgba(0, 0, 0, 0.7),
    inset 0 4px 6px rgba(255, 255, 255, 0.15),
    inset 0 -6px 10px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.1s ease;
  touch-action: none;
}

.ptt-button:active,
.ptt-button.pressed {
  transform: scale(0.95);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.9),
    inset 0 6px 12px rgba(0, 0, 0, 0.9);
}

/* Transmitting State */
.ptt-button.state-tx {
  background: var(--ptt-tx-grad);
  border-color: var(--ptt-tx-border);
  box-shadow: 
    0 0 25px rgba(239, 68, 68, 0.7),
    inset 0 2px 8px rgba(255, 255, 255, 0.4);
}

/* Receiving / Locked State */
.ptt-button.state-rx {
  background: var(--ptt-rx-grad);
  border-color: var(--ptt-rx-border);
  cursor: not-allowed;
  opacity: 0.85;
}

.ptt-inner-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
}

.icon-ptt {
  width: 38px;
  height: 38px;
}

.ptt-primary-text {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.ptt-sub-text {
  font-family: var(--font-lcd);
  font-size: 0.65rem;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

/* Modifiers / Switches */
.ptt-modifiers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
}

.toggle-switch-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
}

.toggle-switch-wrap input {
  display: none;
}

.toggle-slider {
  width: 34px;
  height: 18px;
  background: #1c2333;
  border: 1px solid #33405c;
  border-radius: var(--radius-full);
  position: relative;
  transition: all 0.2s ease;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #64748b;
  transition: all 0.2s ease;
}

.toggle-switch-wrap input:checked + .toggle-slider {
  background: #065f46;
  border-color: #10b981;
}

.toggle-switch-wrap input:checked + .toggle-slider::after {
  transform: translateX(16px);
  background: #34d399;
}

/* ==========================================================================
   DRAWER / ACCORDION PANELS
   ========================================================================== */
.chassis-drawer {
  background: var(--chassis-inset);
  border: 1px solid var(--chassis-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--chassis-border);
  background: #11151f;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-right: 1px solid var(--chassis-border);
  padding: 0.65rem 0.5rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:last-child {
  border-right: none;
}

.tab-btn.active {
  background: #19202f;
  color: #f1f5f9;
}

.drawer-content {
  padding: 1rem;
}

/* Channel Setup Form */
.channel-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.flex-2 { flex: 2; }

.form-group label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.input-with-btn {
  display: flex;
  position: relative;
}

.form-group input {
  width: 100%;
  background: #0b0e14;
  border: 1px solid #283247;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: #fff;
  font-family: var(--font-lcd);
  font-size: 0.95rem;
  outline: none;
}

.form-group input:focus {
  border-color: #6366f1;
}

.btn-addon {
  position: absolute;
  right: 4px;
  top: 4px;
  bottom: 4px;
  background: #1f2738;
  border: 1px solid #33405b;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0 0.5rem;
  cursor: pointer;
}

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

.btn-tactical {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-connect {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn-connect:hover {
  filter: brightness(1.1);
}

.btn-disconnect {
  background: #ef4444;
  color: #fff;
}

.device-selectors-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #1c2333;
}

.device-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.device-group label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  color: #64748b;
}

.tactical-select {
  background: #0b0e14;
  border: 1px solid #283247;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
  outline: none;
  cursor: pointer;
}

/* Radio Log Terminal */
.radio-log-terminal {
  background: #090c12;
  border: 1px solid #1c2333;
  border-radius: var(--radius-sm);
  height: 140px;
  overflow-y: auto;
  padding: 0.6rem;
  font-family: var(--font-lcd);
  font-size: 0.8rem;
  color: #4ade80;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.log-entry.tx { color: #f87171; }
.log-entry.rx { color: #fde047; }
.log-entry.system { color: #94a3b8; }

/* Operators List */
.operators-list {
  list-style: none;
  max-height: 140px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.operator-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0b0e14;
  border: 1px solid #1e2638;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-lcd);
  font-size: 0.85rem;
}

.op-status {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  background: #192133;
  color: #94a3b8;
}

.operator-item.active-tx .op-status {
  background: #ef4444;
  color: #fff;
  font-weight: 700;
}

/* Chassis Bottom Grips */
.chassis-bottom {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0.85rem;
  background: #0d1017;
}

.grip-line {
  width: 45px;
  height: 4px;
  background: #1c2333;
  border-radius: 2px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: #171c26;
  border: 1px solid #33405c;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-lcd);
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  animation: toast-in 0.2s ease-out;
}

.toast-tx { border-left: 4px solid #ef4444; }
.toast-rx { border-left: 4px solid #f59e0b; }
.toast-info { border-left: 4px solid #10b981; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
