/* ==========================================================================
   Global Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    padding: 1vh 1vw;
    color: #212529;
}

/* ==========================================================================
   Container Component
   ========================================================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.header {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: white;
    padding: 1.5vh 3vw;
    text-align: center;
    border-bottom: 3px solid #6c757d;
}

.header h1 {
    font-size: clamp(1.4rem, 2.5vh, 2rem); 
    font-weight: 600;
    margin-bottom: 0.5vh;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.header p {
    font-size: clamp(0.8rem, 1.2vh, 1rem);
    opacity: 0.9;
    color: #adb5bd;
    font-weight: 400;
}

/* ==========================================================================
   Header Info Section Component
   ========================================================================== */
.header-info-section {
    margin: 0;
    padding: 0.5vh 3vw 0.5vh 0.5vw;
    background: white;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2vw;
}

.header-left-info {
    flex: 1;
}

.header-update-line {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.3vh;
}

.header-stats-line {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: normal;
    margin-bottom: 0.8vh;
}

.header-stats-line strong:first-of-type {
    color: #343a40; 
}

.header-stats-line strong:not(:first-of-type) {
    color: #0072bd;
}

.header-downloads {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 0;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

#last-updated-text {
    color: #0072bd;
    font-weight: 600;
}

/* ==========================================================================
   Download Button Header Component
   ========================================================================== */
.download-button-header {
    background: linear-gradient(135deg, #0072bd 0%, #005a96 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.download-button-header:hover {
    background: linear-gradient(135deg, #005a96 0%, #004678 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 114, 189, 0.3);
}

/* ==========================================================================
   Tab Navigation Component
   ========================================================================== */
.tab-navigation {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: left;
    gap: 0;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 1vh 2vw;
    font-size: clamp(0.85rem, 1.2vh, 0.95rem);
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-button:hover {
    background: rgba(0, 114, 189, 0.05);
    color: #0072bd;
}

.tab-button.active {
    color: #0072bd;
    border-bottom-color: #0072bd;
    background: rgba(0, 114, 189, 0.08);
}

/* ==========================================================================
   Tab Content Component
   ========================================================================== */
.content {
    padding: 1.5vh 3vw 2.5vh 3vw;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==========================================================================
   Countries Control Component
   ========================================================================== */
.countries-control {
    margin-bottom: 0px;
}

.countries-control-box {
    background: white; 
    border: 1px solid white;
    border-radius: 10px;
    padding: 0.5vh 0.5vw;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1.5vw;
    margin-bottom: 0.8vh;
}

.countries-control-box .country-dropdown {
    flex: 1;
    max-width: 500px;
    min-width: 400px;
}

.countries-control-box .estimation-method::before {
    content: '';
    width: 1px;
    height: 40px;
    background: #dee2e6;
    margin-right: 15px;
}

.countries-control-box .estimation-method {
    flex: 0 0 auto;
}

/* ==========================================================================
   Country Dropdown Component
   ========================================================================== */
.country-dropdown {
    position: relative;
    width: 100%;
    z-index: 1000;
    margin-bottom: 0;
}

.dropdown-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1001;
    min-height: 40px;
}

.dropdown-selected:hover {
    border-color: #0072bd;
}

.dropdown-selected.open {
    border-color: #0072bd;
    box-shadow: 0 0 0 3px rgba(0, 114, 189, 0.1);
    border-radius: 6px 6px 0 0;
}

.dropdown-selected svg {
    transition: transform 0.3s ease;
}

.dropdown-selected.open svg {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #0072bd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dropdown-menu label:last-child {
    border-bottom: none;
}

.dropdown-menu label:hover {
    background-color: rgba(0, 114, 189, 0.1);
}

.dropdown-menu input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #0072bd;
}

/* Enhanced countries box z-index */
.control-box:first-child {
    z-index: 1000;
    position: relative;
}

/* ==========================================================================
   Estimation Method Component
   ========================================================================== */
.estimation-method {
    display: flex;
    flex-direction: row;
    gap: 12px;
    text-align: left;
    align-items: center;
}

.estimation-method label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 6px;
    white-space: nowrap;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.estimation-method label:hover {
    color: #0072bd;
    background-color: rgba(0, 114, 189, 0.05);
}

.estimation-method input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #0072bd;
}

.estimation-method input[type="radio"]:disabled + span {
    color: #6c757d;
    opacity: 0.6;
}

.estimation-method label:has(input:disabled) {
    cursor: not-allowed;
    color: #6c757d;
    opacity: 0.6;
}

/* ==========================================================================
   Chart Container Component
   ========================================================================== */
.chart-container {
    position: relative;
    width: 100%;
    height: clamp(280px, 45vh, 425px);
    margin: 1.2vh 0 0 0;
    background: white;
    border-radius: 15px 15px 0 0;
    padding: 1.5vh 1.5vw;
    /*box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);*/
}

/* ==========================================================================
   Chart Error Message Component
   ========================================================================== */
.chart-error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 40px;
}

.chart-error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.chart-error-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

.chart-error-text {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 25px;
    line-height: 1.4;
}

/* ==========================================================================
   Loading Component
   ========================================================================== */
.loading {
    text-align: center;
    padding: 80px 20px;
    color: #666;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0072bd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 25px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Error Component
   ========================================================================== */
.error {
    background: linear-gradient(135deg, #fee 0%, #fdd 100%);
    border: 2px solid #fcc;
    color: #c66;
    padding: 25px;
    border-radius: 15px;
    margin: 20px 0;
    font-weight: 500;
}

/* ==========================================================================
   Time Range Container Component
   ========================================================================== */
.time-range-container {
    background: solid white;
    padding: 0.8vh 2vw;
    border-radius: 0 0 15px 15px;
    margin: 0 0 1.5vh 0;
}

.range-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 15px;
}

.range-slider-container {
    position: relative;
    padding: 5px 0;
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    /*background: linear-gradient(to right, #ddd 0%, #ddd 100%);*/
    outline: none;
    position: absolute;
    top: 15px;
    pointer-events: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0072bd 0%, #005a96 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    transition: transform 0.2s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0072bd 0%, #005a96 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

#time-range-start {
    background: linear-gradient(to right, 
        #ddd 0%, 
        #ddd var(--start-percent, 0%), 
        #0072bd var(--start-percent, 0%), 
        #0072bd var(--end-percent, 100%), 
        #ddd var(--end-percent, 100%), 
        #ddd 100%);
    z-index: 1;
}

#time-range-end {
    background: transparent;
    z-index: 2;
}

.range-display {
    text-align: center;
    margin-top: 4vh;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.range-display span {
    margin: 0 8px;
}

.range-display span:nth-child(odd) {
    color: #0072bd;
    font-weight: 700;
}

/* ==========================================================================
   Stats Components
   ========================================================================== */
.control-box-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.control-box-content {
    font-size: 1rem;
    color: #212529;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0072bd;
    margin-bottom: 4px;
}

.stat-range {
    font-size: 0.85rem;
    color: #6c757d;
}

.stat-period {
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 8px;
}

.multi-country-stats {
    max-height: 120px;
    overflow-y: auto;
    text-align: left;
}

.country-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.country-stat-row:last-child {
    border-bottom: none;
}

.country-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.country-value {
    font-weight: 700;
    color: #0072bd;
    font-size: 0.9rem;
}

/* ==========================================================================
   Download Button Component
   ========================================================================== */
.download-button {
    background: linear-gradient(135deg, #0072bd 0%, #005a96 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.download-button:hover {
    background: linear-gradient(135deg, #005a96 0%, #004678 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 114, 189, 0.3);
}

.download-button svg {
    width: 16px;
    height: 16px;
}

.downloads-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.download-row-full {
    display: flex;
    justify-content: center;
    width: 100%;
}

.download-row-split {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.download-button-compact {
    font-size: 0.8rem;
    padding: 6px 12px;
    display: inline-flex;
}

/* ==========================================================================
   FAQ Component
   ========================================================================== */
.faq-simple-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    -webkit-text-size-adjust: 100%;  
    text-size-adjust: 100%;   
}

.faq-main-title {
    font-variant: small-caps;
    color: #343a40;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 35px;
    text-align: center;
    border-bottom: 2px solid #0072bd;
    padding-bottom: 12px;
}

.faq-simple-item {
    margin-bottom: 30px;
}

.faq-simple-question {
    font-weight: 700;
    color: #343a40;
    margin-bottom: 6px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.faq-simple-answer {
    color: #6c757d;
    line-height: 1.5;
    font-size: 0.8rem;
    margin-left: 0;
    text-align: justify;
}

.faq-simple-answer a {
    color: #0072bd;
    text-decoration: none;
}

.faq-simple-answer a:hover {
    text-decoration: underline;
}

.faq-figure {
    margin: 20px 0;
    text-align: center;
}

.faq-image {
    max-width: 100%;
    height: auto;
    border: none;
    border-radius: 8px;
    box-shadow: none;
    margin-bottom: 10px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.faq-image:hover {
    opacity: 0.9;
}

.faq-caption {
    font-size: 0.8rem;
    color: #6c757d;
    font-style: italic;
    line-height: 1.4;
    max-width: 800px;
    margin: 0 auto;
    text-align: justify;
}

/* ==========================================================================
   Image Modal Styles
   ========================================================================== */
.image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.image-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
}

.image-modal-close:hover {
    opacity: 0.7;
}

/* ==========================================================================
   Footer Component
   ========================================================================== */
.site-footer {
    background: transparent;
    color: #6c757d;
    padding: 20px 20px 30px 20px;
    text-align: center;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-copyright {
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: #495057;
}

.footer-copyright a {
    color: #0072bd;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-contact {
    font-size: 0.8rem;
    color: #6c757d;
}

.footer-contact a {
    color: #0072bd;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-contact a:hover {
    color: #005a96;
    text-decoration: underline;
}




/* ==========================================================================
   MOBILE STYLES - MUST BE AT THE END
   ========================================================================== */
@media (max-width: 768px) {
    .header {
        padding: 25px 20px;
    }
    
    .header h1 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    
    .header p {
        font-size: 0.95rem;
        line-height: 1.3;
    }

    .header-info-section {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 8px 15px 8px 15px;
    }
    
    .header-stats-line {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .header-update-line {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    
    .header-downloads {
        gap: 6px;
        justify-content: flex-start;
    }
    
    .download-button-header {
        padding: 4px 8px;
        font-size: 0.7rem;
        gap: 4px;
    }

    .download-button-header svg {
        width: 12px;
        height: 12px;
    }
    
    .countries-control-box {
        padding: 8px;
        gap: 20px;
        margin-bottom: 15px;
    }
    
    .countries-control-box .estimation-method::before {
        display: none;
    }

    .dropdown-selected {
        padding: 10px 12px;
        min-height: 40px;
        font-size: 0.9rem;
    }

    .estimation-method {
        gap: 10px;
        flex-direction: row;
        justify-content: center;
    }
    
    .estimation-method label {
        font-size: 0.8rem;
        padding: 4px 6px;
        min-width: 55px;
        text-align: center;
    }
    .content {
        padding: 15px 20px 25px 20px;
    }
    
    .chart-container {
        height: 350px;
        padding: 12px;
    }
    
    .time-range-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .range-display {
        margin-top: 25px;
        font-size: 0.85rem;
    }

    .tab-button {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .last-update-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .top-downloads {
        align-self: stretch;
        justify-content: center;
    }
    
    .download-button-small {
        flex: 1;
        justify-content: center;
        max-width: 100px;
    }

    .faq-main-title {
        font-size: 1.4rem;
        margin-bottom: 25px;
        text-align: left;
        border-bottom: 1px solid #0072bd;
        padding-bottom: 10px;
    }
    
    .faq-simple-container {
        padding: 20px 15px;
    }
    
    .faq-simple-item {
        margin-bottom: 25px;
    }
    
    .faq-simple-question {
        font-size: 0.95rem;
        line-height: 1.3;
        margin-bottom: 6px;
        text-align: left;
    }
    
    .faq-simple-answer {
        font-size: 0.85rem;
        line-height: 1.5;
        text-align: left;
    }
    
    .faq-figure {
        margin: 15px 0;
    }
    
    .faq-image {
        border-radius: 4px;
    }
    
    .faq-caption {
        font-size: 0.75rem;
        padding: 0 5px;
        text-align: left;
    }
}



@media (max-width: 480px) {
    .header {
        padding: 20px 15px;
    }
    
    .header h1 {
        font-size: 1.4rem;
        line-height: 1.2;
        margin-bottom: 6px;
    }
    
    .header p {
        font-size: 0.85rem;
        line-height: 1.25;
    }

    .header-info-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 6px 12px;
    }

    .header-downloads {
        justify-content: flex-start;
    }

    .header-stats-line {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    
    .header-update-line {
        font-size: 0.7rem;
        margin-bottom: 3px;
    }
    
    .countries-control-box {
        padding: 6px;
        gap: 15px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .countries-control-box .estimation-method::before {
        display: none;
    }

    .countries-control-box .country-dropdown {
        max-width: none;
        min-width: auto;
    }
    
    .dropdown-selected {
        padding: 8px 10px;
        min-height: 36px;
        font-size: 0.85rem;
    }
    
    .download-button-header {
        padding: 3px 6px;
        font-size: 0.65rem;
        gap: 3px;
    }

    .download-button-header svg {
        width: 10px;
        height: 10px;
    }

    .content {
        padding: 12px 15px 20px 15px;
    }
    
    .chart-container {
        height: 300px;
        margin: 15px 0 10px 0;
        padding: 10px;
    }
    
    .time-range-container {
        padding: 12px;
        margin: 12px 0;
    }
    
    .range-display {
        margin-top: 20px;
        font-size: 0.8rem;
    }
    
   .estimation-method {
        gap: 8px;
        flex-direction: row;
        justify-content: center;
    }
    
    .estimation-method label {
        font-size: 0.75rem;
        padding: 3px 5px;
        min-width: 50px;
        text-align: center;
    }

    .download-row-split {
        flex-direction: column;
        gap: 6px;
    }

    .faq-main-title {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }
    
    .faq-simple-container {
        padding: 15px 12px;
    }
    
    .faq-simple-question {
        font-size: 0.9rem;
    }
    
    .faq-simple-answer {
        font-size: 0.8rem;
    }
    
    .faq-caption {
        font-size: 0.7rem;
    }
}

@media (max-width: 768px) {
    .site-footer {
        padding: 15px 15px 25px 15px;
    }
    
    .footer-copyright {
        font-size: 0.8rem;
    }
    
    .footer-contact {
        font-size: 0.75rem;
    }
}


