/* =========================================================================
   ESTILOS GERAIS & RESET - DRONEX (PALETA VERMELHA/CARMESIM)
   ========================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: #05070a;
  color: #e6edf3;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

.app-viewport {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  background-color: #0b0f19;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

/* SISTEMA DE TELAS DA SPA */
.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  padding: 16px;
  animation: fadeScreen 0.3s ease-in-out;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none;
}

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

/* =========================================================================
   1. SPLASH SCREEN - DRONEX
   ========================================================================= */
.splash-screen {
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle, #1a0f0f 0%, #05070a 100%);
  text-align: center;
}

.splash-logo { font-size: 64px; margin-bottom: 12px; animation: pulsarLogo 1.5s infinite alternate; }
.splash-title { font-size: 32px; font-weight: 900; letter-spacing: 2px; color: #ef4444; }
.splash-sub { font-size: 13px; color: #8b949e; margin-top: 4px; }
.splash-loader {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(239, 68, 68, 0.2);
  border-top-color: #ef4444;
  border-radius: 50%;
  margin-top: 30px;
  animation: girar 1s linear infinite;
}

@keyframes pulsarLogo { from { transform: scale(0.95); } to { transform: scale(1.08); } }
@keyframes girar { to { transform: rotate(360deg); } }

/* =========================================================================
   2. TELA DE ATIVAÇÃO DE CHAVE VIP & BLOQUEIO
   ========================================================================= */
.text-center { text-align: center; }
.auth-icon { font-size: 56px; margin: 30px 0 10px 0; }
.input-license {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  padding: 12px;
  border: 1px solid #ef4444;
  background-color: #05070a;
  color: #ef4444;
}

.auth-error {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 10px;
}

.auth-error.escondido { display: none; }

/* TELA MODAL DE SESSÃO ENCERRADA (SESSÃO ÚNICA) */
.modal-kickout {
  justify-content: center;
  align-items: center;
  background-color: rgba(5, 7, 10, 0.95);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
}

.kickout-card {
  background-color: #0b0f19;
  border: 1px solid #ef4444;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.kickout-icon { font-size: 48px; margin-bottom: 12px; }
.kickout-title { font-size: 18px; font-weight: 800; color: #ef4444; margin-bottom: 8px; }
.kickout-desc { font-size: 12px; color: #8b949e; line-height: 1.5; }

/* =========================================================================
   3. TELA DE SELEÇÃO DE PLATAFORMA
   ========================================================================= */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #1a1f2e;
  margin-bottom: 20px;
}

.logo-mini { font-size: 18px; font-weight: 800; color: #ef4444; }
.version-badge { font-size: 11px; background: #1a1f2e; padding: 2px 8px; border-radius: 12px; color: #8b949e; }
.section-heading { font-size: 14px; font-weight: 700; color: #c9d1d9; text-transform: uppercase; margin-bottom: 6px; }
.view-desc { font-size: 12px; color: #8b949e; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

.grid-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.select-card {
  background-color: #0b0f19;
  border: 1px solid #1a1f2e;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.select-card.selected { border-color: #ef4444; background-color: rgba(239, 68, 68, 0.08); }
.select-card.disabled { opacity: 0.4; cursor: not-allowed; }
.card-icon { font-size: 28px; margin-bottom: 6px; }
.card-title { font-size: 13px; font-weight: 700; color: #e6edf3; }
.badge-status { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; margin-top: 6px; display: inline-block; }
.badge-status.online { background: #16a34a; color: #fff; }
.badge-status.soon { background: #1a1f2e; color: #8b949e; }

/* =========================================================================
   4. TELA DO RADAR ATIVO - DRONEX
   ========================================================================= */
.radar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #1a1f2e;
  margin-bottom: 14px;
}

.btn-back { background: transparent; border: 1px solid #1a1f2e; color: #c9d1d9; padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 11px; }
.radar-brand { text-align: center; flex: 1; }
.radar-title { font-size: 16px; font-weight: 800; color: #ef4444; }
.radar-meta { font-size: 10px; color: #8b949e; display: block; }

.status-indicator { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 12px; white-space: nowrap; }
.status-indicator.desconectado { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.4); }
.status-indicator.conectado { background: rgba(22, 163, 74, 0.15); color: #16a34a; border: 1px solid rgba(22, 163, 74, 0.4); }

.alerta-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #dc2626, #991b1b);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  cursor: pointer;
  animation: pulsarAlarme 1s infinite alternate;
}

.alerta-box.escondido { display: none; }

.broadcast-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(1, 4, 9, 0.55);
}
.broadcast-overlay.escondido { display: none; }
.broadcast-card {
  width: 100%;
  max-width: 420px;
  background: #0b0f19;
  border: 1px solid #1a1f2e;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.broadcast-nivel {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.broadcast-overlay[data-nivel="ATENCAO"] .broadcast-nivel {
  background: rgba(234, 179, 8, 0.18);
  color: #eab308;
}
.broadcast-overlay[data-nivel="CRITICO"] .broadcast-nivel {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
}
.broadcast-overlay[data-nivel="CRITICO"] .broadcast-card {
  border-color: rgba(239, 68, 68, 0.45);
}
.broadcast-titulo { font-size: 16px; margin: 0 0 8px; color: #f0f6fc; }
.broadcast-mensagem { font-size: 13px; color: #c9d1d9; margin: 0 0 14px; line-height: 1.45; }
@keyframes pulsarAlarme { from { transform: scale(0.98); } to { transform: scale(1.02); box-shadow: 0 0 20px rgba(220, 38, 38, 0.8); } }
.alerta-icone { font-size: 24px; }
.alerta-titulo { font-size: 13px; font-weight: 800; }
.alerta-desc { font-size: 11px; opacity: 0.9; }

.panel-box, .form-box { background-color: #0b0f19; border: 1px solid #1a1f2e; border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-title { font-size: 12px; font-weight: 700; color: #c9d1d9; text-transform: uppercase; }
.count-pill { font-size: 10px; background: #1a1f2e; color: #8b949e; padding: 2px 6px; border-radius: 10px; }

.stream-voos { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.loading-text { font-size: 11px; color: #6e7681; font-style: italic; }

/* BOLINHAS DE VOOS CALIBRADAS (DRONEX - VERMELHO/CARMESIM) */
.voo-pill { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 12px; color: #ffffff; }
.voo-azul { background-color: #0d6efd; border: 1px solid #54a0ff; }
.voo-roxo { background-color: #7b2cbf; border: 1px solid #9d4edd; }
.voo-rosa { background: linear-gradient(135deg, #dc2626, #ef4444); border: 1px solid #f87171; font-weight: 800; box-shadow: 0 0 10px rgba(239, 68, 68, 0.6); }

.form-row { display: flex; gap: 10px; margin-bottom: 10px; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.form-group.full { margin-bottom: 12px; }

label { font-size: 11px; font-weight: 600; color: #8b949e; }
input, select { background-color: #05070a; border: 1px solid #1a1f2e; color: #c9d1d9; padding: 8px; border-radius: 6px; font-size: 12px; outline: none; }
input:focus, select:focus { border-color: #ef4444; }

.btn-primary { width: 100%; background: linear-gradient(180deg, #dc2626, #b91c1c); color: #fff; border: none; padding: 12px; font-size: 12px; font-weight: 700; border-radius: 6px; cursor: pointer; }
.btn-primary.ativo { background: linear-gradient(180deg, #16a34a, #15803d); }

/* =========================================================================
   DRAWER MENU (POPUP FLUTUANTE - GLASSMORPHISM)
   ========================================================================= */
.drawer-popup {
  position: absolute;
  top: 60px;
  right: 0;
  width: 280px;
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  transform: translateY(-10px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  max-height: 400px;
  overflow: hidden;
}

.drawer-popup.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.drawer-popup.compact {
  max-height: 180px;
}

.drawer-popup.expanded {
  max-height: 400px;
  overflow-y: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #1a1f2e;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-name {
  font-size: 14px;
  font-weight: 700;
  color: #e6edf3;
}

.user-badge {
  font-size: 10px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.btn-fechar {
  background: transparent;
  border: 1px solid #1a1f2e;
  color: #8b949e;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-fechar:hover {
  background: #1a1f2e;
  color: #e6edf3;
}

.btn-expandir {
  background: transparent;
  border: none;
  color: #8b949e;
  cursor: pointer;
  font-size: 16px;
  padding: 8px;
  transition: transform 0.3s ease;
}

.btn-expandir:hover {
  color: #e6edf3;
  transform: rotate(180deg);
}

.drawer-section.compact {
  padding: 12px 16px;
}

.drawer-section.expanded {
  padding: 12px 16px;
  border-top: 1px solid #1a1f2e;
}

.drawer-section {
  padding: 16px;
  border-bottom: 1px solid #1a1f2e;
}

.drawer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 13px;
  color: #c9d1d9;
}

.drawer-btn {
  width: 100%;
  background: #1a1f2e;
  border: 1px solid #1a1f2e;
  color: #c9d1d9;
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  text-align: left;
  transition: all 0.2s;
}

.drawer-btn:hover {
  background: #1a1f2e;
  color: #e6edf3;
}

.drawer-btn.danger {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.drawer-btn.danger:hover {
  background: rgba(220, 38, 38, 0.2);
}

.drawer-footer {
  padding: 16px;
  margin-top: auto;
}

.drawer-section {
  padding: 16px;
  border-bottom: 1px solid #1a1f2e;
}

.drawer-section:last-child {
  border-bottom: none;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #1a1f2e;
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #8b949e;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #16a34a;
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #fff;
}

/* Menu Button */
.btn-menu {
  background: transparent;
  border: 1px solid #1a1f2e;
  color: #c9d1d9;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.btn-menu:hover {
  background: #1a1f2e;
  color: #e6edf3;
}

.radar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}