/* ════════════════════════════════════════════════
   css/style.css  —  Jalisco · Servicios e Infraestructura
   ════════════════════════════════════════════════ */

:root {
    --ink: #0d1a1c;
    --paper: #edf1ea;
    --panel: rgba(10, 19, 22, 0.88);
    --panel-border: rgba(144, 255, 214, 0.2);
    --accent: #18f0d4;
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.2);
    --radius-lg: 24px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 12px;
    z-index: 10000;
    padding: 8px 16px;
    background: var(--accent);
    color: var(--ink);
    font-weight: 700;
    font-size: 13px;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.15s;
}

.skip-link:focus {
    top: 0;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--paper);
    background:
        radial-gradient(circle at top left, rgba(28, 124, 255, 0.12), transparent 26%),
        linear-gradient(135deg, #071013 0%, #102329 45%, #17363f 100%);
}

body {
    min-height: 100vh;
}

/* ── Loading overlay ────────────────────────────── */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(7, 16, 19, 0.88);
    backdrop-filter: blur(8px);
}

.loading-box {
    text-align: center;
    color: var(--paper);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border: 3px solid rgba(24, 240, 212, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
        border-top-color: var(--accent);
        border-right-color: var(--accent);
    }
}

.loading-box p {
    font-size: 14px;
    font-weight: 600;
    color: rgba(237, 241, 234, 0.8);
    margin: 0;
}

/* ── Layout ─────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: 360px 1fr;
    min-height: 100vh;
}

/* ── Panel lateral ──────────────────────────────── */
.control-panel {
    padding: 28px 22px 24px;
    background: var(--panel);
    backdrop-filter: blur(18px);
    border-right: 1px solid var(--panel-border);
    overflow-y: auto;
}

.panel-kicker,
.heading-kicker {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.control-panel h1 {
    margin: 10px 0 12px;
    font-family: "Poppins", sans-serif;
    font-weight: 700;
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.panel-intro,
.note-card p,
.legend-item p {
    margin: 0;
    color: rgba(237, 241, 234, 0.78);
    line-height: 1.55;
    font-size: 13px;
}

/* ── Controles ──────────────────────────────────── */
.control-block {
    margin-top: 20px;
}

.control-block label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(237, 241, 234, 0.82);
}

.control-block select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(237, 241, 234, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #f6f7f0;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    appearance: none;
    font-family: inherit;
}

.control-block select:focus {
    border-color: var(--accent);
}

/* ── Opciones del selector ───────────────────────── */
.control-block select option {
    background-color: #0d1f24;
    color: #f6f7f0;
    font-size: 14px;
    padding: 8px;
}

.control-block select option:hover,
.control-block select option:checked {
    background-color: #18f0d4;
    color: #071013;
}

/* ── Checkbox ────────────────────────────────────── */
.checklist-container .checkbox-row,
label.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    color: rgba(237, 241, 234, 0.85);
}

.checkbox-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ── Checklist y Scrollable List ─────────────────── */
.checklist-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(237, 241, 234, 0.1);
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
}

.scrollable-list {
    max-height: 250px;
    overflow-y: auto;
}

.scrollable-list::-webkit-scrollbar {
    width: 6px;
}

.scrollable-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.scrollable-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(237, 241, 234, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--paper);
    font-size: 13px;
    margin-bottom: 8px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
}

.btn-small {
    background: rgba(24, 240, 212, 0.15);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-small:hover {
    background: var(--accent);
    color: var(--ink);
}

/* ── Tarjetas ────────────────────────────────────── */
.legend-card,
.note-card {
    margin-top: 24px;
    padding: 18px 18px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(237, 241, 234, 0.1);
    box-shadow: var(--shadow-md);
}

.legend-card h3,
.note-card h3 {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric-summary {
    margin-bottom: 14px;
    color: rgba(237, 241, 234, 0.8);
    font-size: 13px;
    line-height: 1.45;
}

/* ── Leyenda coroplética ─────────────────────────── */
.legend-scale {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    align-items: flex-end;
}

.scale-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.scale-swatch {
    width: 100%;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.scale-label {
    text-align: center;
    font-size: 9px;
    color: rgba(237, 241, 234, 0.72);
    white-space: nowrap;
}

.legend-divider {
    height: 1px;
    margin: 14px 0;
    background: rgba(237, 241, 234, 0.12);
}

.legend-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.legend-item strong {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
}

.legend-chip {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border-radius: 50%;
    flex-shrink: 0;
}

.servicios-chip {
    background: rgba(24, 240, 212, 0.9);
    box-shadow: 0 0 14px rgba(24, 240, 212, 0.45);
}

/* ── Mapa ────────────────────────────────────────── */
.map-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 18px;
}

.map-heading {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    padding: 0 10px 16px;
}

.map-heading h2 {
    margin: 10px 0 6px;
    font-family: "Poppins", sans-serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.map-heading p {
    max-width: 480px;
    font-size: 14px;
    text-align: right;
    color: rgba(237, 241, 234, 0.78);
    line-height: 1.55;
}

#map {
    flex: 1;
    min-height: 680px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(237, 241, 234, 0.08);
}

/* ── Leaflet overrides ──────────────────────────── */
.leaflet-container {
    background: linear-gradient(180deg, #dbe9db 0%, #d0ddd8 100%);
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    color: var(--ink) !important;
}

.leaflet-popup-content-wrapper {
    background: rgba(8, 18, 20, 0.96) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.leaflet-popup-tip {
    background: rgba(8, 18, 20, 0.96) !important;
}

/* ── Popup ───────────────────────────────────────── */
.popup-card h3 {
    margin: 0 0 8px;
    font-family: "Poppins", sans-serif;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.1;
}

.popup-card p {
    margin: 0 0 8px;
    color: rgba(243, 246, 239, 0.82);
    font-size: 13px;
    line-height: 1.4;
}

.popup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    margin-top: 10px;
}

.popup-grid div {
    font-size: 12px;
    color: rgba(243, 246, 239, 0.72);
}

.popup-grid strong {
    display: block;
    margin-bottom: 2px;
    color: #fff;
    font-size: 12px;
}

.popup-services-list {
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.popup-services-list div {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    color: rgba(243, 246, 239, 0.85);
}

.popup-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ── Glosario ────────────────────────────────────── */
.glosario-list {
    margin: 10px 0 15px 15px;
    padding: 0;
    font-size: 0.85rem;
    color: rgba(243, 246, 239, 0.82);
    list-style-type: disc;
}

.glosario-list li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* ── Metodología Expandida ──────────────────────── */
.methodology-section {
    margin-top: 16px;
}

.methodology-section .methodology-sub {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin: 0 0 6px 0;
}

.methodology-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(24, 240, 212, 0.3);
    transition: all 0.2s ease;
}

.methodology-link:hover {
    border-bottom-color: var(--accent);
    opacity: 0.8;
}

.transparency-box {
    margin: 20px 0;
    padding: 14px;
    background: rgba(24, 240, 212, 0.04);
    border: 1px solid rgba(24, 240, 212, 0.15);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
}

.transparency-box p {
    font-size: 12px;
    margin-bottom: 12px;
    color: rgba(237, 241, 234, 0.9);
}

.btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: var(--ink);
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 240, 212, 0.3);
}

.methodology-steps {
    margin: 8px 0 0 16px;
    padding: 0;
    list-style-type: decimal;
    font-size: 12px;
    color: rgba(237, 241, 234, 0.75);
}

.methodology-steps li {
    margin-bottom: 4px;
}

/* ── Tooltip ─────────────────────────────────────── */
.monitor-label {
    background: rgba(8, 18, 20, 0.92);
    color: #f5f7f2;
    border: 1px solid rgba(24, 240, 212, 0.24);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 6px 10px;
}

.monitor-label::before {
    display: none;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .control-panel {
        border-right: none;
        border-bottom: 1px solid var(--panel-border);
    }

    .map-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .map-heading p {
        text-align: left;
    }
}

@media (max-width: 720px) {

    .control-panel,
    .map-stage {
        padding: 16px;
    }

    .control-panel h1,
    .map-heading h2 {
        font-size: 22px;
    }

    #map {
        min-height: 72vh;
    }
}

@media (max-width: 480px) {
    .control-panel,
    .map-stage {
        padding: 12px;
    }

    .control-panel h1 {
        font-size: 20px;
    }

    .map-heading h2 {
        font-size: 18px;
    }

    .scrollable-list {
        max-height: 180px;
    }

    .legend-card,
    .note-card {
        padding: 14px 14px 12px;
    }
}

@media (max-width: 375px) {
    .control-panel,
    .map-stage {
        padding: 10px;
    }

    .control-panel h1 {
        font-size: 18px;
    }

    .map-heading h2 {
        font-size: 16px;
    }

    #map {
        min-height: 60vh;
    }

    .scrollable-list {
        max-height: 150px;
    }
}

/* ── Quejas & Clusters (Refined) ────────────────── */
.custom-cluster-quejas {
    background: transparent;
}

.queja-cluster-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 94, 0, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid #ff914d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 
        0 0 20px rgba(255, 94, 0, 0.5),
        inset 0 0 12px rgba(255, 94, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.queja-cluster-icon span {
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.queja-cluster-icon:hover {
    transform: scale(1.15);
    background: rgba(255, 94, 0, 0.45);
    box-shadow: 0 0 30px rgba(255, 94, 0, 0.7);
}

.queja-marker-glow {
    /* Estilo sólido sin neon */
    filter: none !important;
    stroke: #ffffff;
    stroke-width: 1.5px;
    opacity: 1 !important;
}

/* ── Estructura de Popup de Quejas ──────────────── */
.popup-card.dark-popup {
    color: #fff !important;
    min-width: 240px;
    padding: 5px;
}

.popup-card.dark-popup h3 {
    margin: 0 0 15px 0;
    font-size: 15px;
    color: #ffcc00;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.popup-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 6px;
}

.popup-info-row .label { opacity: 0.5; font-weight: 400; }
.popup-info-row .value { font-weight: 600; text-align: right; }

.popup-total-row {
    margin-top: 18px;
    background: linear-gradient(135deg, rgba(255, 94, 0, 0.3) 0%, rgba(255, 94, 0, 0.1) 100%);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 94, 0, 0.3);
}

.popup-total-row .count {
    display: block;
    font-size: 36px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    text-shadow: 0 0 15px rgba(255, 94, 0, 0.6);
}

.popup-total-row .unit {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.8;
    margin-top: 4px;
    display: block;
}

.popup-footer {
    margin-top: 15px;
    font-size: 10px;
    opacity: 0.4;
    text-align: center;
    font-style: italic;
}