:root {
    /* Color por defecto (Rojo) */
    --color-empresa: #E60000;
}

/* MAPA FULL HEIGHT */
.map {
    flex: 1;
    position: relative;
    width: 100%; 
    height: auto; /* Deja que el contenedor decida su altura según el sidebar */
    min-height: 400px; /* Altura mínima de seguridad por si el sidebar es muy cortito */
}

.map-completo {
    position: relative;
    width: 100vw;  /* Ocupa el 100% del ancho del navegador */
    height: 100vh; /* Ocupa el 100% del alto del navegador */
}

#map {
    width: 100%;
    height: 100%;
}

/* AJUSTE GENERAL */
.content {
    display: flex;
    align-items: stretch; /* MAGIA: Fuerza al mapa a copiar la altura exacta del sidebar */
    height: auto; /* Quitamos el calc(100vh) fijo para que no crezca al infinito */
}

/* =========================================
   HEADER Y SUB-HEADER (Escritorio por defecto)
   ========================================= */
.header {
    display: flex;
    flex-direction: column;
    align-items: center; /* Centra el título principal */
    width: 100%;
}

.titulo-interrupciones {
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    color: #373B53; /* Aseguramos el color del título principal */
}

.solo-movil {
    display: none; /* Oculto en escritorio para que sea 1 sola línea */
}

.sub-header {
    display: flex;
    flex-direction: row; 
    align-items: center; 
    justify-content: flex-start; /* <--- CAMBIO: Pega los elementos a la izquierda */
    gap: 15px; /* <--- CAMBIO: Agrega una separación de 15px entre texto e ícono */
    width: 100%;
    margin-top: 20px;
}

.sub-header h3 {
    color: #373B53;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-size: 23px;
    font-style: normal;
    font-weight: 700;
    line-height: 130.4%; /* 32.6px */
    letter-spacing: -0.5px;
    margin: 0;
}

.sub-header .update {
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 6px; 
    cursor: pointer;
}

.btn-close {
    background: #ff4d4f;
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
}

/* =========================================
   VARIABLES GLOBALES (Colores y fuentes)
   ========================================= */
.sidebar {
    font-family: 'Montserrat', sans-serif;
    color: #373B53;
    width: 380px; 
    background: #ffffff;
    box-sizing: border-box;
    border: 1px solid #E5E7EB;
    margin-right: 20px;
    
    /* --- ESTO ES LO NUEVO --- */
    max-height: calc(100vh - 100px); /* Limita el alto a la pantalla */
    overflow-y: auto; /* Crea una barra de scroll interna solo para este panel */
}

/* Opcional: Personalizar la barra de scroll del sidebar para que se vea más fina y elegante */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: #D1D5DB; 
    border-radius: 10px;
}

/* =========================================
   1. LEYENDAS (Interrupciones por sector)
   ========================================= */
.legend-section {
    padding: 20px;
}

.legend-section h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
}

.legend-boxes {
    display: flex;
    gap: 10px;
}

.legend-item {
    flex: 1;
    display: flex;
    align-items: center; 
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.legend-item.blue {
    background-color: #F0F6FF;
    color: #1E5AA8;
}

.legend-item.red {
    background-color: #FCE8E8;
    color: #DE1B1B;
}

.legend-item .icon svg {
    flex-shrink: 0;
}

/* =========================================
   2. TARJETA PRINCIPAL (Card blanca)
   ========================================= */
.card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    margin: 0 20px 20px 20px; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.card .label {
    font-size: 11px;
    font-weight: 700;
    color: #373B53; 
    text-transform: uppercase;
    margin-bottom: 0; 
}

.card h3 {
    font-size: 42px;
    font-weight: 800;
    color: #373B53;
    margin-bottom: 10px;
    line-height: 1;
}

.card .status {
    display: inline-flex;
    align-items: center;
    width: fit-content; 
    color: #DE1B1B;
    border: 1px solid #DE1B1B;
    border-radius: 10px; 
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    background: #FFE7E9;
    margin-bottom: 20px;
}

.card .status svg {
    width: 17.276px;
    height: 17.5px;
    flex-shrink: 0; 
    margin-right: 6px; 
}

.card .location {
    color: #2D3548;
    font-family: Montserrat;
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
    line-height: 117%;
}

.card .location::before {
    content: url('data:image/svg+xml;utf8,<svg width="18" height="18" fill="none" stroke="%236B7280" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>');
    display: inline-block;
    position: relative;
    top: 2px;
}

/* =========================================
   3. INFO (Inicio y Afectados)
   ========================================= */
.info {
    display: flex;
    gap: 30px;
    margin-top: 25px;   
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item .icon {
    color: #8C93A1;
}

.info-item div {
    display: flex;
    flex-direction: column;
}

.info-item small {
    font-size: 11px;
    color: #8C93A1;
    text-transform: uppercase;
    font-weight: 600;
}

.info-item strong {
    font-size: 16px;
    color: #373B53;
    font-weight: 700;
}

/* =========================================
   4. SECCIÓN BUSCADOR (Gris)
   ========================================= */
.search {
    background-color: #F4F5F7; 
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 10px;
}

.titulo-consulta {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 15px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tabs button {
    flex: 1;
    padding: 8px 15px;
    border-radius: 20px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.tabs button.active {
    background-color: var(--color-empresa);
    color: white;
}

.tabs button:not(.active) {
    background-color: #ffffff;
    color: var(--color-empresa);
    border: 1px solid var(--color-empresa);
}

.tabs button:focus, 
.btn-search:focus {
    outline: none;
}

.search input {
    width: calc(100% - 100px); 
    padding: 10px 15px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    display: inline-block;
    vertical-align: middle;
}

.btn-search {
    width: 90px;
    padding: 10px;
    background-color: var(--color-empresa);
    color: white;
    border: none;
    border-radius: 20px; 
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    margin-left: 5px;
}

/* =========================================
   5. BOTÓN REPORTE FINAL Y ALERTA INLINE
   ========================================= */
.report {
    width: calc(100% - 40px);
    margin: 0 20px 20px 20px;
    padding: 12px;
    background-color: transparent;
    color: var(--color-empresa);
    border: 1px solid var(--color-empresa);
    border-radius: 25px; 
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.report:hover {
    background-color: color-mix(in srgb, var(--color-empresa) 10%, transparent); 
}

.report:focus {
    outline: none;
}

.label-container {
    display: flex;
    align-items: center;
    gap: 10px; 
    margin-bottom: 10px; 
}

.icon-reloj {
    width: 34px;
    height: 34px;
    background-color: #FFE7E9; 
    border-radius: 50%; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.inline-alert {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05); 
    text-align: center;
    display: none; 
}

.inline-alert p {
    color: #373B53;
    font-size: 13px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 15px;
    line-height: 1.4;
    font-family: Montserrat, sans-serif;
}

.inline-alert .btn-outline {
    width: 100%;
    padding: 10px;
    border: 1px solid #E60000; 
    border-radius: 25px;
    background: transparent;
    color: #E60000;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.inline-alert .btn-outline:hover {
    background-color: #FFE7E9; 
}

/* =========================================
   6. IMÁGENES DE EVIDENCIA Y MODAL
   ========================================= */
.imagenes-evidencia {
    display: flex;
    gap: 15px; 
    margin-top: 15px; 
    flex-wrap: wrap; 
}

.img-thumbnail {
    width: 80px;  
    height: 80px; 
    object-fit: cover; 
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #E5E7EB;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.img-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.modal-imagen {
    display: none; 
    position: fixed;
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85); 
    justify-content: center;
    align-items: center;
}

.galeria-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-width: 90%;
    max-height: 80vh;
}

.modal-contenido {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.flecha-galeria {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 30px;
    padding: 15px;
    cursor: pointer;
    border-radius: 50%;
    transition: 0.3s;
    margin: 0 20px;
    z-index: 10;
}



.flecha-galeria:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    
    .flecha-galeria {
        /* Reducimos el tamaño para móviles */
        padding: 8px !important; /* !important es para asegurar que sobrescriba el de arriba */
        font-size: 18px !important;
        margin: 0 5px; /* Reducimos la separación con la imagen */
        background-color: rgba(0, 0, 0, 0.7); /* Hacemos el fondo un poco más oscuro para que se vea mejor */
    }
    
    /* Y para asegurarnos de que se centren verticalmente, usaremos transform */
    .flecha-galeria.prev,
    .flecha-galeria.next {
        position: absolute;
        top: 50%; /* <--- Centrado vertical */
        transform: translateY(-50%) !important;
        z-index: 10;
        cursor: pointer;
    }
    
    /* Y nos aseguramos de que estén pegadas a los bordes */
    .flecha-galeria.prev {
        left: 5px; /* Pegada a la izquierda */
    }
    
    .flecha-galeria.next {
        right: 5px; /* Pegada a la derecha */
    }
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.cerrar-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #ffffff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.cerrar-modal:hover {
    color: var(--color-empresa, #E60000); 
}

/* =========================================
   7. DISEÑO RESPONSIVO (Tablets y Celulares)
   ========================================= */

@media (max-width: 992px) {
    
    /* --- CAMBIOS DEL HEADER PARA MÓVIL --- */
    .titulo-interrupciones {
        font-size: 20px; /* Título más pequeño */
    }

    .solo-movil {
        display: block; /* Habilita el salto de línea post "y" */
    }

    .sub-header {
        flex-direction: row; /* Texto e ícono en la misma línea */
        justify-content: center; /* Centrado en pantalla */
        margin-top: 10px;
        gap: 12px; /* Separación de 12px entre texto e ícono */
    }

    .sub-header h3 {
        text-align: center;
    }
    /* ------------------------------------- */

    .content {
        display: flex; 
        flex-direction: column;
        height: auto; 
    }

    .sidebar {
        order: 2; 
        width: 100%;
        margin-right: 0;
        margin-bottom: 20px;
        border-right: none;
        border-left: none; 
    }

    .map {
        order: 1; 
        width: 100%;
        height: 60vh; 
        flex: none; 
    }

    .legend-boxes {
        flex-direction: column; 
    }

    .card h3 {
        font-size: 32px; 
    }

    .info {
        gap: 15px; 
    }
}

@media (max-width: 480px) {
    .tabs {
        flex-direction: column; 
    }
    
    .search input {
        width: 100%; 
        margin-bottom: 10px;
    }

    .btn-search {
        width: 100%; 
        margin-left: 0;
    }
}


/* =========================================
   8. OCULTAR FLECHAS EN INPUT DE NÚMERO
   ========================================= */

/* Para Chrome, Safari, Edge, Opera */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Para Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}



/* Contenedor header de la leyenda */
.legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.legend-header h4 {
    margin-bottom: 0;  /* se quita el margin-bottom del h4 porque lo maneja el contenedor */
}

/* Botón pill de refrescar */
.btn-refrescar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #2D3548;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    margin-bottom: 10px;
    margin-left: auto;
}

.btn-refrescar:hover {
    background: #F4F5F7;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.btn-refrescar:focus {
    outline: none;
}

.btn-refrescar svg {
    flex-shrink: 0;
}
