:root {
    /* --- Paleta de Colores Institucional (GobMX) --- */
    --color-gobmx-guinda: #9B2247;
    --color-gobmx-verde: #1E5B4F;
    --color-gobmx-dorado: #A57F2C;
    --color-gobmx-gris: #98989A;
    --color-gobmx-gris-claro: #E5E5E5;

    /* Variantes de Opacidad (para fondos) */
    --color-gobmx-guinda-light: rgba(155, 34, 71, 0.05);
    --color-gobmx-verde-light: rgba(30, 91, 79, 0.05);
    --color-gobmx-dorado-light: rgba(165, 127, 44, 0.05);

    /* Colores Funcionales */
    --color-text-primary: #333333;
    --color-text-secondary: var(--color-gobmx-gris);
    --color-background: #FFFFFF;
    --color-surface: #F8F9FA;
    --color-border: #DDDDDD;

    /* Compatibilidad con código existente */
    --color-verde-profundo: var(--color-gobmx-verde);
    --color-verde-claro: #24a47a;
    --color-text: var(--color-text-primary);
    --color-muted: var(--color-text-secondary);
    --color-surface-soft: var(--color-surface);
    --color-pill-bg: rgba(30, 91, 79, 0.12);
    --color-pill-text: var(--color-gobmx-verde);
    --color-button: var(--color-gobmx-guinda);
    --color-button-hover: #7a1b38;
    --color-guinda: var(--color-gobmx-guinda);
    --color-guinda-light: rgba(155, 34, 71, 0.2);

    /* Gradientes institucionales */
    --gradient-header: linear-gradient(120deg, var(--color-gobmx-guinda) 0%, #7a1b38 55%, #5a1429 100%);
    --gradient-verde: linear-gradient(120deg, var(--color-gobmx-verde) 0%, #165845 55%, #0d3a2d 100%);

    /* Sombras */
    --shadow-elevated: 0 22px 60px -28px rgba(155, 34, 71, 0.25);
    --shadow-soft: 0 14px 45px -24px rgba(30, 91, 79, 0.2);
    --shadow-card: 0 4px 6px rgba(0, 0, 0, 0.1);

    /* --- Tipografía --- */
    --font-family-headings: 'Patria', 'Merriweather', serif;
    --font-family-body: 'Noto Sans', 'Montserrat', sans-serif;

    --font-size-base: 16px;
    --font-size-h1: 2.5rem;
    --font-size-h2: 2rem;
    --font-size-h3: 1.75rem;
    --font-size-h4: 1.5rem;
    --font-size-small: 0.875rem;

    /* --- Espaciado (Based on 8pt grid) --- */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* --- Bordes y Sombras --- */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;

    /* Transiciones */
    --transition-base: 0.25s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-family-body);
    background: var(--color-surface-soft);
    color: var(--color-text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
}

button {
    font-family: inherit;
}

.container {
    width: min(1120px, 100% - 2.5rem);
    margin-inline: auto;
}

.site-header {
    background: var(--color-surface);
    color: var(--color-text);
    padding: 1.35rem 0;
    box-shadow: 0 1px 0 rgba(26, 52, 68, 0.08);
    position: relative;
    z-index: 10;
}

.site-header::after {
    content: "";
    position: absolute;
    inset: 100% 0 auto 0;
    height: 4px;
    background: var(--gradient-header);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    /* Allow wrapping on very small screens */
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
    /* Allow brand to take available space */
}

.brand-logos {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo--sener {
    width: clamp(120px, 18vw, 180px);
    /* Reduced min size */
}

.brand-logo--snien {
    width: clamp(90px, 14vw, 120px);
    /* Reduced min size */
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.brand-eyebrow {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-gobmx-guinda);
}

.brand-title {
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--color-gobmx-verde);
    font-family: var(--font-family-body);
}

.header-meta {
    flex-shrink: 0;
    /* Prevent meta box from shrinking */
    font-size: 0.75rem;
}

/* Specific adjustments for smaller screens */
@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .brand {
        width: 100%;
    }

    .header-meta {
        align-self: flex-end;
    }
}

.meta-label {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
    color: var(--color-verde-profundo);
}

.meta-value {
    font-weight: 600;
    color: var(--color-text);
    /* Use main text color */
}

.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.map-section {
    padding: 2.2rem 0 2.8rem;
}

.map-card {
    background: var(--color-surface);
    border-radius: 24px;
    /* Match welcome screen */
    padding: 0;
    /* Remove padding to allow toolbar to span full width */
    box-shadow: 0 20px 50px -20px rgba(17, 69, 51, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Important for child border-radius */
}

.card-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    /* Align items to the bottom for a cleaner look */
    gap: 1rem 1.5rem;
    background: #fcfcfa;
    padding: 1rem clamp(1rem, 2.5vw, 1.5rem);
    /* Adjust padding for mobile */
    border-bottom: 1px solid var(--color-border);
}

/* Mobile-specific layout for toolbar */
@media (max-width: 768px) {
    .card-toolbar {
        flex-direction: column;
        align-items: stretch;
        /* Make items take full width */
        gap: 1.25rem;
    }

    .toolbar-group {
        min-width: 0;
        /* Unset min-width on mobile */
        max-width: 100%;
        /* Ensure toolbar group doesn't overflow */
        overflow: hidden;
        /* Clip any overflowing content */
    }

    .control {
        width: 100%;
        /* Ensure controls take full width */
        box-sizing: border-box;
        /* Include padding in width calculation */
    }

    /* Group the action buttons together */
    .toolbar-actions {
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .toolbar-actions .toolbar-group {
        flex-grow: 1;
    }

    .toolbar-actions .btn-icon {
        width: 100%;
        height: 44px;
        /* Taller buttons for easier tapping */
    }
}

/* Desktop/Laptop layout for toolbar actions */
@media (min-width: 769px) {
    .toolbar-actions {
        display: flex;
        flex-wrap: nowrap;
        /* Prevent buttons from wrapping */
        gap: 0.5rem;
        /* Compact gap between buttons */
        margin-left: auto;
        /* Push buttons to the right */
    }

    .toolbar-actions .toolbar-group {
        flex-grow: 0;
        /* Prevent buttons from growing */
    }
}

.toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 150px;
    /* Give controls a minimum width */
}

.toolbar-group label {
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--color-muted);
}

.sheet-info-group {
    flex-grow: 1;
    /* Allow it to take space */
    min-width: 200px;
    max-width: 400px;
}

.sheet-info-label {
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--color-muted);
}

.sheet-info-value {
    font-size: 0.85rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    color: var(--color-text);
}

.sheet-info-value a {
    color: var(--color-verde-profundo);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-base);
}

.sheet-info-value a:hover {
    border-color: var(--color-verde-profundo);
}

.control {
    appearance: none;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    color: var(--color-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.control:focus-visible,
.control:focus {
    outline: none;
    border-color: var(--color-verde-profundo);
    box-shadow: 0 0 0 3px rgba(155, 34, 71, 0.15);
}

.control[type="text"] {
    background-image: none;
    padding-right: 0.9rem;
}

.btn-secondary {
    border: none;
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-family-body);
    color: #ffffff;
    background: var(--color-gobmx-verde);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    background: #165845;
    box-shadow: 0 4px 12px rgba(30, 91, 79, 0.3);
}

.btn-secondary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(155, 34, 71, 0.2);
}

/* Specific styles for icon-only buttons in toolbar */
.card-toolbar .btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 8px;
    background: var(--color-surface-soft);
    /* Neutral background */
    color: var(--color-muted);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-base);
}

.card-toolbar .btn-icon:hover {
    background: var(--color-gobmx-guinda);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(155, 34, 71, 0.3);
}

.card-toolbar .btn-icon:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(155, 34, 71, 0.2);
}

/* Export buttons - colores institucionales */
#export-map-btn,
#export-word-btn {
    background: var(--color-gobmx-guinda);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#export-map-btn:hover,
#export-word-btn:hover {
    background: var(--color-verde-claro);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(155, 34, 71, 0.2);
}

.map-content-wrapper {
    padding: clamp(1rem, 2.5vw, 1.5rem);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.map-title-text {
    margin: 0 0 1rem 0;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    font-weight: 700;
    font-family: var(--font-family-body);
    color: var(--color-gobmx-verde);
    letter-spacing: 0.03em;
    text-align: center;
}

.map-view {
    width: 100%;
    min-height: 70vh;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
}

.map-description {
    padding: 1rem 0.5rem;
    font-size: 0.9rem;
    color: var(--color-muted);
    line-height: 1.6;
    border-top: 1px solid var(--color-border);
    margin-top: 1rem;
}

.map-description h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-family-body);
    color: var(--color-gobmx-verde);
}

.map-description p {
    margin: 0;
}

.map-inset {
    position: absolute;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(155, 34, 71, 0.18);
    border-radius: 12px;
    padding: 0.45rem;
    box-shadow: 0 16px 32px -22px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 640;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    pointer-events: auto;
}

.map-inset__title {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-verde-profundo);
    margin: 0;
    cursor: move;
}

.map-inset__map {
    flex: 1;
    min-height: 110px;
    border-radius: 8px;
    overflow: hidden;
}

.map-inset .leaflet-control-attribution,
.map-inset .leaflet-control-container {
    display: none !important;
}

/* Handles de redimensionamiento para los minimapas */
.map-inset__resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--color-gobmx-guinda);
    border: 2px solid white;
    border-radius: 50%;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.map-inset__resize-handle:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Posicionamiento de cada handle */
.map-inset__resize-handle--se {
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
}

.map-inset__resize-handle--sw {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}

.map-inset__resize-handle--ne {
    top: -6px;
    right: -6px;
    cursor: nesw-resize;
}

.map-inset__resize-handle--nw {
    top: -6px;
    left: -6px;
    cursor: nwse-resize;
}

.leaflet-interactive.connections-line {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (min-width: 1024px) {
    .map-view {
        min-height: 72vh;
    }
}

/* Banner de Gerencia Seleccionada - Estilo formal y minimalista */
.selected-region-banner {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #601623;
    color: white;
    padding: 5px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    max-width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#selected-region-text {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .selected-region-banner {
        top: 8px;
        padding: 4px 12px;
        font-size: 10px;
        border-radius: 3px;
    }
}

/* Para impresión */
@media print {
    .selected-region-banner {
        box-shadow: none;
        border: 1px solid #601623;
    }
}

.card-footer {
    border-top: 1px solid rgba(26, 52, 68, 0.08);
    padding: 1rem 1.5rem 0.5rem;
    /* Add horizontal and bottom padding */
}

.data-source {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.info-section {
    background: var(--color-surface-soft);
    padding: 2.8rem 0;
}

.info-grid {
    display: grid;
    gap: 1.7rem;
}

@media (min-width: 960px) {
    .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.info-panel {
    background: var(--color-surface);
    border-radius: 20px;
    padding: clamp(1.5rem, 2.5vw, 2rem);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.info-panel h2,
.info-panel h3 {
    margin: 0;
    font-family: var(--font-family-body);
    color: var(--color-gobmx-guinda);
}

.info-panel p {
    margin: 0;
    color: var(--color-muted);
    line-height: 1.6;
}

.info-panel ul {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--color-muted);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.info-panel li {
    line-height: 1.6;
}

.site-footer {
    background: #ffffff;
    color: var(--color-text);
    padding: 2.4rem 0;
    border-top: 1px solid rgba(26, 52, 68, 0.08);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    align-items: center;
    text-align: center;
}

.footer-logos {
    display: flex;
    gap: 1.8rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-logos img {
    max-height: 68px;
    filter: grayscale(100%);
}

.site-footer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-muted);
}

#preloader {
    position: fixed;
    inset: 0;
    background: rgba(240, 245, 243, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 1rem;
}

/* Preloader específico para el mapa (visible en pantalla completa) */
.map-preloader {
    position: absolute;
    inset: 0;
    background: rgba(240, 245, 243, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    transition: opacity 0.4s ease;
}

.map-preloader.active {
    display: flex !important;
}

/* Asegurar que el preloader del mapa se vea en pantalla completa */
.map-card:fullscreen .map-preloader,
.map-card:-webkit-full-screen .map-preloader,
.map-card:-moz-full-screen .map-preloader,
.map-card:-ms-fullscreen .map-preloader {
    position: fixed;
    z-index: 99999 !important;
}

/* Overlay de progreso de exportación dentro del map-card */
#map-export-progress-overlay {
    position: absolute;
    inset: 0;
    z-index: 10000;
}

/* Asegurar que se vea en pantalla completa */
.map-card:fullscreen #map-export-progress-overlay,
.map-card:-webkit-full-screen #map-export-progress-overlay,
.map-card:-moz-full-screen #map-export-progress-overlay,
.map-card:-ms-fullscreen #map-export-progress-overlay {
    position: fixed;
    z-index: 99999 !important;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    background: var(--color-surface);
    border-radius: 20px;
    padding: 2rem 2.5rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
    max-width: 360px;
    width: 100%;
    border: 1px solid rgba(26, 52, 68, 0.1);
}

.preloader-logo {
    width: 100px;
    /* Larger size for the logo */
    height: auto;
    animation: pulse 1.5s cubic-bezier(0.6, 0, 0.4, 1) infinite;
    /* Reintroduce pulse animation */
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

.preloader-content p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.05em;
    margin: 0;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--color-surface-soft);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-gobmx-guinda) 0%, var(--color-gobmx-verde) 100%);
    width: 0%;
    border-radius: 999px;
    transition: width 0.4s ease-out;
    box-shadow: 0 0 10px rgba(155, 34, 71, 0.3);
}

/* Animación de pulso para cuando está cargando */
.progress-fill:not([style*="100%"]) {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(155, 34, 71, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(155, 34, 71, 0.6);
    }
}

.badge {
    display: inline-block;
    border-radius: 999px;
    background: var(--color-pill-bg);
    color: var(--color-pill-text);
    padding: 0.1rem 0.55rem;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
}

.description {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: var(--color-muted);
    line-height: 1.5;
}

.leaflet-container a {
    color: var(--color-button);
}

.leaflet-control-container .leaflet-control {
    border-radius: 12px;
    overflow: hidden;
}

.leaflet-control-layers {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(26, 52, 68, 0.12);
}

.leaflet-control-zoom {
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(26, 52, 68, 0.12);
}

.leaflet-control-scale {
    margin-bottom: 52px;
    margin-left: 12px;
}

.leaflet-control-scale-line {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(26, 52, 68, 0.45);
    border-top-width: 3px;
    border-bottom-width: 1px;
    color: #1a3444;
    font-family: 'Montserrat', Arial, sans-serif;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
}

/* Export buttons styles */
.export-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-export {
    border: none;
    border-radius: 12px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
    box-shadow: 0 8px 20px -12px rgba(22, 70, 54, 0.4);
    min-width: 80px;
    justify-content: center;
}

.btn-export:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px -10px rgba(22, 70, 54, 0.5);
}

.btn-export:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(155, 34, 71, 0.28);
}

.btn-export:active {
    transform: translateY(0);
}

.btn-export--pdf {
    background: linear-gradient(140deg, #d32f2f 0%, #b71c1c 100%);
}

.btn-export--pdf:hover {
    box-shadow: 0 12px 24px -10px rgba(183, 28, 28, 0.5);
}

.btn-export--png {
    background: linear-gradient(140deg, #1976d2 0%, #0d47a1 100%);
}

.btn-export--png:hover {
    box-shadow: 0 12px 24px -10px rgba(13, 71, 161, 0.5);
}

.btn-export__icon {
    font-size: 1rem;
    line-height: 1;
}

.btn-export__text {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Responsive adjustments for export buttons */
@media (max-width: 640px) {
    .export-buttons {
        width: 100%;
    }

    .btn-export {
        flex: 1;
        min-width: 0;
    }
}

/* Loading state for export buttons */
.btn-export--loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-export--loading .btn-export__icon {
    animation: spin 1s linear infinite;
}

/* Modal styles */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(16, 56, 42, 0.25);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--color-surface);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(26, 52, 68, 0.08);
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 8px;
    transition: color var(--transition-base), background-color var(--transition-base);
}

.modal-close:hover {
    color: var(--color-text);
    background: rgba(26, 52, 68, 0.08);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(26, 52, 68, 0.08);
}

/* Export form styles */
.export-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-verde-profundo);
    padding-bottom: 0.5rem;
}

.form-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
    letter-spacing: 0.02em;
}

.custom-size-section {
    background: rgba(155, 34, 71, 0.05);
    border: 1px solid rgba(155, 34, 71, 0.15);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.5rem;
}

/* Radio button styles */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 12px;
    transition: background-color var(--transition-base);
}

.radio-option:hover {
    background: rgba(155, 34, 71, 0.05);
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    position: relative;
    transition: border-color var(--transition-base);
}

.radio-option input[type="radio"]:checked+.radio-custom {
    border-color: var(--color-verde-profundo);
}

.radio-option input[type="radio"]:checked+.radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--color-gobmx-guinda);
    border-radius: 50%;
}

.radio-label {
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.4;
}

/* Checkbox styles */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color var(--transition-base);
}

.checkbox-option:hover {
    background: rgba(155, 34, 71, 0.05);
}

.checkbox-option input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    position: relative;
    transition: border-color var(--transition-base), background-color var(--transition-base);
}

.checkbox-option input[type="checkbox"]:checked+.checkbox-custom {
    border-color: var(--color-verde-profundo);
    background: var(--color-gobmx-guinda);
}

.checkbox-option input[type="checkbox"]:checked+.checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-label {
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.4;
}

/* Button styles for modal */
.btn-cancel {
    background: linear-gradient(140deg, var(--color-muted) 0%, #4a5568 100%);
}

.btn-cancel:hover {
    box-shadow: 0 18px 30px -18px rgba(74, 85, 104, 0.55);
}

.btn-export-confirm {
    position: relative;
    overflow: hidden;
}

.btn-export-confirm.loading .btn-text {
    opacity: 0;
}

.btn-export-confirm.loading .btn-spinner {
    display: flex !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Responsive modal */
@media (max-width: 640px) {
    .modal-content {
        margin: 0.5rem;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer button {
        width: 100%;
    }
}

/* 
Notification system */
.notification-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    pointer-events: none;
}

.notification {
    background: var(--color-surface);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-card);
    border-left: 4px solid var(--color-verde-profundo);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 100%;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left-color: #22c55e;
}

.notification.error {
    border-left-color: #ef4444;
}

.notification.warning {
    border-left-color: #f59e0b;
}

.notification.info {
    border-left-color: #3b82f6;
}

.notification-icon {
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}

.notification-message {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-muted);
    line-height: 1.4;
    word-wrap: break-word;
}

.notification-close {
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color var(--transition-base), background-color var(--transition-base);
}

.notification-close:hover {
    color: var(--color-text);
    background: rgba(26, 52, 68, 0.08);
}

/* Progress overlay */
.progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 56, 42, 0.3);
    backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.progress-content {
    background: var(--color-surface);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-card);
    text-align: center;
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.progress-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(155, 34, 71, 0.2);
    border-top-color: var(--color-verde-profundo);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.progress-message {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-muted);
    line-height: 1.4;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(155, 34, 71, 0.15);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-verde-profundo) 0%, var(--color-verde-claro) 100%);
    border-radius: 999px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-percentage {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-verde-profundo);
}

/* Responsive notifications */
@media (max-width: 640px) {
    .notification-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    .notification {
        padding: 0.875rem 1rem;
    }

    .progress-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }
}

/* Loading states for export buttons */
.btn-export--loading {
    position: relative;
    overflow: hidden;
}

.btn-export--loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {

    .notification,
    .progress-fill,
    .progress-spinner,
    .btn-export--loading::after {
        animation: none;
        transition: none;
    }

    .progress-fill::after {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .notification {
        border: 2px solid currentColor;
    }

    .progress-bar {
        border: 1px solid currentColor;
    }
}

/* Graticule labels control - always visible on map edges */
.graticule-labels-control {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 600;
}

.graticule-labels-top,
.graticule-labels-bottom,
.graticule-labels-left,
.graticule-labels-right {
    position: absolute;
    pointer-events: none;
}

.graticule-labels-top {
    top: 5px;
    left: 0;
    right: 0;
    height: 25px;
}

.graticule-labels-bottom {
    bottom: 25px;
    left: 0;
    right: 0;
    height: 25px;
}

.graticule-labels-left {
    left: 5px;
    top: 0;
    bottom: 0;
    width: 80px;
}

.graticule-labels-right {
    right: 5px;
    top: 0;
    bottom: 0;
    width: 80px;
}

.graticule-label-item {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    padding: 3px 8px;
    border: 1px solid rgba(155, 34, 71, 0.5);
    border-radius: 4px;
    font-size: 8px;
    font-weight: 600;
    color: var(--color-verde-profundo);
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0.75;
}

.graticule-labels-top .graticule-label-item {
    transform: translate(-50%, 0);
}

.graticule-labels-bottom .graticule-label-item {
    transform: translate(-50%, 0);
}

.graticule-labels-left .graticule-label-item {
    transform: translate(0, -50%);
}

.graticule-labels-right .graticule-label-item {
    transform: translate(0, -50%);
    right: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    /* Override default button padding */
}

.btn-icon i.bi {
    /* Target bootstrap icons specifically */
    font-size: 1.25rem;
    /* ~20px */
    line-height: 1;
}


.logos-control-wrapper {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    /* Increased to be above other controls */
}

.logos-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-wrapper {
    /* Visibility is now controlled exclusively by JS */
}

.logo-sener,
.logo-snien {

    height: 48px;
    /* Increased size */
    width: auto;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.logo-sener:hover,
.logo-snien:hover {
    opacity: 1;
}

.logo-sener {
    max-width: 150px;
}

.logo-snien {
    max-width: 120px;
}

/* Responsive adjustments para los logos */

@media (max-width: 768px) {
    .logos-control-wrapper {
        bottom: 5px;
    }


    .logos-container {
        gap: 6px;
    }

    .logo-sener,
    .logo-snien {
        height: 36px;
        /* Increased size for smaller screens */
    }

    .logo-sener {
        max-width: 70px;
    }

    .logo-snien {

        max-width: 91px;
    }

}

/* Legend styles */
.legend {
    line-height: 17px;
    color: #555;
    background-color: white;
    /* Changed from rgba(249, 247, 242, 0.96) to white */
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(161, 150, 132, 0.25);
    box-shadow: 0 12px 24px -18px rgba(60, 49, 39, 0.45);
    font-size: 11px;
    /* Reduced from default 12px */
}

.legend strong {
    font-size: 12px;
    /* Title slightly larger */
}

.legend i {
    width: 17px;
    height: 17px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}

.legend-item {
    font-size: 11px;
    /* Explicit size for legend items */
}

/* Two-column legend for total capacity map */
.legend-two-columns {
    max-width: 650px;
    width: auto;
    margin-left: auto;
    margin-right: auto;
}

.legend-columns-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.legend-column {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.legend-column .legend-item {
    display: flex;
    align-items: center;
    font-size: 10px;
    line-height: 1.3;
}

.legend-totals-row {
    display: flex;
    gap: 20px;
    justify-content: center;
    border-top: 2px solid #333;
    padding-top: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.legend-total-item {
    font-size: 11px;
    font-weight: 700;
}

/* Adjust positioning to be more centered at bottom */
.leaflet-bottom .legend-two-columns {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 768px) {
    .legend-two-columns {
        max-width: 90vw;
    }

    .legend-columns-container {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.leaflet-pane.leaflet-states-pane {
    filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.3));
}

.leaflet-pane.leaflet-gerencias-pane {
    filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.6));
}

.provincia-polygon {
    filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.5));
}

.leaflet-pane.leaflet-gerencias-pane path.gerencia-focused {
    filter: drop-shadow(0 0 8px rgba(155, 34, 71, 0.8)) drop-shadow(0 0 15px rgba(155, 34, 71, 0.4));
}

.leaflet-pane.leaflet-marinas-pane {
    filter: blur(2px);
}

/* PIB Forecast Labels */
.pib-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.pib-label-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    padding: 3px 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
}

.pib-label-id {
    text-align: center;
    font-size: 7px;
    font-weight: 600;
    color: #1a1a1a;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    padding-bottom: 2px;
    margin-bottom: 1px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.pib-row {
    display: flex;
    justify-content: center;
    align-items: center;
}

.pib-row-2030 {
    border-bottom: 1px solid rgba(155, 34, 71, 0.3);
    padding-bottom: 1px;
}

.pib-row-2039 {
    padding-top: 1px;
}

.pib-value {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.pib-row-2030 .pib-value {
    color: #1f7a62;
}

.pib-row-2039 .pib-value {
    color: var(--color-verde-profundo);
}

/* Welcome Screen Styles */
.welcome-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    /* Hidden by default, shown by JS */
    align-items: center;
    justify-content: center;
    padding: 1rem;

    /* Apply glass effect to the entire background overlay */
    background: rgba(16, 26, 26, 0.5);
    /* Dark, semi-transparent green */
    backdrop-filter: blur(15px) saturate(120%);
    -webkit-backdrop-filter: blur(15px) saturate(120%);

    animation: fadeIn 0.5s ease-in-out;
}

.welcome-content {
    /* Solid, elegant 'crema' background for the modal itself */
    background: #FDFCF5;
    color: var(--color-text);
    /* Dark text for contrast */
    border-radius: 24px;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    max-width: 800px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.7s cubic-bezier(0.2, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.welcome-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.welcome-logo-sener,
.welcome-logo-snien {
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    filter: none;
    /* Remove white filter */
    opacity: 1;
}

.welcome-logo-sener {
    width: 160px;
}

.welcome-logo-snien {
    width: 110px;
}

.welcome-title-container {
    text-align: center;
}

.welcome-title {
    color: var(--color-gobmx-guinda);
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 700;
    font-family: var(--font-family-body);
    margin: 0 0 0.25rem 0;
    line-height: 1.1;
}

.welcome-subtitle {
    color: var(--color-muted);
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 400;
    margin: 0;
}

.welcome-instructions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.instruction-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: transparent;
    /* No background on item */
    padding: 0;
}

.instruction-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--color-gobmx-guinda);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(155, 34, 71, 0.2);
}

.instruction-content h3 {
    color: var(--color-text);
    font-size: 1rem;
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.instruction-content p {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.welcome-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    background: var(--color-gobmx-guinda);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(155, 34, 71, 0.3);
}

.welcome-btn i {
    font-size: 1.1em;
}

.welcome-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 30px rgba(155, 34, 71, 0.4);
    background: var(--color-verde-claro);
}

.welcome-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(155, 34, 71, 0.3);
}

.welcome-footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Responsive adjustments for welcome screen */
@media (max-width: 768px) {
    .welcome-content {
        padding: 1.5rem 1rem;
    }

    .welcome-header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .welcome-logo-sener {
        width: 140px;
    }

    .welcome-logo-snien {
        width: 90px;
    }

    .welcome-instructions {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }
}

/* Node labels for map markers */
.leaflet-tooltip.node-label {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    /* Increased for better visibility */
    font-weight: 700;
    color: #1f7a62;
    /* Kept the green color */
    box-shadow: none;
    backdrop-filter: none;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 3px #fff;
    /* White outline */
}

.leaflet-tooltip.node-label::before {
    border-top-color: rgba(155, 34, 71, 0.3);
}

/* Marker Cluster Styles - Themed */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
    z-index: 650 !important;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    line-height: 30px;
    color: #ffffff;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

/* State and GCR Tooltips with Enhanced Visibility */
.leaflet-tooltip.state-tooltip,
.leaflet-tooltip.gcr-tooltip {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 2px solid var(--color-verde-profundo) !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--color-verde-profundo) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(8px);
}

.leaflet-tooltip.state-tooltip::before,
.leaflet-tooltip.gcr-tooltip::before {
    border-top-color: var(--color-verde-profundo) !important;
}

/* Custom electricity marker icon */
.electricity-marker-icon {
    background: transparent !important;
    border: none !important;
    z-index: 650 !important;
}

.electricity-marker-icon img {
    display: block;
    width: 32px;
    height: 32px;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

/* Small clusters */
.marker-cluster-small {
    background-color: rgba(36, 164, 122, 0.5);
}

.marker-cluster-small div {
    background-color: rgba(36, 164, 122, 0.8);
}

/* Medium clusters */
.marker-cluster-medium {
    background-color: rgba(155, 34, 71, 0.6);
}

.marker-cluster-medium div {
    align-items: flex-start;
    background: transparent;
    /* No background on item */
    padding: 0;
}

.instruction-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--color-gobmx-guinda);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(155, 34, 71, 0.2);
}

.instruction-content h3 {
    color: var(--color-text);
    font-size: 1rem;
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.instruction-content p {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.welcome-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    background: var(--color-gobmx-guinda);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(155, 34, 71, 0.3);
}

.welcome-btn i {
    font-size: 1.1em;
}

.welcome-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 30px rgba(155, 34, 71, 0.4);
    background: var(--color-verde-claro);
}

.welcome-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(155, 34, 71, 0.3);
}

.welcome-footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Responsive adjustments for welcome screen */
@media (max-width: 768px) {
    .welcome-content {
        padding: 1.5rem 1rem;
    }

    .welcome-header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .welcome-logo-sener {
        width: 140px;
    }

    .welcome-logo-snien {
        width: 90px;
    }

    .welcome-instructions {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }
}

/* Node labels for map markers */
.leaflet-tooltip.node-label {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    /* Increased for better visibility */
    font-weight: 700;
    color: #1f7a62;
    /* Kept the green color */
    box-shadow: none;
    backdrop-filter: none;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 3px #fff;
    /* White outline */
}

.leaflet-tooltip.node-label::before {
    border-top-color: rgba(155, 34, 71, 0.3);
}

/* Marker Cluster Styles - Themed */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
    z-index: 650 !important;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    line-height: 30px;
    color: #ffffff;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

/* State and GCR Tooltips with Enhanced Visibility */
.leaflet-tooltip.state-tooltip,
.leaflet-tooltip.gcr-tooltip {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 2px solid var(--color-verde-profundo) !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--color-verde-profundo) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(8px);
}

.leaflet-tooltip.state-tooltip::before,
.leaflet-tooltip.gcr-tooltip::before {
    border-top-color: var(--color-verde-profundo) !important;
}

/* Custom electricity marker icon */
.electricity-marker-icon {
    background: transparent !important;
    border: none !important;
    z-index: 650 !important;
}

.electricity-marker-icon img {
    display: block;
    width: 32px;
    height: 32px;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

/* Small clusters */
.marker-cluster-small {
    background-color: rgba(36, 164, 122, 0.5);
}

.marker-cluster-small div {
    background-color: rgba(36, 164, 122, 0.8);
}

/* Medium clusters */
.marker-cluster-medium {
    background-color: rgba(155, 34, 71, 0.6);
}

.marker-cluster-medium div {
    align-items: flex-start;
    background: transparent;
    /* No background on item */
    padding: 0;
}

.instruction-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--color-gobmx-guinda);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(155, 34, 71, 0.2);
}

.instruction-content h3 {
    color: var(--color-text);
    font-size: 1rem;
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.instruction-content p {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.welcome-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    background: var(--color-gobmx-guinda);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(155, 34, 71, 0.3);
}

.welcome-btn i {
    font-size: 1.1em;
}

.welcome-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 30px rgba(155, 34, 71, 0.4);
    background: var(--color-verde-claro);
}

.welcome-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(155, 34, 71, 0.3);
}

.welcome-footer {
    text-align: center;
    color: var(--color-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Responsive adjustments for welcome screen */
@media (max-width: 768px) {
    .welcome-content {
        padding: 1.5rem 1rem;
    }

    .welcome-header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .welcome-logo-sener {
        width: 140px;
    }

    .welcome-logo-snien {
        width: 90px;
    }

    .welcome-instructions {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }
}

/* Node labels for map markers */
.leaflet-tooltip.node-label {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    /* Increased for better visibility */
    font-weight: 700;
    color: #1f7a62;
    /* Kept the green color */
    box-shadow: none;
    backdrop-filter: none;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 3px #fff;
    /* White outline */
}

.leaflet-tooltip.node-label::before {
    border-top-color: rgba(155, 34, 71, 0.3);
}

/* Marker Cluster Styles - Themed */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
    z-index: 650 !important;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    line-height: 30px;
    color: #ffffff;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

/* State and GCR Tooltips with Enhanced Visibility */
.leaflet-tooltip.state-tooltip,
.leaflet-tooltip.gcr-tooltip {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 2px solid var(--color-verde-profundo) !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--color-verde-profundo) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(8px);
}

.leaflet-tooltip.state-tooltip::before,
.leaflet-tooltip.gcr-tooltip::before {
    border-top-color: var(--color-verde-profundo) !important;
}

/* Custom electricity marker icon */
.electricity-marker-icon {
    background: transparent !important;
    border: none !important;
    z-index: 650 !important;
}

.electricity-marker-icon img {
    display: block;
    width: 32px;
    height: 32px;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

/* Small clusters */
.marker-cluster-small {
    background-color: rgba(36, 164, 122, 0.5);
}

.marker-cluster-small div {
    background-color: rgba(36, 164, 122, 0.8);
}

/* Medium clusters */
.marker-cluster-medium {
    background-color: rgba(155, 34, 71, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(155, 34, 71, 0.9);
}

/* Large clusters */
.marker-cluster-large {
    background-color: rgba(22, 34, 48, 0.7);
}

/* Hide labels when toggled off */
.hide-node-labels .node-label,
.hide-node-labels .region-label {
    display: none !important;
}

/* Region Label Styling */
.region-label {
    background: transparent !important;
    border: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.region-label span {
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    text-shadow: 0 0 4px #000000, 0 0 4px #000000;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
    pointer-events: none;
}

/* Estilo para el "efecto padre" de los pol�gonos de regi�n */
.region-polygon {
    transition: filter 0.3s ease;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

.region-polygon:hover {
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5));
}

/* ===== TIPOGRAFÍA INSTITUCIONAL (GobMX) ===== */

/* Títulos principales */
h1 {
    font-family: var(--font-family-body);
    font-size: var(--font-size-h1);
    color: var(--color-gobmx-guinda);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
}

h2 {
    font-family: var(--font-family-body);
    font-size: var(--font-size-h2);
    color: var(--color-gobmx-guinda);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--color-gobmx-guinda);
    padding-bottom: var(--spacing-xs);
    line-height: 1.3;
}

h3 {
    font-family: var(--font-family-body);
    font-size: var(--font-size-h3);
    color: var(--color-gobmx-verde);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
}

h4 {
    font-family: var(--font-family-body);
    font-size: var(--font-size-h4);
    color: var(--color-gobmx-dorado);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    line-height: 1.4;
}

/* Párrafos */
p {
    font-family: var(--font-family-body);
    color: var(--color-text-primary);
    line-height: 1.6;
}

/* Enlaces */
a {
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 14px;
    /* Increased for better visibility */
    font-weight: 700;
    color: #1f7a62;
    /* Kept the green color */
    box-shadow: none;
    backdrop-filter: none;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 3px #fff;
    /* White outline */
}

.leaflet-tooltip.node-label::before {
    border-top-color: rgba(155, 34, 71, 0.3);
}

/* Marker Cluster Styles - Themed */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
    z-index: 650 !important;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font-size: 12px;
    line-height: 30px;
    color: #ffffff;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
}

/* State and GCR Tooltips with Enhanced Visibility */
.leaflet-tooltip.state-tooltip,
.leaflet-tooltip.gcr-tooltip {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 2px solid var(--color-verde-profundo) !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--color-verde-profundo) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(8px);
}

.leaflet-tooltip.state-tooltip::before,
.leaflet-tooltip.gcr-tooltip::before {
    border-top-color: var(--color-verde-profundo) !important;
}

/* Custom electricity marker icon */
.electricity-marker-icon {
    background: transparent !important;
    border: none !important;
    z-index: 650 !important;
}

.electricity-marker-icon img {
    display: block;
    width: 32px;
    height: 32px;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

/* Small clusters */
.marker-cluster-small {
    background-color: rgba(36, 164, 122, 0.5);
}

.marker-cluster-small div {
    background-color: rgba(36, 164, 122, 0.8);
}

/* Medium clusters */
.marker-cluster-medium {
    background-color: rgba(155, 34, 71, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(155, 34, 71, 0.9);
}

/* Large clusters */
.marker-cluster-large {
    background-color: rgba(22, 34, 48, 0.7);
}

/* Hide labels when toggled off */
.hide-node-labels .node-label,
.hide-node-labels .region-label {
    display: none !important;
}

/* Region Label Styling */
.region-label {
    background: transparent !important;
    border: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.region-label span {
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    text-shadow: 0 0 4px #000000, 0 0 4px #000000;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
    pointer-events: none;
}

/* Estilo para el "efecto padre" de los polgonos de regin */
.region-polygon {
    transition: filter 0.3s ease;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

.region-polygon:hover {
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5));
}

/* ===== TIPOGRAFÍA INSTITUCIONAL (GobMX) ===== */

/* Títulos principales */
h1 {
    font-family: var(--font-family-body);
    font-size: var(--font-size-h1);
    color: var(--color-gobmx-guinda);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
}

h2 {
    font-family: var(--font-family-body);
    font-size: var(--font-size-h2);
    color: var(--color-gobmx-guinda);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--color-gobmx-guinda);
    padding-bottom: var(--spacing-xs);
    line-height: 1.3;
}

h3 {
    font-family: var(--font-family-body);
    font-size: var(--font-size-h3);
    color: var(--color-gobmx-verde);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
}

h4 {
    font-family: var(--font-family-body);
    font-size: var(--font-size-h4);
    color: var(--color-gobmx-dorado);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    line-height: 1.4;
}

/* Párrafos */
p {
    font-family: var(--font-family-body);
    color: var(--color-text-primary);
    line-height: 1.6;
}

/* Enlaces */
a {
    color: var(--color-gobmx-guinda);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-button-hover);
    text-decoration: underline;
}

/* ===== ESTILOS PARA POPUP DE PRESAS (Elegante) ===== */
.presa-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.presa-popup .leaflet-popup-content {
    margin: 0;
    width: 320px !important;
    line-height: 1.5;
}

/* Ajustar posición del popup para que no se encime con el marcador */
.leaflet-popup {
    margin-bottom: 20px !important;
}

.leaflet-popup-content-wrapper {
    pointer-events: auto;
}

.presa-popup .leaflet-popup-tip {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.presa-popup-header {
    background: white;
    padding: 18px 24px;
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

.presa-popup-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--color-gobmx-guinda) 0%, var(--color-gobmx-verde) 100%);
}

.presa-popup-title {
    margin: 0;
    font-family: var(--font-family-headings);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.3;
}

.presa-popup-subtitle {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--color-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.presa-popup-body {
    padding: 20px 24px;
    background: #ffffff;
}

.presa-popup-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
}

.presa-popup-row:last-child {
    margin-bottom: 0;
}

.presa-popup-icon {
    color: var(--color-gobmx-verde);
    font-size: 1.2rem;
    margin-top: -2px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.presa-popup-data {
    flex: 1;
}

.presa-popup-label {
    display: block;
    font-size: 0.7rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    font-weight: 700;
}

.presa-popup-value {
    display: block;
    font-size: 0.95rem;
    color: var(--color-text-primary);
    font-weight: 500;
}

.presa-popup-footer {
    padding: 16px 24px;
    background: var(--color-surface-soft);
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.presa-popup-footer i {
    color: var(--color-gobmx-guinda);
    margin-right: 6px;
}

/* ===== ICONO PERSONALIZADO DE PRESAS ===== */
.custom-presa-icon {
    background: transparent !important;
    border: none !important;
}

.custom-presa-icon img {
    display: block;
    transition: transform 0.2s ease;
}

.custom-presa-icon:hover img {
    transform: scale(1.1);
}