/* =========================================
   1. RESET Y ESTRUCTURA BASE (LAYOUT)
   ========================================= */
:root {
    --primary-color: #321e88;
    --drawer-width: 260px;
    --header-height: 60px;
    --footer-height: 35px;
    --bg-light: #f4f4f4;
}

* {
    box-sizing: border-box;
}

/* Estilo discreto e integrado para el aviso */
.guia-instalacion-pwa {
  background-color: #f8f9fa;
  border-left: 4px solid #0d6efd; /* Un toque de color para destacar suavemente */
  padding: 12px 16px;
  margin: 15px 0;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #495057;
}

.guia-instalacion-pwa p {
  margin: 0 0 6px 0;
  font-weight: 600;
}

.guia-instalacion-pwa ul {
  margin: 0;
  padding-left: 18px;
}

.guia-instalacion-pwa li {
  margin-bottom: 4px;
}

/* ===================================================
   Ocultar AUTOMÁTICAMENTE cuando la PWA esté instalada
   =================================================== */
@media (display-mode: standalone) {
  .guia-instalacion-pwa {
    display: none !important;
  }
}




/* El círculo que gira */
.loader {
  width: 20px;
  height: 20px;
  border: 3px solid #FFF;
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Estado deshabilitado del botón */
.btn-loading {
  opacity: 0.8;
  cursor: not-allowed;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

/* Layout Principal */
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  font-family: system-ui, -apple-system, sans-serif;
}

/* =========================================
   6. FOOTER FIJO
   ========================================= */
#main-footer {
  position: fixed;
  bottom: 0;
    background-color: #fff;
    border-top: 1px solid #ddd;
    height: var(--footer-height);
    display: flex;
    align-items: center;
    padding: 0 15px;
    font-size: 0.75rem;
    color: #666;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    width: 100%;
}


/* =========================================
   2. CABECERA (HEADER)
   ========================================= */
#main-header {
    background: var(--primary-color);
    color: white;
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 15px;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#header-main-nav, #header-back-nav {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
}

#header-title, #header-subtitle {
    font-size: 1.2rem;
    font-weight: bold;
    flex-grow: 1;
    margin-left: 15px;
}

#app-content {
  flex: 1;
  overflow-y: auto;
  /* Espacio en el fondo para que el contenido no quede tapado por la Tab Bar */
  padding-bottom: calc(65px + env(safe-area-inset-bottom));
}

.page {
  display: none;
  padding: 16px;
}
.page.active {
  display: block;
}

/* Tab Bar Inferior */
.bottom-nav {
  position: fixed;
  bottom: var(--footer-height);
  left: 0;
  right: 0;
  height: 60px;
  background-color: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  /* Soporte para el notch/barra inferior de iOS y Android */
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-item {
  background: none;
  border: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  padding: 6px 0;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.1s ease;
}

.nav-item:active {
  transform: scale(0.95);
}

.nav-item [data-lucide] {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
}

.nav-label {
  font-size: 0.72rem;
  font-weight: 500;
}

/* Estado Activo en la Tab Bar */
.nav-item.active {
  color: #2563eb; /* Color corporativo/primario */
}

.nav-item.active .nav-label {
  font-weight: 700;
}

/* =========================================
   3. MENÚ LATERAL (DRAWER) MEJORADO
   ========================================= */
#side-menu {
    position: fixed;
    left: calc(-1 * var(--drawer-width));
    top: 60px;
    width: var(--drawer-width);
    height: calc(100% - 60px);
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
    z-index: 100;
}

#side-menu.open {
    transform: translateX(var(--drawer-width));
}

/* BANNER SUPERIOR DEL MENÚ */
.menu-banner {
    width: 100%;
    height: 110px;
    /*background-image: url('./iconos/xfondoimagenheader.png');*/
    /* Opcional: para que se ajuste bien al rectángulo de 500x350 */
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 15px;
}

.menu-user-info {
    color: white;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.menu-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid white;
}

/* LISTA DE OPCIONES */
#side-menu ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

#side-menu li {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
}

#side-menu li:active {
    background-color: #f0f0f0;
}

/* ICONOS */
.icon {
    margin-right: 15px;
    font-size: 1.2rem;
    width: 24px; /* Ancho fijo para que el texto esté alineado */
    text-align: center;
}
.lucide {
    margin-right: 15px;
    font-size: 1.2rem;
    width: 24px; /* Ancho fijo para que el texto esté alineado */
    text-align: center;
}
/* DIVISOR MANUAL */
.menu-divider {
    border: 0;
    height: 1px;
    background: #e0e0e0;
    margin: 10px 0;
}

#overlay {
    display: none; /* Se activa por JS */
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100% - 60px);
    background: rgba(0,0,0,0.3); /* Un gris muy suave para dar profundidad */
    z-index: 90; /* Por debajo del menú (100) pero sobre el contenido */
    cursor: pointer;
}

/* El círculo que gira */
.loader {
  width: 20px;
  height: 20px;
  border: 3px solid #FFF;
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: rotation 1s linear infinite;
}

.btn-azul {
  padding: 12px; background-color: var(--primary-color); color: white; border: none; border-radius: 4px; font-weight: bold; cursor: pointer;
}

/*=========================================
   4. CARD PENDIENTES DE AUTORIZACIÓN
   ========================================= */
/* Contenedor principal de la lista */
#pendientes_autorizar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
  width: 100%;
}

/* Tarjeta de usuario */
.card-pendiente {
  background-color: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Datos del usuario (Email y Fecha) */
.card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary, #0f172a);
}

.user-email {
  word-break: break-all; /* Evita que emails largos rompan el layout */
}

.card-dato {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}

/* Cards de las estaciones del usuario */
.card-date {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.card-date span {
  font-size: 0.95rem;
  color: #1e293b;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Botón de papelera */
.btn-trash {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 8px;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.btn-trash:active {
  background-color: #fee2e2;
}

/* Botón de preferida (star) */
.btn-star {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 8px;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}



/* Buscador de estaciones */
.seccion-agregar-estacion {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
}

.input-search {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
}

.input-search:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Resultados del buscador */
.resultados-lista {
  margin-top: 8px;
  max-height: 250px;
  overflow-y: auto;
  border-radius: 8px;
}

.item-resultado {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  background-color: #fff;
}

.item-resultado:last-child {
  border-bottom: none;
}

.btn-add {
  background-color: #0284c7;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-add:active {
  background-color: #0369a1;
}



/* Iconos pequeños informativos */
.icon-mail, .icon-clock {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 2;
  color: #64748b;
}

/* Botones de acción */
.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light, #f1f5f9);
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px; /* Tamaño mínimo recomendado para interacción táctil */
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn-action:active {
  transform: scale(0.98);
}

.btn-action i {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* Variantes de color */
.btn-autorizar {
  background-color: #10b981; /* Esmeralda / Verde */
  color: #ffffff;
}

.btn-autorizar:active {
  background-color: #059669;
}

.btn-eliminar {
  background-color: #ef4444; /* Rojo */
  color: #ffffff;
}

.btn-eliminar:active {
  background-color: #dc2626;
}

/* Estado sin pendientes */
.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted, #64748b);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-icon {
  width: 44px;
  height: 44px;
  opacity: 0.4;
  stroke-width: 1.5;
}    

.map-link {
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
}

.graficoCanvas {
  position: relative; 
  width: 100%;
  height: 250px;
  margin-bottom: 20px;
}

/* Contenedor del selector */
.control-estaciones {
  margin: 10px 0;
}

.select-estacion-input {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #fff;
  color: #333;
  appearance: auto; /* Mantiene la flecha nativa móvil */
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Ficha descriptiva de la estación seleccionada */
.ficha-estacion {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 15px;
}

.ficha-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ficha-nombre {
  font-weight: bold;
  font-size: 1.1rem;
  color: #1a252f;
  margin: 0;
}

.ficha-provincia {
  font-size: 0.85rem;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  font-weight: 600;
}

.ficha-ubicacion {
  margin-top: 8px;
  font-size: 0.9rem;
}

.link-mapa {
  color: #0284c7;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.link-mapa:active {
  opacity: 0.7;
}

/* Caja de precipitación ajustada a la derecha */
#precipitacion_12_24 {
  font-size: 0.85em;
  font-style: italic;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  width: fit-content;
  margin-left: auto;
  margin-top: 5px;
  margin-bottom: 15px;
  background-color: #fafafa;
}





.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5px;
    min-height: 50px;
}

.config-row.clickable:active {
    background-color: rgba(0,0,0,0.05);
}

.config-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.config-label i {
    width: 20px;
    height: 20px;
    color: #555;
}
.config-label i {
    flex-shrink: 0; /* Evita que el icono se aplaste si el texto es largo */
}

.config-text {
    display: flex;
    flex-direction: column; /* Esto fuerza el salto de línea interno */
    line-height: 1.2;       /* Ajusta el espacio entre líneas */
}

.config-text small {
    font-size: 0.8rem;
    color: #888;           /* Un tono más suave para la nota */
    margin-top: 2px;
}

.text-danger {
    color: #d9534f;
}

.text-danger i {
    color: #d9534f;
}


/* El contenedor del switch */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

/* Ocultar el checkbox original */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* El slider (fondo) */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

/* Color cuando está activo (ajusta a tu color principal) */
input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

/* Movimiento del círculo */
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Redondear bordes */
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

