@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

body {
    display: flex;
    flex-direction: column;
}

/* NAVBAR */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    z-index: 1200;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 22px;
}

.wwf-logo { height: 44px; }
.CACAO { height: 38px; margin-left: 8px; }

.btn-icon {
    width: auto;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    object-fit: contain;
}

.title-group {
    display: flex;
    flex-direction: column;
}

.main-title {
    font-size: 18px;
    font-weight: 700;
    color: #1B4332;
}

.sub-title {
    font-size: 13px;
    font-weight: 500;
    color: #2D6A4F;
}

.tools-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.select-principal, .select-secundario {
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.select-principal:focus, .select-secundario:focus {
    outline: none;
    border-color: #2D6A4F;
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.12);
}

#coords {
    font-size: 12px;
    color: #555;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(0,0,0,0.05);
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.dropdown { position: relative; }

.dropbtn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.dropbtn:hover {
    background: #f3f3f3;
    transform: translateY(-1px);
}

/* CONTENEDOR PARA ACOMODAR EL MAPA Y LAS COSAS FLOTANTES */
.app-container {
    position: relative;
    width: 100%;
    flex-grow: 1; /* Rellena todo el espacio abajo de la barra */
    height: calc(100vh - 64px);
}

/* MAPA */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* SIDEBAR DE HERRAMIENTAS (MENÚ FLOTANTE) */
#sidebar {
    position: absolute;
    top: 15px;
    left: 18px;
    width: 270px;
    display: none; /* Controlado dinámicamente con la clase .show */
    flex-direction: column;
    z-index: 1100;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    border-radius: 22px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border: 1px solid rgba(255,255,255,0.4);
    gap: 18px;
}

#sidebar.show {
    display: flex;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: #1B4332;
}

.tool-btn {
    height: 40px;
    border: none;
    border-radius: 14px;
    background: rgba(45, 106, 79, 0.06);
    color: #1B4332;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    padding: 0 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.tool-btn:hover {
    background: rgba(45, 106, 79, 0.14);
    transform: translateY(-1px);
}

.tool-btn.active {
    background: #2D6A4F;
    color: white;
}

/* PANEL LATERAL DE MUESTRA DE DATOS */
#panel-lateral {
    position: absolute;
    top: 15px;
    right: 18px; /* Cambiado a RIGHT para que no tape el menú de herramientas */
    width: 340px;
    display: none;
    flex-direction: column;
    z-index: 1050;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.14);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    background: #1B4332;
    color: white;
}

.panel-header h3 {
    margin: 0;
    font-size: 15px;
    color: #ffffff;
}

.panel-header button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 18px;
    cursor: pointer;
}

#panel-contenido {
    padding: 18px;
    max-height: 65vh;
    overflow-y: auto;
    font-size: 14px;
    color: #444;
    line-height: 1.5;
}

/* ESTILOS DE LEAFLET ADAPTADOS A TU TEMA VERDE */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12) !important;
}

.leaflet-control-zoom a {
    background: rgba(255, 255, 255, 0.92) !important;
    color: #1B4332 !important;
    border: none !important;
}

/* LEYENDA DINÁMICA */

#legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1200;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-radius: 18px;
    padding: 14px;
    min-width: 190px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.08);
    font-family: 'Inter', sans-serif;
    Display: none; /* Controlado dinámicamente con JavaScript */
}

.legend-title {
    font-size: 14px;
    font-weight: 700;
    color: #1B4332;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #333;
}

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.2);
}

.legend-line {
    width: 22px;
    height: 4px;
    border-radius: 10px;
}

.legend-point {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}