/* Variables */
:root {
    --primary-color: #032C4C;
    --text-color: #000000;
    --light-bg: #FFFFFF;
    --light-gray: #F5F5F5;
    --border-color: #E0E0E0;
    --operational-color: #C1DD5D;
    --planned-color: #099CEE;
    --abandoned-color: #032C4C;
}

/* Base Styles - Overriding Bootstrap */
body {
    font-family: 'Lora', serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--light-bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

p {
    margin-bottom: 1rem;
    text-align: justify;
}

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

/* Header */
.header {
    background-color: var(--primary-color);
    padding: 1.5rem 0;
    color: white;
}

.header-content {
    display: flex;
    align-items: center;
}

.logo {
    max-height: 80px;
}

.header-title {
    color: white;
    margin-left: 20px;
    font-size: 1.8rem;
    margin-bottom: 0;
    line-height: 1.3;
    max-width: 800px;
}

/* Sections */
.section {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border-color);
}

.section:last-child {
    border-bottom: none;
}

.section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.section h3 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

/* Images */
.image-container {
    margin: 2rem 0;
    text-align: center;
}

.section-image {
    max-width: 60%;
    max-height: 500px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

/* Specific styling for the flowchart image */
.flowchart-image {
    max-width: 90%;
    max-height: 700px;
}

.image-caption {
    margin-top: 0.5rem;
    font-style: italic;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
    width: 100%;
}

/* Map */
.map-container {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    width: 100%;
    max-height: 600px; /* Limit height on large screens */
}

/* Ensure Leaflet container fills the space */
.leaflet-container {
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
}

/* Leaflet controls and attribution */
.leaflet-control-container {
    z-index: 1000;
}

.leaflet-control-attribution {
    font-size: 10px !important;
    padding: 0 5px !important;
    background-color: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    bottom: 0 !important;
    right: 0 !important;
    position: absolute !important;
}

.leaflet-bottom {
    bottom: 0 !important;
}

.leaflet-right {
    right: 0 !important;
}

/* Map Legend */
.map-legend {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
    line-height: 1.2;
    width: fit-content;
    margin: 0.5rem auto;
    display: flex;
    justify-content: center;
}

.map-legend div {
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
}

.map-legend div div {
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin: 0 0.5rem;
}

/* Legend Markers */
.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    border: 1px solid;
    opacity: 0.7;
    flex-shrink: 0;
}

.legend-marker.operational {
    background-color: var(--operational-color);
    border-color: var(--operational-color);
}

.legend-marker.planned {
    background-color: var(--planned-color);
    border-color: var(--planned-color);
}

.legend-marker.abandoned {
    background-color: var(--abandoned-color);
    border-color: var(--abandoned-color);
}

/* Partner Logos */
.partner-logos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.partner-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
}

.partner-logo {
    max-height: 100px;
    max-width: 100%;
    object-fit: contain;
}

/* Gallery */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

/* Image container to maintain square aspect ratio */
.gallery-image-container {
    width: 100%;
    position: relative;
    padding-bottom: 100%; /* Creates a 1:1 aspect ratio */
    overflow: hidden;
}

.gallery-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the container while maintaining aspect ratio */
}

/* News Section */
.news-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.news-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.news-item h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
}

.news-item p {
    margin-bottom: 0;
}

.news-item a {
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: underline;
}

.news-item a:hover {
    color: #0056b3;
}

/* References */
.reference {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary-color);
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 2rem;
}

.footer p, .footer ul, .footer li {
    text-align: center;
    color: white;
}

.footer a {
    font-weight: 600;
    color: white;
}

.footer a:hover {
    color: rgba(255, 255, 255, 0.8);
}

.contact-info {
    margin: 1.5rem 0;
}

.contact-info ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.contact-info li {
    margin-bottom: 0.5rem;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-title {
        margin-left: 0;
        margin-top: 1rem;
        font-size: 1.5rem;
    }

    .partner-logos {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .map-container {
        max-height: 400px;
    }

    .section-image {
        max-width: 80%;
    }

    .flowchart-image {
        max-width: 90%;
    }

    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .map-legend {
        flex-wrap: wrap;
    }

    .map-legend div {
        flex-wrap: wrap;
        justify-content: center;
    }

    .map-legend div div {
        margin: 0.2rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 2rem 0;
    }

    .section h2 {
        font-size: 1.75rem;
    }

    .partner-logos {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .map-container {
        height: 300px;
    }

    .section-image {
        max-width: 100%;
    }

    .gallery-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .map-legend {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
        width: 100%;
        flex-direction: column;
    }

    .map-legend div {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    .map-legend div div {
        margin: 0.2rem 0.5rem;
    }
}
