/* ============================================
   POI (Puntos de Interes) - Barra Vertical
   ============================================ */

/* Sidebar contenedor */
.poi-sidebar {
    background: rgba(20, 20, 35, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    font-family: 'Segoe UI', system-ui, sans-serif;
    overflow: hidden;
    min-width: 160px;
}

/* Header */
.poi-sidebar-header {
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(240, 116, 0, 0.15), rgba(0, 180, 255, 0.08));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    font-weight: 700;
    color: #F07400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center;
}

/* Lista de categorias */
.poi-sidebar-categories {
    padding: 4px 0;
}

/* Fila de categoria */
.poi-sidebar-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.poi-sidebar-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.poi-sidebar-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #F07400;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

/* Icono en el sidebar */
.poi-sidebar-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poi-sidebar-icon svg {
    display: block;
}

/* Label */
.poi-sidebar-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    flex: 1;
    line-height: 1.3;
    white-space: nowrap;
}

/* Spinner de carga */
.poi-spinner {
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #F07400;
    border-radius: 50%;
    animation: poiSpin 0.7s linear infinite;
    flex-shrink: 0;
    display: none;
}

.poi-spinner.active {
    display: block;
}

@keyframes poiSpin {
    to { transform: rotate(360deg); }
}

/* Boton limpiar */
.poi-sidebar-clear {
    padding: 6px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poi-sidebar-clear:hover {
    background: rgba(255, 60, 60, 0.1);
    color: #ff5555;
}

/* Estado deshabilitado (heatmap activo / zoom alejado) */
.poi-sidebar.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ============================================
   POI Markers en el mapa
   ============================================ */

.poi-marker-container {
    background: transparent !important;
    border: none !important;
}

.poi-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: transform 0.15s ease;
    position: relative;
}

.poi-marker::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--poi-bg);
    opacity: 0.3 !important;
}

.poi-marker:hover {
    transform: scale(1.3);
    z-index: 1000 !important;
}

.poi-marker svg {
    display: block;
    position: relative;
    z-index: 1;
}

/* Tooltip de POI en el mapa */
.poi-tooltip {
    background: rgba(15, 15, 25, 0.92) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 6px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    padding: 4px 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    white-space: nowrap;
}

.poi-tooltip::before {
    border-top-color: rgba(15, 15, 25, 0.92) !important;
}

/* ============================================
   Draw Tools (Filtrar Area)
   ============================================ */

.poi-draw-section {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 6px 10px;
}

.poi-draw-header {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    text-align: center;
}

.poi-draw-tools {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.poi-draw-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.poi-draw-btn:hover {
    background: rgba(240, 116, 0, 0.1);
    border-color: rgba(240, 116, 0, 0.3);
    color: #F07400;
}

.poi-draw-btn.active {
    background: rgba(240, 116, 0, 0.15);
    border-color: #F07400;
    color: #F07400;
    box-shadow: 0 0 8px rgba(240, 116, 0, 0.2);
}

.poi-clear-filter {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    font-weight: 600;
    color: #F07400;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.poi-clear-filter.visible {
    display: flex;
}

.poi-clear-filter:hover {
    background: rgba(240, 116, 0, 0.08);
}

.poi-clear-filter svg {
    flex-shrink: 0;
}

/* Cursor crosshair durante dibujo */
.draw-mode-active {
    cursor: crosshair !important;
}

.draw-mode-active * {
    cursor: crosshair !important;
}

/* Deshabilitar interaccion con markers/popups durante dibujo */
.draw-mode-active .leaflet-marker-pane,
.draw-mode-active .leaflet-overlay-pane canvas,
.draw-mode-active .leaflet-popup-pane {
    pointer-events: none !important;
}

/* Estado deshabilitado de draw tools durante heatmap */
.poi-sidebar.disabled .poi-draw-section {
    opacity: 0.3;
    pointer-events: none;
}

/* ============================================
   Light Mode Overrides
   ============================================ */

.light-mode .poi-sidebar {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.light-mode .poi-sidebar-header {
    background: linear-gradient(135deg, rgba(240, 116, 0, 0.08), rgba(0, 180, 255, 0.04));
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.light-mode .poi-sidebar-row:hover {
    background: rgba(0, 0, 0, 0.03);
}

.light-mode .poi-sidebar-label {
    color: #444;
}

.light-mode .poi-sidebar-clear {
    border-top-color: rgba(0, 0, 0, 0.06);
    color: #999;
}

.light-mode .poi-sidebar-clear:hover {
    background: rgba(255, 60, 60, 0.06);
    color: #cc3333;
}

.light-mode .poi-marker {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(0, 0, 0, 0.15);
}

.light-mode .poi-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: #333 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
}

.light-mode .poi-tooltip::before {
    border-top-color: rgba(255, 255, 255, 0.95) !important;
}

.light-mode .poi-draw-section {
    border-top-color: rgba(0, 0, 0, 0.06);
}

.light-mode .poi-draw-header {
    color: #999;
}

.light-mode .poi-draw-btn {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
    color: #666;
}

.light-mode .poi-draw-btn:hover {
    background: rgba(240, 116, 0, 0.06);
    border-color: rgba(240, 116, 0, 0.25);
    color: #F07400;
}

.light-mode .poi-draw-btn.active {
    background: rgba(240, 116, 0, 0.1);
    border-color: #F07400;
    color: #F07400;
}

.light-mode .poi-clear-filter {
    border-top-color: rgba(0, 0, 0, 0.06);
    color: #F07400;
}

.light-mode .poi-clear-filter:hover {
    background: rgba(240, 116, 0, 0.05);
}

/* ============================================
   Area measurement tooltip (draw live)
   ============================================ */

.mp-area-tooltip {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: rgba(18, 18, 28, 0.92);
    border: 1px solid rgba(240, 116, 0, 0.35);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.92);
    padding: 7px 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(8px);
    min-width: 150px;
    max-width: 220px;
    pointer-events: none;
    z-index: 1000;
    font-size: 11px;
    line-height: 1.35;
}

.mp-area-floating {
    position: absolute;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.mp-area-floating.visible {
    opacity: 1;
    transform: translateY(0);
}

.mp-area-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 0;
}

.mp-area-row + .mp-area-row {
    border-top: 1px dashed rgba(255, 255, 255, 0.07);
}

.mp-area-k {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: rgba(255, 255, 255, 0.55);
}

.mp-area-v {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    font-variant-numeric: tabular-nums;
}

.mp-area-v.mp-area-hl {
    color: #F07400;
    font-size: 13px;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(240, 116, 0, 0.35);
}

.mp-area-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    font-style: italic;
}

.light-mode .mp-area-tooltip {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(240, 116, 0, 0.4);
    color: #2a2a2a;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.light-mode .mp-area-row + .mp-area-row {
    border-top-color: rgba(0, 0, 0, 0.07);
}

.light-mode .mp-area-k {
    color: #888;
}

.light-mode .mp-area-v {
    color: #2a2a2a;
}

.light-mode .mp-area-v.mp-area-hl {
    color: #F07400;
    text-shadow: none;
}

.light-mode .mp-area-hint {
    color: #777;
}

@media (max-width: 768px) {
    .mp-area-tooltip {
        min-width: 130px;
        max-width: 180px;
        padding: 6px 8px;
        font-size: 10px;
    }
    .mp-area-k { font-size: 9px; }
    .mp-area-v { font-size: 11px; }
    .mp-area-v.mp-area-hl { font-size: 12px; }
}

@media (max-width: 480px) {
    .mp-area-tooltip {
        min-width: 115px;
        max-width: 160px;
        padding: 5px 7px;
    }
}
