/* ========================================
   Base Styles & Variables
   ======================================== */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ========================================
   Header
   ======================================== */

.header {
    background: #1a1a1a;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 40px;
    width: auto;
}


/* ========================================
   Page Title
   ======================================== */

.page-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 2rem auto 1rem;
    max-width: 1400px;
    padding: 0 2rem;
}

/* ========================================
   Map Section
   ======================================== */

.map-section {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.map-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.map-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    background-image: url('/static/img/map_back.jpg');
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.map-wrapper {
    min-height: 550px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#map {
    height: 550px;
    width: 550px;
    border-radius: var(--radius-md);
    border: none;
    outline: none;
    background: transparent !important;
}

.leaflet-container {
    border: none !important;
    outline: none !important;
    background: transparent !important;
}

.leaflet-tile-pane {
    background: transparent !important;
}

.leaflet-pane {
    background: transparent !important;
}

.leaflet-control-attribution {
    font-size: 7px !important;
    opacity: 0.3;
}

.info-panel {
    display: flex;
    flex-direction: column;
}

.subregion-info {
    padding: 1rem;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.subregion-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subregion-info .hint {
    color: var(--text-light);
    font-size: 0.9rem;
}

.municipios-list {
    flex: 1;
    overflow-y: auto;
    max-height: 350px;
}

.municipios-list h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.municipios-list ul {
    list-style: none;
}

.municipios-list li {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    background: rgba(249, 250, 251, 0.75);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: pointer;
}

.municipios-list li:hover,
.municipios-list li.active {
    background: rgba(37, 99, 235, 0.8);
    color: var(--white);
    transform: translateX(5px);
}

.municipios-list li.selected {
    background: var(--primary-color);
    color: var(--white);
    font-weight: 600;
}

/* Municipio Info Panel */
.municipio-info {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.municipio-info h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.municipio-info p {
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.5;
}

.municipio-desc-text {
    display: block;
    margin-bottom: 0.75rem;
}

.municipio-datos {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-light);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.municipio-datos strong {
    color: var(--text-color);
}

.hidden {
    display: none;
}

/* ========================================
   Projects Section
   ======================================== */

.projects-section {
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.projects-section h2 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.cards-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.project-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    min-width: 280px;
    max-width: 350px;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.project-card.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--white) 0%, #eff6ff 100%);
}

.card-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.project-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.card-summary {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Project Description Panel */
.project-description {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    min-height: 120px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border-top: 4px solid var(--primary-color);
}

.project-description.active {
    background: linear-gradient(135deg, var(--white) 0%, #f0fdf4 100%);
    border-top-color: var(--secondary-color);
}

.project-description .default-text {
    color: var(--text-light);
    text-align: center;
    font-style: italic;
}

/* Project Banner Container */
.project-banner-container {
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.project-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-banner-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.6) 100%);
}

.project-banner-container .banner-title,
h2.banner-title {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff !important;
    font-size: 2rem;
    font-weight: 700;
    /* Black border with gray outer glow */
    text-shadow: 
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        -2px -2px 0 #888,
        2px -2px 0 #888,
        -2px 2px 0 #888,
        2px 2px 0 #888,
        0 0 12px rgba(200,200,200,0.6);
    z-index: 1;
    text-align: center;
    width: 90%;
    -webkit-text-fill-color: #fff !important;
    margin: 0;
    padding: 0;
}

.project-description h4 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    text-align: center;
}

.project-description p {
    color: var(--text-color);
    line-height: 1.7;
    max-width: 900px;
    margin: 0 auto 2rem;
    text-align: justify;
}

/* Project Indicators */
.project-indicators {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    margin: 2rem auto;
    max-width: 1000px;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.indicator-card {
    text-align: center;
    min-width: 120px;
}

.indicator-value {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.indicator-label {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   View Map Button
   ======================================== */

.btn-view-map {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: fit-content;
    margin: 1.5rem auto;
    padding: 0.875rem 2rem;
    background: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-view-map:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-view-map svg {
    width: 18px;
    height: 18px;
}

/* ========================================
   Sponsors Ribbon
   ======================================== */

.sponsors-section {
    margin-top: 2rem;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.sponsors-section.active {
    opacity: 1;
    transform: translateY(0);
}

.sponsors-section h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sponsors-ribbon {
    overflow: hidden;
    background: var(--white);
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.sponsors-track {
    display: flex;
    align-items: center;
    gap: 4rem;
    animation: scroll-sponsors 20s linear infinite;
    width: max-content;
}

.sponsors-track img {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.sponsors-track img:hover {
    filter: grayscale(0%);
    opacity: 1;
}

@keyframes scroll-sponsors {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Pause animation on hover */
.sponsors-ribbon:hover .sponsors-track {
    animation-play-state: paused;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    background: var(--text-color);
    color: var(--white);
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

.footer p {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ========================================
   Leaflet Custom Markers
   ======================================== */

.custom-marker {
    background: var(--primary-color);
    border: 3px solid var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
}

.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
}

.leaflet-popup-content {
    margin: 0.75rem 1rem;
}

.popup-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.popup-count {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Subregion label styling */
.subregion-label {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.subregion-label::before {
    display: none;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 900px) {
    .map-container {
        grid-template-columns: 1fr;
    }
    
    .info-panel {
        order: -1;
    }
    
    .municipios-list {
        max-height: 200px;
    }
    
    .project-description {
        width: 95%;
        padding: 1.5rem;
    }
    
    .project-banner-container {
        height: 150px;
    }
    
    .banner-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 600px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .cards-container {
        flex-direction: column;
        align-items: center;
    }
    
    .project-card {
        min-width: 100%;
    }
    
    #map {
        height: 350px;
    }
}
