/* ══════════════════════════════════════════════════════════════
   TEMA COMPARTIDO — SIG Provincial Santa Fe
   Mismos tokens que el SIG de la capital y el de Rincón, para que
   las tres aplicaciones se lean como un solo sistema.
══════════════════════════════════════════════════════════════ */

:root {
  --violet-950: #1a0a2e;
  --violet-900: #2d1354;
  --violet-800: #3d1a72;
  --violet-700: #5b21b6;
  --violet-500: #8b5cf6;
  --violet-300: #c4b5fd;
  --violet-100: #ede9fe;
  --gold: #f59e0b;
  --red: #ef4444;
  --yellow: #eab308;
  --green: #22c55e;
  --blue: #3b82f6;
  --white: #ffffff;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-600: #4b5563;
  --panel-w: 340px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { max-width: 100vw; overflow-x: hidden; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--violet-950);
  color: var(--white);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Encabezado ──────────────────────────────────────────────── */

header {
  background: linear-gradient(135deg, var(--violet-950) 0%, var(--violet-900) 100%);
  border-bottom: 1px solid rgba(139, 92, 246, 0.3);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
  z-index: 1000;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--violet-700), var(--violet-500));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.logo-text h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px; letter-spacing: 2px; line-height: 1;
}
.logo-text p {
  font-size: 10px; color: var(--violet-300);
  letter-spacing: 1px; text-transform: uppercase;
}
.logo-text .marca { color: var(--gold); font-size: 9px; letter-spacing: 1px; }

.header-sep {
  width: 1px; height: 32px;
  background: rgba(139, 92, 246, 0.3);
  flex-shrink: 0;
}

.header-derecha { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.btn-header {
  background: transparent;
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: var(--violet-300);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn-header:hover { background: rgba(139, 92, 246, 0.18); color: var(--white); }
.btn-header.primario {
  background: linear-gradient(135deg, var(--violet-700), var(--violet-500));
  border-color: transparent; color: var(--white);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}
.btn-header.fantasma { border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.btn-header.fantasma:hover { background: rgba(239, 68, 68, 0.15); color: #fff; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-700), var(--violet-500));
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; flex-shrink: 0;
}

/* ── Mapa ────────────────────────────────────────────────────── */

.contenedor-mapa { flex: 1; position: relative; min-height: 0; }
#mapa { position: absolute; inset: 0; background: var(--violet-950); }

/* Base OSM oscurecida por CSS: no requiere clave de API */
.leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(.78) contrast(1.05) saturate(.45);
}
.leaflet-container { background: #0d0520; font-family: 'DM Sans', sans-serif; }
.leaflet-control-attribution {
  background: rgba(26, 10, 46, 0.8) !important;
  color: rgba(196, 181, 253, 0.6) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--violet-300) !important; }
.leaflet-bar a {
  background: rgba(26, 10, 46, 0.92) !important;
  color: var(--violet-100) !important;
  border-color: rgba(139, 92, 246, 0.3) !important;
}
.leaflet-bar a:hover { background: rgba(61, 26, 114, 0.95) !important; }

.etiqueta-mapa {
  background: none; border: none; box-shadow: none;
  font-family: 'Bebas Neue', sans-serif;
  color: var(--white);
  letter-spacing: 1px; text-transform: uppercase;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .9));
  white-space: nowrap; pointer-events: none;
}


/* El control de zoom vive abajo a la derecha; se lo separa de la barra
   de estado y de la atribucion. */
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin-bottom: 26px; margin-right: 12px; }

/* ── Superficies de vidrio ───────────────────────────────────── */

.vidrio {
  background: rgba(26, 10, 46, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 14px;
}

.titulo-seccion {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px; letter-spacing: 1.5px;
  color: var(--violet-300);
  text-transform: uppercase;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--violet-300);
  white-space: nowrap;
}
.chip.oficial { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.35); color: #86efac; }
.chip.osm     { background: rgba(59, 130, 246, 0.14); border-color: rgba(59, 130, 246, 0.35); color: #93c5fd; }
.chip.aprox   { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.35); color: #fcd34d; }
.chip.sindato { background: rgba(107, 114, 128, 0.18); border-color: rgba(107, 114, 128, 0.4); color: #d1d5db; }

/* ── Login ───────────────────────────────────────────────────── */

.capa-login {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(13, 5, 32, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.capa-login.oculto { display: none; }

.tarjeta-login {
  background: rgba(45, 19, 84, 0.86);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 20px;
  padding: 40px 38px;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(139, 92, 246, 0.1);
  position: relative; overflow: hidden;
  animation: aparecer .22s ease-out;
}
.tarjeta-login::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
  pointer-events: none;
}
@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.login-cabecera { text-align: center; margin-bottom: 26px; }
.login-cabecera .icono {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--violet-700), var(--violet-500));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.4);
  font-size: 26px;
}
.login-cabecera h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px; letter-spacing: 2px; color: #fff; line-height: 1.05;
}
.login-cabecera p {
  font-size: 11px; color: var(--violet-300);
  text-transform: uppercase; letter-spacing: 1px; margin-top: 4px;
}
.login-cabecera .marca { color: var(--gold); font-size: 10px; letter-spacing: 1px; margin-top: 2px; }

.campo { margin-bottom: 16px; }
.campo label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--violet-300); text-transform: uppercase; letter-spacing: .8px;
  margin-bottom: 8px;
}
.campo input, .campo select {
  width: 100%; padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  color: #fff; font-family: 'DM Sans', sans-serif; font-size: 14px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.campo input:focus, .campo select:focus {
  border-color: var(--violet-500);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.campo input::placeholder { color: rgba(196, 181, 253, 0.35); }

.btn-principal {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--violet-700), var(--violet-500));
  border: none; border-radius: 10px;
  color: #fff; font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 600; letter-spacing: .5px;
  cursor: pointer; margin-top: 6px;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}
.btn-principal:hover { opacity: .9; }
.btn-principal:active { transform: scale(.98); }
.btn-principal:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-secundario {
  width: 100%; padding: 11px; margin-top: 10px;
  background: transparent;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 10px;
  color: var(--violet-300);
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .2s, color .2s;
}
.btn-secundario:hover { background: rgba(139, 92, 246, 0.15); color: #fff; }

.aviso-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px; padding: 10px 14px;
  color: #fca5a5; font-size: 13px; text-align: center;
  margin-top: 14px; display: none;
}
.aviso-error.visible { display: block; }

.aviso-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 8px; padding: 10px 14px;
  color: #bfdbfe; font-size: 12px; line-height: 1.5;
  margin-top: 14px;
}

.pie-login {
  text-align: center; margin-top: 20px;
  font-size: 11px; color: rgba(196, 181, 253, 0.35); line-height: 1.6;
}

/* ── Barra de carga ──────────────────────────────────────────── */

.cargando {
  position: fixed; inset: 0; z-index: 10000;
  background: linear-gradient(135deg, #0d0520 0%, var(--violet-950) 50%, #0d0520 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
}
.cargando.oculto { display: none; }
.cargando .marca-carga {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px; letter-spacing: 3px; color: var(--violet-300);
}
.cargando .detalle { font-size: 12px; color: rgba(196, 181, 253, 0.5); }
.barra-progreso {
  width: 220px; height: 3px; border-radius: 2px;
  background: rgba(139, 92, 246, 0.2); overflow: hidden;
}
.barra-progreso i {
  display: block; height: 100%; width: 35%;
  background: linear-gradient(90deg, transparent, var(--violet-500), transparent);
  animation: correr 1.1s linear infinite;
}
@keyframes correr { from { transform: translateX(-100%); } to { transform: translateX(330%); } }

/* ── Barra inferior de estado ────────────────────────────────── */

.barra-estado {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(26, 10, 46, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 999px;
  padding: 8px 20px;
  display: flex; align-items: center; gap: 18px;
  font-size: 12px; color: var(--violet-300);
  z-index: 500; white-space: nowrap;
  max-width: calc(100vw - 32px); overflow-x: auto;
}
.barra-estado b { color: #fff; font-weight: 600; }

/* Cuando el panel lateral esta desplegado, la barra de estado se
   centra en el espacio que queda, no en la pantalla entera. */
.lateral:not(.plegado) ~ .barra-estado {
  left: calc(50% + (var(--panel-w) / 2) + 7px);
}

@media (max-width: 720px) {
  header { padding: 0 14px; gap: 10px; height: 56px; }
  .logo-text h1 { font-size: 17px; }
  .logo-text p { font-size: 9px; }
  .header-sep { display: none; }
  .btn-header { padding: 7px 12px; font-size: 12px; }
  .barra-estado,
  .lateral:not(.plegado) ~ .barra-estado {
    font-size: 11px; gap: 12px; padding: 7px 14px;
    bottom: calc(12px + var(--sab)); left: 50%;
  }
  .tarjeta-login { padding: 32px 24px; }
}
