/* CSS Design System — Catastro Intelligence Platform (Enterprise Theme) */
:root {
    --bg-dark: #090d16;
    --bg-surface: rgba(15, 23, 42, 0.94);
    --bg-card: rgba(30, 41, 59, 0.75);
    --border-color: rgba(255, 255, 255, 0.12);
    --border-hover: rgba(0, 242, 254, 0.4);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --accent-cyan: #00f2fe;
    --accent-blue: #38ef7d;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    
    --kpi-blue: #3b82f6;
    --kpi-emerald: #10b981;
    --kpi-purple: #8b5cf6;
    --kpi-amber: #f59e0b;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
    --blur-glass: blur(16px);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Space Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.enterprise-theme {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Top Enterprise Header Bar */
.enterprise-header {
    height: 60px;
    background: #0f172a;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 2000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 0 12px rgba(0, 198, 255, 0.4);
}

.brand-title h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.brand-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;

}

.badge-region {
    color: var(--accent-cyan);
    font-weight: 500;
}

.badge-status {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot-online {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
}

/* Navigation Tabs (GIS vs Analytics) */
.header-nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 16px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.nav-tab:hover {
    color: var(--text-main);
}

.nav-tab.active {
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #fff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
}

/* Header Action Buttons */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-header {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-header:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-cyan);
}

.btn-header.primary {
    background: linear-gradient(135deg, #059669, #10b981);
    border: none;
}
.btn-header.primary:hover {
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-header.icon-only {
    padding: 8px 10px;
}

/* App Container */
.app-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: 390px;
    min-width: 360px;
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    padding: 16px;
    gap: 14px;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s, border-color 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.kpi-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.kpi-icon.blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.kpi-icon.emerald { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.kpi-icon.purple { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.kpi-icon.amber { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.kpi-data {
    display: flex;
    flex-direction: column;
}

.kpi-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.kpi-label {
    font-size: 10px;
    color: var(--text-muted);
}

/* Stats Detail Box */
.stats-detail-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.stat-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.stat-detail-item span { color: var(--text-dim); }
.stat-detail-item strong { color: var(--accent-cyan); font-family: var(--font-mono); font-size: 11px; }

/* Section Titles */
.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-cyan);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Search Box Dual */
.search-section {
    position: relative;
    display: flex;
    flex-direction: column;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-dim);
    font-size: 14px;
}

.search-box input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 38px 10px 38px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
    background: rgba(30, 45, 75, 0.9);
}

.btn-clear {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    display: none;
}
.btn-clear:hover { color: var(--text-main); }

/* Autocomplete Dropdown */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: #0f172a;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-md);
    max-height: 280px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: var(--shadow-glass);
}

.search-results-dropdown.hidden { display: none; }

.search-item {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.15s;
}

.search-item:hover { background: rgba(0, 242, 254, 0.12); }

.search-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-item-rol {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-cyan);
    font-size: 13px;
}

.search-item-comuna {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
}

.search-item-dir {
    font-size: 12px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Filters */
.filter-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 12px;
    outline: none;
    cursor: pointer;
}
.filter-group select:focus { border-color: var(--accent-cyan); }

/* Opacity Slider Group */
.opacity-group {
    margin-top: 4px;
}
.label-with-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mono-val {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-cyan);
    font-weight: 700;
}
input[type=range] {
    width: 100%;
    accent-color: var(--accent-cyan);
    cursor: pointer;
}

/* Commune Breakdown List */
.communes-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
}

.commune-row {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.commune-row:hover { background: rgba(0, 242, 254, 0.1); }

.commune-name { font-weight: 500; }
.commune-count { font-family: var(--font-mono); color: var(--accent-cyan); font-weight: 700; }

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-dim);
}

.badge-github {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}

/* Content Area & Workspaces */
.content-wrapper {
    flex: 1;
    position: relative;
    height: 100%;
    overflow: hidden;
}

.workspace-panel {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.workspace-panel.active {
    display: block;
}

#map {
    width: 100%;
    height: 100%;
    background: #090d16;
}

/* Floating Overlay Controls */
.map-overlay-controls {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.basemap-selector-container .glass-select {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 20px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    box-shadow: var(--shadow-glass);
}

.glass-pill {
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-glass);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.glass-btn {
    width: 38px;
    height: 38px;
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    box-shadow: var(--shadow-glass);
    transition: all 0.2s;
}

.glass-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: scale(1.05);
}

.map-buttons { display: flex; gap: 8px; }

/* Floating Map Legend Box */
.map-legend-box {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.90);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.legend-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-cyan);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.legend-item {
    font-size: 11px;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Property Inspector Drawer */
.inspector-drawer {
    position: absolute;
    top: 18px;
    bottom: 18px;
    right: 18px;
    width: 400px;
    background: var(--bg-surface);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-glass);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.inspector-drawer.hidden { display: none; }

@keyframes slideIn {
    from { transform: translateX(420px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.drawer-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 15px;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}
.btn-close:hover { color: #fff; }

.drawer-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.insp-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-cyan);
    letter-spacing: 0.5px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.insp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.insp-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.insp-val {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 2px;
}

.insp-badge-row { display: flex; gap: 8px; }

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-comuna { background: rgba(59, 130, 246, 0.25); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-destino { background: rgba(16, 185, 129, 0.25); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }

.insp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.insp-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.insp-item.full-width { grid-column: 1 / -1; }

.insp-item-label { font-size: 10px; color: var(--text-muted); }

.insp-item-val { font-size: 13px; font-weight: 700; }
.insp-item-val.highlight { color: #34d399; font-size: 16px; }
.insp-item-val.mono { font-family: var(--font-mono); font-size: 11px; }

.insp-coords-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 11px;
}

.btn-gmaps {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 4px;
}

.btn-gmaps:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-download-kmz {
    background: linear-gradient(135deg, #0078d4, #0099ff);
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.3);
}

.btn-download-kmz:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 120, 212, 0.5);
}

/* Custom Leaflet Popup Google Earth Style */
.leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(12px) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(0, 242, 254, 0.4) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    padding: 4px !important;
}

.leaflet-popup-tip { background: #0f172a !important; }

.kmz-popup-card {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
}

.kmz-popup-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kmz-popup-rol {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: #00f2fe;
    font-size: 14px;
}

.kmz-popup-comuna {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
}

.kmz-popup-row {
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    color: #cbd5e1;
}

.kmz-popup-row strong { color: #fff; }

/* Analytics BI Workspace Styling */
#analytics-workspace {
    background: #090d16;
    overflow-y: auto;
    padding: 24px;
}

.analytics-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.analytics-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-glass);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-card-body {
    position: relative;
    height: 320px;
    width: 100%;
}

/* ═══════════════════════════════════════════════════
   POI — Modal estilo Microsoft Fluent / Power BI
   ═══════════════════════════════════════════════════ */
#poi-modal-overlay {
    display: none;                    /* OCULTO por defecto */
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 22, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
#poi-modal-overlay.visible {
    display: flex;                    /* VISIBLE al activar */
    animation: modal-bg-in 0.2s ease both;
}
@keyframes modal-bg-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Tarjeta del diálogo (Fluent Dark Card) ── */
#poi-modal {
    background: #0f1729;
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 2px solid #0078d4;       /* acento azul Microsoft */
    border-radius: 6px;
    width: 420px;
    max-width: 94vw;
    box-shadow: 0 32px 80px rgba(0,0,0,0.75), 0 0 0 1px rgba(0,120,212,0.15);
    animation: modal-slide-in 0.22s cubic-bezier(.33,1,.68,1) both;
    overflow: hidden;
}
@keyframes modal-slide-in {
    from { transform: translateY(-16px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)     scale(1);    opacity: 1; }
}

/* ── Cabecera del modal ── */
.poi-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.poi-modal-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 9px;
    letter-spacing: 0.1px;
}
.poi-modal-header h3 .poi-hdr-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: rgba(0,120,212,0.18);
    border: 1px solid rgba(0,120,212,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4fc3f7;
    font-size: 12px;
}
.poi-modal-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.poi-modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text-main); }

/* ── Coordenadas badge ── */
.poi-coords-badge {
    margin: 12px 20px 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,120,212,0.1);
    border: 1px solid rgba(0,120,212,0.25);
    border-radius: 4px;
    padding: 5px 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: #4fc3f7;
}
.poi-coords-badge i { font-size: 10px; opacity: 0.7; }

/* ── Cuerpo del modal ── */
.poi-modal-body {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Fila de campos horizontal */
.poi-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Campo de formulario estilo Fluent (underline focus) */
.poi-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.poi-field.full { grid-column: 1 / -1; }
.poi-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.poi-field input,
.poi-field textarea,
.poi-field select {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: none;
    border-bottom: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 3px 3px 0 0;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 13px;
    padding: 7px 8px;
    outline: none;
    transition: border-color 0.18s, background 0.18s;
}
.poi-field input:focus,
.poi-field textarea:focus,
.poi-field select:focus {
    background: rgba(0,120,212,0.06);
    border-bottom-color: #0078d4;
}
.poi-field input::placeholder,
.poi-field textarea::placeholder { color: var(--text-dim); font-size: 12px; }
.poi-field textarea { resize: none; height: 64px; }
.poi-field select option { background: #0f1729; color: var(--text-main); }

/* ── Footer con botones ── */
.poi-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
    background: rgba(0,0,0,0.2);
}
/* Botón primario — Microsoft blue */
#poi-btn-save {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    background: #0078d4;
    border: 1px solid #106ebe;
    border-radius: 4px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    letter-spacing: 0.1px;
}
#poi-btn-save:hover  { background: #106ebe; transform: translateY(-1px); }
#poi-btn-save:active { background: #005a9e; transform: translateY(0); }
#poi-btn-save:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Botón secundario — ghost */
#poi-btn-cancel {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
#poi-btn-cancel:hover { background: rgba(255,255,255,0.07); color: var(--text-main); }
/* El botón secundario Cancelar en footer usa el mismo estilo ghost */
#poi-btn-cancel-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
#poi-btn-cancel-secondary:hover { background: rgba(255,255,255,0.07); color: var(--text-main); }

/* ── Marcador POI personalizado ─── */
.poi-marker-icon {
    width: 32px;
    height: 40px;
    position: relative;
    filter: drop-shadow(0 4px 12px rgba(0,242,254,0.55));
    animation: poi-drop 0.35s cubic-bezier(.22,.68,0,1.4) both;
}
@keyframes poi-drop {
    from { transform: translateY(-24px) scale(0.6); opacity: 0; }
    to   { transform: translateY(0)     scale(1);   opacity: 1; }
}

/* ── Sección POI en sidebar (mismo patrón que .communes-section) ── */
.poi-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Fila título + botón alineados horizontalmente */
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.section-title-row .section-title {
    margin-bottom: 0;
}

/* Botón de acción compacto (estilo Microsoft command button) */
.btn-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: #fff;
    background: #0078d4;
    border: 1px solid #106ebe;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.1px;
}
.btn-action-pill:hover {
    background: #106ebe;
    box-shadow: 0 2px 8px rgba(0,120,212,0.35);
}
.btn-action-pill.active {
    background: rgba(239,68,68,0.18);
    border-color: rgba(239,68,68,0.45);
    color: #fca5a5;
    box-shadow: none;
}

/* Lista de puntos de interés */
.poi-list-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}
.poi-list-wrap::-webkit-scrollbar { width: 4px; }
.poi-list-wrap::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}
.poi-list-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s, border-color 0.15s;
}
.poi-list-item:hover {
    background: rgba(0,242,254,0.07);
    border-color: rgba(0,242,254,0.25);
}
.poi-list-icon {
    font-size: 15px;
    flex-shrink: 0;
}
.poi-list-content { flex: 1; min-width: 0; }
.poi-list-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.poi-list-meta {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.poi-list-delete {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.poi-list-item:hover .poi-list-delete { opacity: 1; }
.poi-list-delete:hover { color: #ef4444; background: rgba(239,68,68,0.12); }
.poi-list-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    padding: 14px 0;
    font-style: italic;
}

/* Tooltip de activación del modo doble-clic */
.dblclick-hint {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,242,254,0.15);
    border: 1px solid rgba(0,242,254,0.4);
    border-radius: 20px;
    padding: 7px 18px;
    font-size: 12px;
    color: var(--accent-cyan);
    pointer-events: none;
    z-index: 700;
    white-space: nowrap;
    animation: hint-fade 3.5s ease forwards;
}
@keyframes hint-fade {
    0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    75%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ── IPT Layers Switch Toggle & Card Styling ── */
.layers-section {
    margin-bottom: 16px;
}
.layer-toggle-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    transition: all 0.2s ease;
}
.layer-toggle-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 120, 212, 0.4);
}
.toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s;
    border-radius: 20px;
}
.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.toggle-switch input:checked + .slider {
    background-color: #0078d4;
    box-shadow: 0 0 8px rgba(0, 120, 212, 0.6);
}
.toggle-switch input:checked + .slider:before {
    transform: translateX(18px);
}
.toggle-info {
    display: flex;
    flex-direction: column;
}
.toggle-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}
.toggle-sub {
    font-size: 11px;
    color: var(--text-dim);
}

/* ── IPT Leaflet Popup Styling ── */
.ipt-popup-card {
    font-family: var(--font-main);
    color: #1f2937;
    max-width: 290px;
    padding: 2px;
}
.ipt-popup-card h4 {
    margin: 4px 0 6px 0;
    font-size: 13px;
    color: #0078d4;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 4px;
    line-height: 1.3;
}
.ipt-popup-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    background: #0078d4;
    color: #ffffff;
}
.ipt-popup-meta {
    font-size: 11px;
    line-height: 1.45;
    color: #4b5563;
    margin-bottom: 6px;
}
.ipt-popup-meta strong {
    color: #111827;
}
.ipt-popup-usos {
    font-size: 11px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 8px;
    max-height: 130px;
    overflow-y: auto;
}
.ipt-popup-usos p {
    margin: 2px 0;
}

/* ── Modal Overlay & Fluent Login Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(4, 10, 22, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.2s ease;
}
.modal-overlay.visible {
    display: flex !important;
}
.modal-overlay.hidden {
    display: none !important;
}

.fluent-modal {
    width: 420px;
    max-width: 92vw;
    background: #0f172a;
    border: 1px solid rgba(0, 120, 212, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 120, 212, 0.25);
    overflow: hidden;
    animation: modal-slide 0.25s ease forwards;
}

@keyframes modal-slide {
    from { opacity: 0; transform: translateY(-15px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.input-with-action {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-action input {
    width: 100%;
    padding-right: 36px !important;
}
.btn-input-icon {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    transition: color 0.15s;
}
.btn-input-icon:hover {
    color: var(--text-main);
}

.login-hint-box {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(0, 120, 212, 0.1);
    border: 1px solid rgba(0, 120, 212, 0.3);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-muted);
}
.login-hint-box strong {
    color: var(--accent-cyan);
}

.login-alert {
    padding: 8px 12px;
    margin-bottom: 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}
.login-alert.hidden {
    display: none !important;
}
.login-alert.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}
.login-alert.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.btn-primary-fluent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    background: linear-gradient(135deg, #0078d4, #0099ff);
    border: 1px solid #106ebe;
    border-radius: 4px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary-fluent:hover {
    background: #106ebe;
    box-shadow: 0 4px 12px rgba(0, 120, 212, 0.4);
}

/* ── Full Screen Mandatory Login Gate Overlay ── */
.login-gate-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle at center, #0f172a 0%, #040914 100%);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-gate-card {
    width: 440px;
    max-width: 95vw;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 120, 212, 0.4);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(0, 120, 212, 0.2);
    overflow: hidden;
    animation: gate-bounce 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

@keyframes gate-bounce {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.gate-header {
    text-align: center;
    padding: 24px 24px 16px 24px;
    background: rgba(0, 120, 212, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.gate-logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #0078d4, #00f2fe);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    font-size: 26px;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 120, 212, 0.4);
}
.gate-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}
.gate-subtitle {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
    display: block;
}

.gate-body {
    padding: 20px 24px;
}

.gate-badge-lock {
    text-align: center;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
}

.btn-gate-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #0078d4, #0099ff);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(0, 120, 212, 0.4);
}
.btn-gate-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 120, 212, 0.6);
}

.gate-hint {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.gate-hint strong {
    color: var(--accent-cyan);
}

.gate-footer {
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    font-size: 10px;
    color: var(--text-dim);
}


