/* ===========================================
   ZULU - Dashboard CSS
=========================================== */
:root {
  --bg:         #0d1117;
  --surface:    #161b22;
  --surface2:   #1c2333;
  --border:     #30363d;
  --accent:     #00e5c0;
  --accent2:    #0088ff;
  --text:       #e6edf3;
  --text-muted: #8b949e;
  --danger:     #ff4444;
  --warn:       #ffaa00;
  --ok:         #00cc88;
  --radius:     12px;
  --shadow:     0 4px 24px rgba(0,0,0,.5);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- HEADER ------------------------------ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}

.header-left { display: flex; align-items: center; gap: 16px; }

.logo-box {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg,#00e5c022,#0088ff22);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 6px 12px;
}
.logo-icon { font-size: 22px; }
.logo-text  { font-weight: 700; font-size: 14px; color: var(--accent); letter-spacing: 2px; }

.header-title {
  font-size: 18px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header-title span { color: var(--text-muted); -webkit-text-fill-color: var(--text-muted); }

.header-right { display: flex; align-items: center; gap: 16px; }

.date-range { display: flex; align-items: center; gap: 8px; }

.date-input {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 5px 10px;
  width: 130px; font-size: 12px; cursor: pointer;
}
.date-input:focus { outline: none; border-color: var(--accent); }

.btn-apply {
  background: var(--accent); color: #000; font-weight: 700;
  border: none; border-radius: 6px; padding: 6px 14px; cursor: pointer;
  font-size: 12px; transition: opacity .2s;
}
.btn-apply:hover { opacity: .85; }

.live-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--accent);
  letter-spacing: 1px;
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(0,229,192,.6);
  animation: pulse-anim 1.5s infinite;
}
@keyframes pulse-anim {
  0%   { box-shadow: 0 0 0 0 rgba(0,229,192,.6); }
  70%  { box-shadow: 0 0 0 8px rgba(0,229,192,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,229,192,0); }
}

/* --- FILTER BAR -------------------------- */
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  background: var(--surface2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 14px; font-size: 11px; cursor: pointer;
  transition: all .2s;
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--accent); color: #000;
  border-color: var(--accent); font-weight: 700;
}

/* --- MAIN GRID --------------------------- */
.main-grid {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 16px;
  padding: 16px 20px;
  min-height: calc(100vh - 100px);
}

.left-col  { display: flex; flex-direction: column; gap: 16px; }
.right-col { display: flex; flex-direction: column; gap: 16px; }

/* --- KPI CARDS --------------------------- */
.kpi-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform .2s;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-card.accent { border-color: var(--accent); background: #00e5c010; }

.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--accent); }

/* --- CARD -------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.card-icon { font-size: 18px; }
.card-header h2 {
  font-size: 13px; font-weight: 700; letter-spacing: 1px;
  color: var(--accent); text-transform: uppercase; flex: 1;
}

/* --- CHARTS ------------------------------ */
.chart-wrap  { position: relative; height: 220px; }
.chart-tall  { height: 340px; }
.chart-timeline { height: 200px; }

/* --- TIME SLIDER MODULE -------------------- */
.time-slider-module {
  margin: 4px 0 12px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.time-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.time-slider-header strong {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: .6px;
}

.time-slider-caption {
  color: var(--text-muted);
  font-size: 11px;
}

.time-slider-values {
  display: flex;
  justify-content: space-between;
  color: var(--text);
  font-size: 11px;
  margin-bottom: 8px;
}

.time-slider-rail {
  position: relative;
  height: 26px;
}

.time-slider-rail-bg,
.time-slider-rail-active {
  position: absolute;
  top: 12px;
  height: 3px;
  border-radius: 4px;
}

.time-slider-rail-bg {
  left: 0;
  right: 0;
  background: var(--border);
}

.time-slider-rail-active {
  left: 0;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.time-slider-rail input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  appearance: none;
  pointer-events: none;
}

.time-slider-rail input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--accent);
  pointer-events: auto;
  cursor: pointer;
}

/* --- MAP --------------------------------- */
.map-card { flex: 1; display: flex; flex-direction: column; }
.map-card .card-header { margin-bottom: 0; }

#map {
  flex: 1; min-height: 480px;
  border-radius: 10px; overflow: hidden;
  margin-top: 12px;
}

.map-controls { display: flex; gap: 8px; }
.map-btn {
  background: var(--surface2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-size: 11px; cursor: pointer;
  transition: all .2s;
}
.map-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }

/* --- TABLE ------------------------------- */
.table-wrap { overflow-x: auto; max-height: 240px; overflow-y: auto; }

#table-latest { width: 100%; border-collapse: collapse; font-size: 12px; }
#table-latest th {
  background: var(--surface2); color: var(--text-muted);
  padding: 8px 10px; text-align: left;
  position: sticky; top: 0;
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
}
#table-latest td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
#table-latest tr:hover td { background: var(--surface2); }

.loading-cell { text-align: center; color: var(--text-muted); padding: 20px!important; }

.badge {
  display: inline-block; border-radius: 4px;
  padding: 2px 7px; font-size: 10px; font-weight: 700;
  text-transform: uppercase;
}
.badge-high   { background: #ff444422; color: var(--danger); border: 1px solid var(--danger); }
.badge-medium { background: #ffaa0022; color: var(--warn);   border: 1px solid var(--warn); }
.badge-low    { background: #00cc8822; color: var(--ok);     border: 1px solid var(--ok); }

/* --- SCROLLBAR --------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* --- RESPONSIVE -------------------------- */
@media (max-width: 1100px) {
  .main-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   LOGIN OVERLAY
   ========================================================= */

   body.body-locked {
    overflow: hidden;
  }
  
  #login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at center, #0d1b2a 0%, #050d15 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
  }
  
  #login-overlay.hidden {
    display: none;
  }
  
  .login-box {
    background: #0f2236;
    border: 1px solid #1e4d6b;
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 0 60px rgba(0, 180, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  /* Logo reutilizando o estilo do header */
  .login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
  }
  
  .login-logo .logo-icon {
    font-size: 2rem;
  }
  
  .login-logo .logo-text {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 6px;
    color: #00b4ff;
    text-shadow: 0 0 12px rgba(0, 180, 255, 0.6);
  }
  
  .login-subtitle {
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: #5a8aa8;
    text-align: center;
    margin-bottom: 24px;
  }
  
  /* Formulário */
  #login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  
  .login-field label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: #5a8aa8;
    text-transform: uppercase;
  }
  
  .login-field input {
    background: #071622;
    border: 1px solid #1e4d6b;
    border-radius: 8px;
    color: #e0f0ff;
    padding: 12px 14px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
  }
  
  .login-field input:focus {
    border-color: #00b4ff;
    box-shadow: 0 0 8px rgba(0, 180, 255, 0.25);
  }
  
  /* Campo senha com botão toggle */
  .pass-wrap {
    position: relative;
    display: flex;
    align-items: center;
  }
  
  .pass-wrap input {
    padding-right: 44px;
  }
  
  #toggle-pass {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #5a8aa8;
    padding: 0;
    line-height: 1;
  }
  
  /* Erro */
  .login-error {
    font-size: 0.78rem;
    color: #ff4d6d;
    text-align: center;
    margin: -4px 0;
    letter-spacing: 0.5px;
  }
  
  .login-error.hidden {
    display: none;
  }
  
  /* Botão entrar */
  .btn-login {
    margin-top: 8px;
    padding: 14px;
    background: linear-gradient(90deg, #0077b6, #00b4ff);
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 3px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    width: 100%;
  }
  
  .btn-login:hover {
    opacity: 0.9;
    transform: translateY(-1px);
  }
  
  .btn-login:active {
    transform: translateY(0);
  }
  
  /* Animação shake no erro */
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px); }
    40%       { transform: translateX(8px); }
    60%       { transform: translateX(-6px); }
    80%       { transform: translateX(6px); }
  }
  
  .login-box.shake {
    animation: shake 0.45s ease;
  }
  /* --- BOTÃO LOGOUT ------------------------ */
.btn-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}