/*
 * style.css — Estilos globales de HayLuz
 *
 * DECISIONES DE DISEÑO:
 * - Layout: body usa `height: 100dvh` (Dynamic Viewport Height) en lugar de
 *   100vh para respetar las barras del navegador en Chrome/Firefox para Android
 *   y el notch/home indicator en iOS. `min-height: -webkit-fill-available`
 *   actúa como fallback para Safari que aún no soporta dvh.
 * - #controls: `flex-shrink: 0` impide que los botones sean comprimidos por el
 *   mapa; `padding-bottom: env(safe-area-inset-bottom)` asegura que los botones
 *   no queden bajo el home indicator en iPhones con notch.
 * - #map: `min-height: 0` es obligatorio en containers flex que crecen con
 *   `flex: 1`; sin él Chrome no respeta el límite del viewport y el mapa
 *   empuja los botones fuera de pantalla.
 *
 * ACCESIBILIDAD (WCAG 2.1 AA):
 * - button:disabled usa fondo #767676 (ratio 4.54:1 contra #fff) en lugar del
 *   #ccc anterior (ratio 1.6:1, no cumplía AA). Verificado con WebAIM Contrast Checker.
 * - button:focus-visible muestra outline naranja 3px visible; se usa :focus-visible
 *   (no :focus) para que el outline solo aparezca con teclado, no con mouse.
 * - .offline-banner y .banner son anunciados por lectores de pantalla vía
 *   role="alert" + aria-live en index.html.
 *
 * PENDIENTES (ver ARQUITECTURA.md §13 — Código/Robustez):
 * - Los toasts de mostrarMensaje() en ui.js usan style.cssText inline; migrar
 *   a clases .toast, .toast--success, .toast--error definidas aquí.
 */

/* Variables CSS */
:root {
    --primary-color: #ff6b35;
    --secondary-color: #f7931e;
    --dark-bg: #1a1a1a;
    --light-bg: #ffffff;
    --text-color: #333;
    --error-color: #e74c3c;
    --success-color: #27ae60;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    height: 100dvh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
}

.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--text-color);
    border-bottom: 1px solid #ddd;
    font-size: 0.95rem;
    line-height: 1.3;
}

.banner.hidden {
    display: none;
}

.offline-banner {
    background-color: #c0392b;
    color: #ffffff;
    border-bottom: 1px solid #922b21;
    justify-content: center;
    font-weight: 600;
}

.gps-banner {
    background-color: #e67e22;
    color: #ffffff;
    border-bottom: 1px solid #d35400;
    justify-content: center;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
}

.gps-banner:hover {
    background-color: #d35400;
}

/* Modal GPS */
#gps-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.gps-modal-contenido {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.gps-modal-contenido h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.gps-modal-contenido ol {
    padding-left: 1.25rem;
    margin-bottom: 1.5rem;
    color: #444;
    line-height: 1.7;
}

.gps-modal-contenido li {
    margin-bottom: 0.4rem;
}

#gps-modal-cerrar {
    width: 100%;
    background: var(--primary-color);
    color: #ffffff;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#map {
    flex: 1;
    min-height: 0; /* Necesario para que flex funcione en Chrome */
}

#controls {
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    background-color: var(--light-bg);
    flex-shrink: 0; /* Nunca comprimirse */
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--secondary-color);
}

button:focus-visible {
    outline: 3px solid #ff6b35;
    outline-offset: 2px;
}

button:disabled {
    background-color: #767676;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.85;
}

/* Responsive */
@media (max-width: 600px) {
    #controls {
        flex-direction: column;
        gap: 0.5rem;
    }
}