﻿/* =========================================================
   ESTRUCTURA GENERAL
   ========================================================= */

html,
body
{
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    overflow: auto;
}

#app {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.geolabvis-page
{
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.geolabvis-page > header
{
    flex-shrink: 0;
}

.geolabvis-content
{
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.geolabvis-content > main
{
    width: 100%;
    height: 100%;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

#sidebar
{
    width: 280px;
    min-width: 280px;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
    background: #101828;
    color: #f2f4f7;
    overflow-y: auto;
}

#sidebar h1
{
    font-size: 20px;
    margin: 0 0 4px 0;
}

#sidebar .subtitle
{
    font-size: 13px;
    color: #98a2b3;
    margin: 0;
}

.sidebar-header
{
    margin-bottom: 20px;
}

.sidebar-section
{
    margin-bottom: 16px;
}

.sidebar-section h2
{
    font-size: 14px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

#sidebar hr
{
    border: 0;
    border-top: 1px solid #344054;
    margin: 16px 0;
}


/* =========================================================
   BOTONES DEL SIDEBAR
   ========================================================= */

.sidebar-open,
.sidebar-close
{
    display: none;
}


/* =========================================================
   CONTROLES
   ========================================================= */

.filtro
{
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    cursor: pointer;
}

.filtro input
{
    accent-color: #6366f1;
}

.opacity-value
{
    margin-top: 4px;
    text-align: right;
    color: #98a2b3;
    font-size: 12px;
}

.opacity-grid
{
    display: grid;
    /* Nombre | Slider | Valor */
    grid-template-columns: 55px 1fr 30px;
    column-gap: 8px;
    row-gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.opacity-grid label
{
    margin: 0;
}

.opacity-grid input[type="range"]
{
    width: 100%;
    min-width: 0;
}

.opacity-grid span
{
    text-align: right;
}


/* =========================================================
   LUGARES DE INTERÉS
   ========================================================= */

.lugar-interes
{
    display: block;
    width: 100%;
    margin-bottom: 6px;
    padding: 7px 10px;
    border: 1px solid #344054;
    border-radius: 5px;
    background: #1d2939;
    color: #f2f4f7;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
}

.lugar-interes:hover
{
    background: #344054;
}


/* =========================================================
   MAPA
   ========================================================= */

#map
{
    flex: 1;
    height: 100%;
    min-width: 0;
}


/* =========================================================
   LOGOTIPO DEL MAPA
   ========================================================= */

.map-logo
{
    padding: 5px;
}

.map-logo img
{
    display: block;
}


/* =========================================================
   LEYENDA DEM
   ========================================================= */

.legend
{
    background: white;
    padding: 10px;
    line-height: 20px;
    border-radius: 5px;
    box-shadow: 0 0 8px rgba(0,0,0,0.3);
}

.legend i
{
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.8;
}


/* =========================================================
   LEYENDA NETCDF
   ========================================================= */

.netcdf-legend
{
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 8px;
    border-radius: 5px;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
    font-family: Arial, sans-serif;
    font-size: 12px;
    box-sizing: border-box;
    width: calc(100vw - 480px);
    max-width: none;
}

.legend-title
{
    max-width: none;
    white-space: nowrap;
    line-height: 1.2;
    margin-bottom: 5px;
    font-weight: bold;
    text-align: center;
}

.legend-scale
{
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    width: 100%;
}

.legend-scale span
{
    white-space: nowrap;
}

.legend-gradient
{
    flex: 1;
    height: 18px;
    border: 1px solid #777;
}


/* =========================================================
   NOTIFICACIONES
   ========================================================= */

.notificacion
{
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 280px;
    max-width: 400px;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.notificacion.visible
{
    opacity: 1;
    transform: translateY(0);
}

.notificacion.error
{
    background-color: #dc2626;
}

.notificacion.exito
{
    background-color: #16a34a;
}

.notificacion.info
{
    background-color: #2563eb;
}


/* =========================================================
   POPUP SWAT
   ========================================================= */

.popup-swat
{
    width: 100%;
    max-width: 390px;
    box-sizing: border-box;
}

.popup-swat-titulo
{
    margin-bottom: 7px;
    font-size: 16px;
    font-weight: 600;
}

.popup-swat-info
{
    font-size: 13px;
    line-height: 1.45;
}

.popup-swat hr
{
    margin: 8px 0;
}

.popup-swat-controles
{
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.popup-swat-controles label
{
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}

.popup-swat-controles select
{
    width: 100%;
    padding: 5px 6px;
    box-sizing: border-box;
    font-size: 12px;
}

.popup-swat-serie
{
    margin-top: 10px;
}

.popup-swat-serie-titulo
{
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
}

.popup-swat-valores
{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 16px;
    font-size: 11px;
}

.popup-swat-valores span
{
    font-weight: 600;
}

.popup-swat-valores strong
{
    color: #2563eb;
    font-weight: 700;
}

.popup-swat-valores div
{
    display: flex;
    justify-content: flex-start;
    gap: 5px;
}

.popup-swat-grafica
{
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.popup-swat-grafica-titulo
{
    margin-top: 16px;
}

.popup-swat-cambio
{
    margin-top: 12px;
}

.popup-swat-cambio label
{
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    cursor: pointer;
}

.grafica-swat
{
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* =========================================================
   RESPONSIVE - TELÉFONOS Y TABLETS
   ========================================================= */

@media (max-width: 768px)
{

    /* =====================================================
       MAPA
       ===================================================== */

    #map
    {
        width: 100%;
        height: 100%;
    }


    /* =====================================================
       LEYENDA DEM
       ===================================================== */

    .legend
    {
        width: auto;
        max-width: none;
        padding: 5px 7px;
        font-size: 10px;
        line-height: 15px;
        box-sizing: border-box;
        white-space: nowrap;
    }

    .legend i
    {
        width: 13px;
        height: 13px;
        margin-right: 5px;
        float: left;
    }

    /* =====================================================
   NOTIFICACIONES
   ===================================================== */

    .notificacion
    {
        top: 10px;
        left: 10px;
        right: 10px;
        min-width: 0;
        max-width: none;
        width: auto;
        box-sizing: border-box;
        font-size: 13px;
    }


    /* =====================================================
       LEYENDA NETCDF
       ===================================================== */

    .netcdf-legend
    {
        width: calc(100vw - 110px);
        max-width: none;
        margin: 0;
        font-size: 10px;
        padding: 4px 5px;
    }

    .leaflet-bottom
    {
        bottom: 0 !important;
    }

    .leaflet-bottom .legend
    {
        margin-bottom: 40px !important;
    }

    .leaflet-bottom .netcdf-legend
    {
        margin-bottom: 55px !important;
    }


    .legend-gradient
    {
        flex: 1;
        min-width: 30px;
        height: 12px;
    }

    .legend-scale
    {
        display: flex;
        width: 100%;
        gap: 4px;
    }

    .legend-scale span
    {
        flex: 0 0 auto;
    }


    /* =====================================================
       CONTROLES LEAFLET
       ===================================================== */

    .leaflet-control-layers-expanded
    {
        max-width: 150px;
    }

    .leaflet-popup-content
    {
        max-width: calc(100vw - 50px);
    }

    /* =====================================================
       LOGOTIPO
       ===================================================== */

    .map-logo img
    {
        max-width: 55px;
    }


    /* =====================================================
       SIDEBAR
       ===================================================== */

    #sidebar
    {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        min-width: 0;
        height: 100%;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    #sidebar.abierto
    {
        transform: translateX(0);
    }

    .sidebar-open
    {
        display: block;
        position: absolute;
        top: 110px;
        left: 10px;
        z-index: 1500;
        width: 40px;
        height: 40px;
        padding: 0;
        border: none;
        border-radius: 5px;
        background: #101828;
        color: white;
        font-size: 24px;
        line-height: 40px;
        cursor: pointer;
    }

    .sidebar-close
    {
        display: block;
        position: absolute;
        top: 8px;
        right: 12px;
        width: 36px;
        height: 36px;
        padding: 0;
        border: none;
        background: transparent;
        color: white;
        font-size: 30px;
        line-height: 32px;
        cursor: pointer;
    }


    /* =====================================================
       POPUP SWAT
       ===================================================== */

    .popup-swat
    {
        max-width: 255px;
    }

    .popup-swat-titulo
    {
        font-size: 17px;
    }

    .popup-swat-info
    {
        font-size: 13px;
        line-height: 1.4;
    }

    .popup-swat-controles
    {
        gap: 4px;
    }

    .popup-swat-controles label
    {
        font-size: 13px;
    }

    .popup-swat-controles select
    {
        padding: 4px 5px;
        font-size: 13px;
    }

    .popup-swat-valores
    {
        grid-template-columns: repeat(2, 1fr);
        font-size: 12px;
    }

    .popup-swat-grafica
    {
        width: 100%;
        max-width: 100%;
    }

    .grafica-swat
    {
        width: 100%;
        max-width: 100%;
    }
}

/* =========================================================
   RESPONSIVE - TABLETS EN VERTICAL
   ========================================================= */

@media (min-width: 600px) and (max-width: 768px) and (orientation: portrait)
{
    .leaflet-bottom .netcdf-legend
    {
        margin-bottom: 95px !important;
    }

    .leaflet-bottom .legend
    {
        margin-bottom: 80px !important;
    }
}

/* =========================================================
   RESPONSIVE - TABLETS
   ========================================================= */

@media (min-width: 769px) and (max-width: 1100px)
{
    .leaflet-bottom .legend
    {
        margin-bottom: 83px !important;
    }

    .leaflet-bottom .netcdf-legend
    {
        margin-bottom: 100px !important;
    }

    .netcdf-legend
    {
        width: calc(100vw - 420px);
    }
}

