/* RotaSaúde — style.css v1 */

:root,
[data-theme="corporate"] {
  --color-primary: oklch(22% 0.18 263);
  --color-primary-content: oklch(99% 0 0);
  --color-primary-focus: oklch(18% 0.18 263);
}

[x-cloak] { display: none !important; }

body { font-family: 'Inter', system-ui, sans-serif; }

html { overflow-x: clip; max-width: 100vw; }

.drawer-content { overflow-x: clip; }

#main-content { scroll-margin-top: 3.25rem; }
@media (min-width: 1024px) {
  #main-content { scroll-margin-top: 3rem; }
}

.drawer-side { scrollbar-width: none; }
.drawer-side::-webkit-scrollbar { display: none; }
.drawer-side > aside { min-height: 100% !important; }

.scrollbar-none { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }

/* Sidebar */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  color: rgb(148 163 184);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.sidebar-link:hover  { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,0.15); color: #fff; }
.sidebar-link .icon  { width: 1.125rem; text-align: center; font-size: 0.875rem; flex-shrink: 0; }

/* Cards */
.stat-card { border-radius: 1rem; padding: 1.25rem; color: white; }

/* HTMX loading bar */
#htmx-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9998;
  height: 2px; background: #FFDA00;
  transform-origin: left; transform: scaleX(0);
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
#htmx-bar.running { opacity: 1; animation: htmx-bar-run 1.6s ease-in-out infinite; }
#htmx-bar.done    { transform: scaleX(1) !important; animation: none; opacity: 0; transition: opacity 0.35s; }
@keyframes htmx-bar-run {
  0%   { transform: scaleX(0);    }
  60%  { transform: scaleX(0.72); }
  100% { transform: scaleX(0.9);  }
}

/* Map container */
#map {
  width: 100%;
  height: calc(100vh - 3.25rem);
  z-index: 1;
}
@media (min-width: 1024px) {
  #map { height: calc(100vh - 3rem); }
}

/* Vehicle popup Leaflet */
.veiculo-popup .leaflet-popup-content-wrapper {
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  min-width: 240px;
}
.veiculo-popup .leaflet-popup-content { margin: 0; }

/* Pulsing marker for moving vehicles */
@keyframes marker-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50%       { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
}
.marker-moving { animation: marker-pulse 1.5s ease-in-out infinite; }

/* Card animation */
main .card { animation: card-appear 0.22s ease-out both; }
@keyframes card-appear {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* Scrollbar */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.5); border-radius: 4px; }

/* Buttons */
.btn-primary, .btn-primary *, .btn-primary:hover { color: #ffffff !important; }
.alert-error, .alert-error * { color: #ffffff !important; }

/* Toast */
.toast .alert { max-width: min(480px, 92vw) !important; }

/* View transitions */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }
::view-transition-old(root) { z-index: 1; }

/* Curtain login */
@keyframes hpulse {
  0%  { transform: scale(1);    }
  14% { transform: scale(1.15); }
  28% { transform: scale(1.06); }
  42% { transform: scale(1.12); }
  70% { transform: scale(1);    }
  100%{ transform: scale(1);    }
}
.curtain-heart-bg {
  position: absolute; inset: 0;
  background: url('/assets/FundoAnimado.png') no-repeat center center;
  background-size: cover; opacity: .7;
  pointer-events: none; transform-origin: center center;
  animation: hpulse 2s ease-out infinite;
}
.curtain-label {
  position: relative; z-index: 1;
  color: #FFDA00; font-family: 'Inter', sans-serif;
  font-size: 1.15rem; font-weight: 700;
  letter-spacing: 0.1em; text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* Status ignição inline */
.dot-on  { display:inline-block;width:8px;height:8px;border-radius:50%;background:#22c55e;margin-right:4px; }
.dot-off { display:inline-block;width:8px;height:8px;border-radius:50%;background:#94a3b8;margin-right:4px; }

/* Print */
@media print {
  .drawer-side, nav, .no-print, .topbar { display: none !important; }
  main { padding: 0 !important; }
}

/* Espera em blocos que nao podem perder o conteudo (cards de viagem no painel de veiculos) */
.loader-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit; color: #fff;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px);
}

/* O Leaflet aplica z-index de ate 1000 nos proprios paineis e controles. Sem isolar,
   esses valores concorrem no mesmo contexto do menu lateral (z-40) e o mapa cobria o
   menu aberto no celular, em acompanhar.php e no mapa ao vivo. Isolando, os z-index
   internos do Leaflet valem so dentro do mapa. */
.leaflet-container { isolation: isolate; }

/* ────────────────────────────────────────────────────────────────
   CORTINA DE CARREGAMENTO DOS MAPAS
   Mesmo coracao pulsante da entrada no sistema. Fica sobre o mapa ate
   veiculos, viagens e trajetos estarem desenhados — antes disso a tela
   aparecia vazia e ia se preenchendo aos pedacos.
   ──────────────────────────────────────────────────────────────── */
.mapa-cortina {
  position: absolute; inset: 0; z-index: 1200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(1, 33, 134, 0.94);
  overflow: hidden;
  transition: opacity .55s ease-out;
}
.mapa-cortina .curtain-heart-bg { opacity: .55; }
.mapa-cortina-txt {
  position: relative; z-index: 1; text-align: center; padding: 0 24px;
}
.mapa-cortina-titulo {
  color: #FFDA00; font-family: 'Inter', sans-serif;
  font-size: 1.05rem; font-weight: 700; letter-spacing: .08em;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.mapa-cortina-sub {
  color: rgba(255,255,255,.8); font-family: 'Inter', sans-serif;
  font-size: .78rem; font-weight: 500; margin-top: 6px;
}
.mapa-cortina-passos {
  margin-top: 16px; display: inline-flex; flex-direction: column;
  gap: 7px; text-align: left;
}
.mapa-cortina-passo {
  display: flex; align-items: center; gap: 9px;
  color: rgba(255,255,255,.55); font-size: .72rem; font-weight: 500;
  transition: color .3s ease;
}
.mapa-cortina-passo.feito { color: #86efac; }
.mapa-cortina-passo .ic {
  width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12); font-size: .55rem; flex-shrink: 0;
}
.mapa-cortina-passo.feito .ic { background: rgba(134,239,172,.22); }
