/* ==========================================================
   GENERAL
   ========================================================== */

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

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

/* ==========================================================
   MENU
   ========================================================== */

#menu {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 999;
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    max-width: 330px;
    max-height: calc(100vh - 30px);
    overflow-y: auto;
}

.titulo {
    font-weight: bold;
    margin-bottom: 10px;
}

.boton-base {
    margin-right: 4px;
    margin-bottom: 5px;
    padding: 5px 8px;
    cursor: pointer;
}

/* ==========================================================
   CONTROLES
   ========================================================== */

.control-herramienta {
    margin-top: 8px;
    padding: 7px;
    background: #f5f5f5;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 12px;
}

.control-herramienta label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.control-herramienta input {
    margin: 0;
}

/* ==========================================================
   SECTORES COMPACTOS
   ========================================================== */

#submenuSectores {
    margin-top: 8px;
    padding: 6px;
    background: #f7f7f7;
    border-radius: 6px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px 6px;
}

#submenuSectores label {
    display: flex;
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 3px 2px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}

#submenuSectores input {
    margin: 0;
}

/* ==========================================================
   BOTÓN SECTORES
   ========================================================== */

#btnSectores {
    width: 100%;
    margin-top: 8px;
    padding: 6px;
    cursor: pointer;
    text-align: left;
}

/* ==========================================================
   CONTEO
   ========================================================== */

#submenuConteo {
    margin-top: 10px;
    padding: 8px;
    border-top: 1px solid #ddd;
    font-size: 12px;
}

.conteo-sector {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.conteo-sector strong {
    display: block;
    margin-bottom: 3px;
}

.conteo-total {
    font-weight: bold;
    margin-top: 3px;
}

.alta {
    color: #cc0000;
}

.media {
    color: #cc8800;
}

.baja {
    color: #008800;
}

/* ==========================================================
   ESTADO CAJA
   ========================================================== */

.estado-caja {
    margin-top: 10px;
    padding: 8px;
    background: #f3f3f3;
    border-radius: 6px;
    font-size: 12px;
}

/* ==========================================================
   SECTOR SELECCIONADO
   ========================================================== */

.sector-seleccionado {
    margin-top: 10px;
    padding: 9px;
    background: #eaf3ff;
    border: 1px solid #8ab8e8;
    border-radius: 6px;
    font-size: 13px;
}

.sector-seleccionado-titulo {
    font-weight: bold;
    margin-bottom: 4px;
}

/* ==========================================================
   LEYENDA
   ========================================================== */

.leyenda {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    font-size: 12px;
}

.leyenda-item {
    margin-bottom: 5px;
}

.leyenda-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 5px;
    vertical-align: middle;
    border: 1px solid #555;
}

/* ==========================================================
   POPUP
   ========================================================== */

.popup {
    font-size: 13px;
    line-height: 1.5;
}

.popup-titulo {
    font-weight: bold;
    margin-bottom: 8px;
}

/* ==========================================================
   ETIQUETAS ID DE CAJAS
   ========================================================== */

.caja-id-marker {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: none;
    white-space: nowrap;
    font-size: 11px;
    font-weight: bold;
    color: #111;
    background: rgba(255, 255, 255, 0.90);
    border: 1px solid rgba(0, 0, 0, 0.35);
    border-radius: 3px;
    padding: 1px 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.caja-id-marker.seleccionada {
    font-size: 12px;
    border: 2px solid #0066ff;
    z-index: 20;
}
.capas-gis {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
/* ==========================================================
   DISTANCIAS
   ========================================================== */

.distancia-marker {
    pointer-events: none;
    white-space: nowrap;
    font-size: 11px;
    font-weight: bold;
    color: #111;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #333;
    border-radius: 3px;
    padding: 2px 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* =========================================================
   PANEL LATERAL MÓVIL
   ========================================================= */

.btn-menu-movil {
    display: none;
}


/* SOLO MÓVIL */
@media (max-width: 768px) {

    #menu {
        position: fixed;
        top: 0;
        left: 0;

        width: min(85vw, 320px);
        height: 100vh;

        z-index: 2000;

        overflow-y: auto;
        overflow-x: hidden;

        transition: transform 0.3s ease;

        /* Abierto por defecto */
        transform: translateX(0);
    }


    /* PANEL OCULTO */
    #menu.menu-oculto {
        transform: translateX(-100%);
    }


    /* EL MAPA OCUPA TODA LA PANTALLA */
    #map {
        position: fixed;
        top: 0;
        left: 0;

        width: 100vw !important;
        height: 100vh !important;
    }


    /* BOTÓN FLOTANTE */
    .btn-menu-movil {
        display: flex;

        position: fixed;
        top: 12px;
        left: min(calc(85vw - 18px), 302px);

        width: 42px;
        height: 42px;

        align-items: center;
        justify-content: center;

        border: none;
        border-radius: 50%;

        background: white;
        color: #222;

        font-size: 23px;
        font-weight: bold;

        cursor: pointer;

        z-index: 2100;

        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.30);

        transition:
            left 0.3s ease,
            transform 0.3s ease;
    }


    /* BOTÓN CUANDO EL PANEL ESTÁ OCULTO */
    body.menu-movil-cerrado .btn-menu-movil {
        left: 12px;
    }
}
/* =========================================================
   UBICACIÓN GPS
   ========================================================= */

.mi-ubicacion-marker {
    width: 20px;
    height: 20px;

    background: #4285f4;

    border: 4px solid white;

    border-radius: 50%;

    box-shadow:
        0 0 0 2px #4285f4,
        0 2px 8px rgba(0, 0, 0, 0.4);
}


#btnMiUbicacion {
    width: 100%;

    padding: 10px;

    border: none;
    border-radius: 6px;

    background: #ffffff;

    cursor: pointer;

    font-weight: bold;
}


#btnMiUbicacion:active {
    transform: scale(0.98);
}