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

:root {
    --bg: #0a0e1a;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --text: #e8eaf0;
    --text-muted: #8b90a0;
    --accent: #6c9fff;
    --accent-glow: rgba(108, 159, 255, 0.15);
    --warm: #ff9f6c;
    --cool: #6cccff;
    --rain: #5b9aff;
    --green: #6cffa0;
    --purple: #b06cff;
    --radius: 16px;
    --radius-sm: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 32px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent), var(--cool));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header h1 .icon {
    -webkit-text-fill-color: initial;
    font-size: 1.6rem;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
    align-items: center;
    justify-content: center;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 420px;
    min-width: 250px;
}

#citySearch {
    width: 100%;
    padding: 14px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: all 0.25s ease;
    backdrop-filter: blur(20px);
}

#citySearch:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--surface-hover);
}

#citySearch::placeholder {
    color: var(--text-muted);
}

.suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #161b2e;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    z-index: 100;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.suggestions.hidden {
    display: none;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--accent-glow);
}

.suggestion-item .country {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 6px;
}

/* Interval buttons */
.interval-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.interval-buttons button {
    padding: 10px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(20px);
}

.interval-buttons button:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.15);
}

.interval-buttons button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* Current weather */
.current-weather {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    margin-bottom: 28px;
    backdrop-filter: blur(20px);
}

.current-weather.hidden {
    display: none;
}

.current-main {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.current-temp {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weather-icon {
    font-size: 3.5rem;
    line-height: 1;
}

.temp-value {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -2px;
    background: linear-gradient(135deg, var(--warm), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.current-details h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.current-details p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.current-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 600;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-muted);
}

/* Charts */
.charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.charts.hidden {
    display: none;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(20px);
    transition: border-color 0.25s;
}

.chart-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 280px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .app {
        padding: 16px 12px 32px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        max-width: none;
    }

    .interval-buttons {
        justify-content: center;
    }

    .interval-buttons button {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .current-weather {
        padding: 20px;
    }

    .weather-icon {
        font-size: 2.5rem;
    }

    .temp-value {
        font-size: 2.5rem;
    }

    .current-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .chart-card {
        padding: 16px;
    }

    .chart-container {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .current-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
