html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: rgb(11, 59, 56);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-family: "Changa", sans-serif;
}

header {
    background-color: rgb(11, 59, 56);
    color: white;
    padding: 10px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 35px;
    width: auto;
}

h1 {
    font-size: 2.2rem;
    line-height: 1;
    padding: 5px;
}

#map-container {
    flex-grow: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

#map {
    height: 100%;
    width: 100%;
}

.leaflet-control-scale {
    bottom: -5px;
    left: 5px;
    font-family: "Changa", sans-serif;
}

footer {
    background-color: rgb(11, 59, 56);
    color: white;
    padding: 4px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

footer a,
header a {
    color: rgb(208, 113, 38);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

footer a:hover,
header a:hover {
    color: #e29b64;
}

.leaflet-popup-content {
    font-family: "Changa", sans-serif;
    font-size: 14px;
    color: #333;
    margin: 8px 12px;
}

.leaflet-popup-content b {
    font-weight: bold;
    color: #000;
}

#year-control {
    position: absolute;
    top: 70px;
    right: 10px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    font-family: "Changa", sans-serif;
    max-height: 70vh;
    overflow-y: auto;
    max-width: 200px;
}

#year-control label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.year-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.year-2019 { background-color: #23bdb4; }
.year-2020 { background-color: #23bd66; }
.year-2021 { background-color: #bdb423; }
.year-2022 { background-color: #bd237a; }
.year-2023 { background-color: #bd232d; }
.year-2024 { background-color: #bd6623; }
.year-2025 { background-color: #237abd; }
.year-2026 { background-color: #6623bd; }

#year-control input:checked + .year-color {
    transform: scale(1.3);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

#year-control input {
    margin-right: 5px;
    cursor: pointer;
}

/* ========== CUSTOM CHECKBOX STYLES ========== */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgb(11, 59, 56);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    margin: 0;
    background-color: white;
}

input[type="checkbox"]:hover {
    transform: scale(1.1);
}

input[type="checkbox"]:checked {
    background-color: rgb(208, 113, 38);
    border-color: rgb(208, 113, 38);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 11px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

/* Specific styling for year filter checkboxes to maintain their original behavior */
#year-control input[type="checkbox"] {
    width: auto;
    height: auto;
    appearance: auto;
    -webkit-appearance: auto;
    border: none;
    border-radius: 0;
    background-color: transparent;
    accent-color: rgb(11, 59, 56);
}

#year-control input[type="checkbox"]:hover {
    transform: none;
}

#year-control input[type="checkbox"]:checked {
    background-color: transparent;
    border: none;
}

#year-control input[type="checkbox"]:checked::after {
    content: none;
}
/* ========== END CUSTOM CHECKBOX STYLES ========== */

.custom-button {
    background-color: rgba(255, 255, 255);
    background-image: url("Images/globe_icon.png");
    background-size: 72%;
    background-repeat: no-repeat;
    background-position: center;
    background-clip: padding-box;
    border: solid rgba(0, 0, 0, 0.2) 2px;
    border-radius: 4px;
    width: 33px;
    height: 33px;
    top: -5px;
    left: 0;
    cursor: pointer;
}

#splash-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    pointer-events: all;
    padding: 20px;
    box-sizing: border-box;
}

#splash-modal.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.splash-page {
    display: none;
    width: 100%;
}

.splash-page.active {
    display: block;
}

.splash-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    gap: 15px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-button {
    background-color: transparent;
    color: rgb(11, 59, 56);
    border: 2px solid rgb(11, 59, 56);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.nav-button:hover {
    background-color: rgb(11, 59, 56);
    color: white;
    transform: scale(1.1);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-button {
    font-family: "Changa", sans-serif;
    background-color: rgb(11, 59, 56);
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    margin-top: -20px;
    margin-bottom: 5px;
    display: block;
}

.primary-button:hover {
    background-color: rgb(17, 92, 87);
    transform: scale(1.05);
}

.splash-content {
    position: relative;
    animation: fadeInUp 0.5s ease-out;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    margin: 0 auto;
    padding-bottom: 80px;
    box-sizing: border-box;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-content h1 {
    color: rgb(11, 59, 56);
    font-family: "Changa", sans-serif;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.splash-text {
    text-align: center;
    margin: 1rem 0;
    line-height: 1.6;
    font-family: "Changa", sans-serif;
    font-size: 1rem;
    padding: 0 10px;
}

.splash-text a {
    color: rgb(208, 113, 38);
    text-decoration: none;
}

.splash-text a:hover {
    text-decoration: underline;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    padding: 5px;
    line-height: 1;
    z-index: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    color: #000;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
}

.gallery-button {
    background-color: rgb(11, 59, 56);
    color: white;
    font-family: "Changa", sans-serif;
    border: none;
    padding: 2px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 6px;
}

.gallery-button:hover {
    background-color: rgb(17, 92, 87);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
}

.close-gallery,
.close-stories {
    position: absolute;
    right: 10px;
    top: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    color: #333;
}

.close-gallery:hover {
    color: #000;
    background-color: white;
    border-radius: 50%;
}

#gallery-images {
    text-align: center;
    margin: 0;
}

#gallery-images img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.gallery-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
    padding: 10px;
    padding-bottom: 0;
}

.gallery-nav button {
    padding: 8px 16px;
    font-family: "Changa", sans-serif;
    background-color: rgb(11, 59, 56);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.gallery-nav button:hover {
    background-color: rgb(17, 92, 87);
}

.gallery-nav button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#photo-counter,
#story-counter {
    font-weight: bold;
}

.photo-container {
    text-align: center;
    font-family: "Changa", sans-serif;
    margin: 0;
}

.photo-container img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin-bottom: 0;
}

.photo-caption {
    color: #666;
    font-size: 14px;
    padding: 0;
    margin-top: 0;
}

.stories-button {
    background-color: rgb(208, 113, 38);
    color: white;
    font-family: "Changa", sans-serif;
    border: none;
    padding: 2px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 6px;
    margin-left: 5px;
}

.stories-button:hover {
    background-color: rgb(226, 155, 100);
}

#stories-modal .modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 700px;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
}

.story-container h4 {
    color: rgb(11, 59, 56);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.story-content {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid rgb(208, 113, 38);
    margin-bottom: 15px;
    white-space: pre-line;
    max-height: 400px;
    overflow-y: auto;
}

/* Updated Stats Panel to match layer controls */
#stats-control {
    position: absolute;
    bottom: 85px;
    left: 10px;
    z-index: 1000;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    font-family: "Changa", sans-serif;
    max-width: 260px;
    min-width: 210px;
    transition: all 0.3s ease;
    pointer-events: auto;
    overflow: hidden;
}

#stats-control.minimized {
    min-width: auto;
    width: auto;
}

#stats-control.minimized .stats-content {
    display: none;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    background-color: white;
    font-family: "Changa", sans-serif;
    font-size: 12px;
    font-weight: bold;
    transition: background-color 0.2s;
    gap: 10px;
}

.stats-header:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.stats-header strong {
    color: rgb(11, 59, 56);
    font-size: 12px;
    font-weight: bold;
}

.stats-toggle {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    color: rgb(11, 59, 56);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s;
    font-family: "Changa", sans-serif;
}

.stats-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.stats-content {
    padding: 8px 12px;
    border-top: 1px solid #eee;
    background-color: white;
}

#top-cities-list {
    max-height: 300px;
    overflow-y: auto;
}

.city-rank {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 11px;
}

.city-rank:last-child {
    border-bottom: none;
}

.city-rank .rank-number {
    font-weight: bold;
    color: rgb(208, 113, 38);
    min-width: 25px;
    font-size: 11px;
}

.city-rank .city-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    color: #333;
}

.city-rank .show-count {
    font-weight: bold;
    background-color: rgb(11, 59, 56);
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 10px;
    min-width: 30px;
    text-align: center;
}

/* Layer Control Panel */
.layer-control-container {
    top: -116px;
    left: 38px;
    background-color: white;
    border: solid rgba(0, 0, 0, 0.2) 2px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.layer-toggle-btn {
    padding: 5px 10px;
    font-family: "Changa", sans-serif;
    font-size: 12px;
    font-weight: bold;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.layer-toggle-btn:hover {
    transform: scale(1.02);
    opacity: 0.95;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .splash-content {
        padding: 1rem;
        padding-bottom: 70px;
        margin: 10px;
    }

    .splash-content h1 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }

    .splash-text {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .primary-button {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }

    .nav-button {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .splash-navigation {
        bottom: 15px;
        gap: 10px;
    }

    body {
        height: 100%;
        min-height: -webkit-fill-available;
    }

    #map-container {
        height: calc(100vh - 120px);
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 4px;
    }

    .header-logo {
        height: 25px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .leaflet-control-minimap {
        margin-bottom: 10px;
    }

    .leaflet-control-scale {
        bottom: -5px;
        left: 0;
        font-family: "Changa", sans-serif;
    }

    #year-control {
        top: 140px;
        right: 5px;
        max-width: 150px;
        padding: 8px;
        font-size: 14px;
    }

    #stats-control {
        bottom: 120px;
        left: 5px;
        max-width: 200px;
        min-width: 175px;
    }

    .stats-header {
        padding: 6px 8px;
    }
    
    .stats-content {
        padding: 6px 8px;
    }
    
    .city-rank {
        padding: 4px 0;
        font-size: 10px;
    }
    
    .city-rank .rank-number {
        font-size: 10px;
        min-width: 20px;
    }
    
    .city-rank .city-name {
        font-size: 10px;
    }
    
    .city-rank .show-count {
        font-size: 9px;
        min-width: 25px;
        padding: 1px 4px;
    }
    
    .stats-toggle {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }

    .layer-toggle-btn {
        padding: 3px 6px;
        font-size: 10px;
    }
    
    input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
}

.leaflet-bottom {
    padding-bottom: 10px;
}