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

body {
    font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    text-align: center;
}

header h1 {
    font-size: 1.3em;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.subtitle {
    display: none;
}

.location-nav {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 0;
    flex-wrap: wrap;
}

.location-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s;
    white-space: nowrap;
}

.location-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.location-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
    font-weight: bold;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.error {
    text-align: center;
    padding: 40px 20px;
    color: #d32f2f;
}

.error button {
    margin-top: 20px;
    padding: 10px 30px;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.error button:hover {
    background: #b71c1c;
}

#weather-container {
    padding: 1px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: scale(0.8);
    transform-origin: top left;
    width: 125%;
    /* Compensate for shrink to fill width */
    margin-bottom: -20%;
    /* Reduce bottom gap caused by scaling height */
}

/* Weather forecast styles */
#weather-container .forecast-compact-wrapper {
    background: transparent;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: none;
}

#weather-container .graph-headline-compact {
    font-size: 1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #667eea;
}

footer {
    background: #f5f5f5;
    padding: 10px 15px;
    text-align: center;
    color: #666;
    border-top: 1px solid #ddd;
}

footer p {
    margin: 3px 0;
    font-size: 0.9em;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

#refresh-btn {
    margin-top: 15px;
    padding: 10px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

#refresh-btn:hover {
    background: #764ba2;
}

#refresh-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    header {
        padding: 12px 15px;
    }

    header h1 {
        font-size: 1.2em;
        margin-bottom: 3px;
    }

    .subtitle {
        font-size: 0.7em;
        margin-bottom: 10px;
    }

    .location-nav {
        gap: 5px;
        margin-top: 8px;
    }

    .location-btn {
        padding: 5px 10px;
        font-size: 0.75em;
    }

    .container {
        border-radius: 8px;
    }

    #weather-container {
        padding: 10px;
    }
}

/* Ensure Highcharts are responsive */
.highcharts-container {
    width: 100% !important;
    height: auto !important;
}

/* Make chart containers scrollable on mobile */
#weather-container [id*="graph"],
#weather-container [id*="_graph"],
#weather-container [data-highcharts-chart] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
}

@media (max-width: 768px) {

    /* Enable horizontal scrolling for charts on mobile */
    #weather-container [id*="graph"],
    #weather-container [id*="_graph"],
    #weather-container [data-highcharts-chart] {
        min-width: 900px !important;
        /* Ensure charts are wide enough to require scrolling */
        overflow-x: hidden;
        /* Parent handles scroll */
    }

    /* Reduce padding to fit more content */
    body {
        padding: 2px;
    }

    header {
        padding: 8px 10px;
    }

    header h1 {
        font-size: 1.1em;
        margin-bottom: 6px;
    }

    #weather-container {
        padding: 8px !important;
    }

    #weather-container .forecast-compact-wrapper {
        padding: 6px !important;
        margin-bottom: 6px !important;
    }

    #weather-container .graph-headline-compact {
        font-size: 0.85em !important;
        margin-bottom: 5px !important;
        padding-bottom: 4px !important;
    }

    footer {
        padding: 8px 10px;
    }

    footer p {
        margin: 2px 0;
        font-size: 0.8em;
    }

    #refresh-btn {
        margin-top: 8px;
        padding: 6px 15px;
        font-size: 0.85em;
    }
}