* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f3f6fb;
    --card: #ffffff;
    --text: #182033;
    --muted: #718096;
    --primary: #5146e5;
    --border: #e5e7eb;
}

body.dark {
    --bg: #0b1020;
    --card: #151c31;
    --text: #f5f7ff;
    --muted: #9ba6bd;
    --border: #29334d;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: 0.3s;
}

.container {
    max-width: 1250px;
    margin: auto;
    padding: 30px;
}

/* HEADER */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.small-title {
    color: var(--primary);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
}

h1 {
    font-size: 32px;
    margin-top: 5px;
}

.subtitle {
    color: var(--muted);
    margin-top: 5px;
}

#themeBtn {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
}

/* SEARCH */

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: var(--card);
    color: var(--text);
}

.search-box button {
    padding: 14px 18px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
}

.search-box .location-btn {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

/* ERROR */

#error {
    color: #dc2626;
    margin-bottom: 15px;
    font-weight: bold;
}

/* MAIN WEATHER */

.main-weather {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

.weather-main {
    grid-row: span 2;
    padding: 30px;
    border-radius: 25px;
    color: white;
    background: linear-gradient(
        135deg,
        #312e81,
        #5146e5,
        #7c3aed
    );

    box-shadow: 0 20px 45px rgba(79, 70, 229, 0.25);
}

.weather-main h2 {
    font-size: 34px;
    margin: 10px 0;
}

.weather-main > div:first-child span {
    background: rgba(255,255,255,0.15);
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.weather-icon {
    font-size: 70px;
    text-align: right;
    margin-top: -50px;
}

.temperature {
    font-size: 80px;
    font-weight: bold;
    margin-top: 25px;
}

.temperature sup {
    font-size: 30px;
}

.weather-main p {
    color: rgba(255,255,255,0.75);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 35px;
}

.stats div {
    background: rgba(255,255,255,0.12);
    padding: 15px;
    border-radius: 14px;
}

.stats span,
.stats b {
    display: block;
}

.stats span {
    font-size: 11px;
    margin-top: 7px;
    color: rgba(255,255,255,0.7);
}

/* CARDS */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 22px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.card h3 {
    margin-bottom: 20px;
}

.aqi {
    display: flex;
    gap: 15px;
    align-items: center;
}

.aqi strong {
    width: 65px;
    height: 65px;
    display: grid;
    place-items: center;
    background: #eef2ff;
    color: var(--primary);
    border-radius: 15px;
    font-size: 22px;
}

.aqi p {
    color: var(--muted);
    font-size: 11px;
    margin-top: 5px;
}

.progress {
    height: 8px;
    background: var(--border);
    border-radius: 20px;
    margin: 20px 0 10px;
    overflow: hidden;
}

#aqiBar {
    display: block;
    width: 45%;
    height: 100%;
    background: linear-gradient(
        90deg,
        #22c55e,
        #eab308,
        #ef4444
    );
}

/* SUN */

.sun-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.sun-grid span,
.sun-grid b {
    display: block;
}

.sun-grid span {
    color: var(--muted);
    font-size: 11px;
    margin-top: 5px;
}

/* FULL */

.full {
    margin-top: 20px;
}

.section-title {
    display: flex;
    justify-content: space-between;
}

.section-title span {
    color: var(--muted);
    font-size: 11px;
}

/* HOURLY */

.hourly {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
}

.hour {
    text-align: center;
    padding: 14px 5px;
    background: var(--bg);
    border-radius: 14px;
}

.hour.active {
    background: #eef2ff;
    color: var(--primary);
}

.hour span,
.hour small {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

.hour-icon {
    font-size: 25px;
    margin: 10px 0;
}

/* FORECAST */

.forecast {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.forecast-day {
    text-align: center;
    padding: 18px 10px;
    background: var(--bg);
    border-radius: 15px;
}

.forecast-day .icon {
    font-size: 30px;
    margin: 12px 0;
}

.forecast-day small {
    display: block;
    color: var(--muted);
    margin-top: 5px;
    font-size: 10px;
}

/* DETAILS */

.details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.detail {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: 16px;
}

.detail span {
    color: var(--muted);
    font-size: 12px;
}

.detail b {
    display: block;
    font-size: 24px;
    margin-top: 12px;
}

/* FOOTER */

footer {
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    padding: 30px;
}

/* MOBILE */

@media(max-width: 800px) {

    .container {
        padding: 18px;
    }

    header {
        align-items: flex-start;
        gap: 15px;
    }

    h1 {
        font-size: 25px;
    }

    .search-box {
        flex-direction: column;
    }

    .main-weather {
        grid-template-columns: 1fr;
    }

    .weather-main {
        grid-row: auto;
    }

    .hourly {
        grid-template-columns: repeat(4, 1fr);
    }

    .forecast {
        grid-template-columns: repeat(2, 1fr);
    }

    .details {
        grid-template-columns: 1fr 1fr;
    }
}

@media(max-width: 450px) {

    .stats {
        grid-template-columns: 1fr;
    }

    .hourly {
        grid-template-columns: repeat(2, 1fr);
    }

    .details {
        grid-template-columns: 1fr;
    }

    .temperature {
        font-size: 60px;
    }
}
