/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #0c134f 0%, #1a237e 30%, #283593 60%, #1565c0 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

header h1 span {
    color: #ffd54f;
}

header p {
    font-size: 0.95rem;
    opacity: 0.7;
}

/* ===== Search ===== */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.search-box input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: background 0.3s ease;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-box input:focus {
    background: rgba(255, 255, 255, 0.25);
}

.search-box button {
    padding: 14px 28px;
    border: none;
    border-radius: 50px;
    background: #ffd54f;
    color: #1a237e;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.search-box button:hover {
    background: #ffca28;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 213, 79, 0.3);
}

.search-box button:active {
    transform: translateY(0);
}

/* ===== Error Message ===== */
.error-msg {
    background: rgba(239, 83, 80, 0.2);
    border: 1px solid rgba(239, 83, 80, 0.4);
    color: #ef5350;
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.error-msg.visible {
    display: block;
}

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

.loading.visible {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ffd54f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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

.loading p {
    opacity: 0.7;
    font-size: 0.95rem;
}

/* ===== Current Weather ===== */
.current-weather {
    display: none;
    margin-bottom: 35px;
}

.current-weather.visible {
    display: block;
}

.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.location h2 {
    font-size: 1.8rem;
    font-weight: 700;
}

.location .country {
    font-size: 0.9rem;
    opacity: 0.6;
}

.date-time {
    text-align: right;
}

.date-time .date {
    font-size: 1rem;
    font-weight: 500;
}

.date-time .time {
    font-size: 0.85rem;
    opacity: 0.6;
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.temp-block {
    display: flex;
    align-items: center;
    gap: 15px;
}

.temp-icon {
    font-size: 3.5rem;
}

.temp-value {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
}

.temp-value .unit {
    font-size: 2rem;
    opacity: 0.6;
    vertical-align: super;
}

.condition-text {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-top: 4px;
}

.feels-like {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-top: 2px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    min-width: 100px;
}

.stat-item .stat-icon {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.stat-item .stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.5;
}

.stat-item .stat-value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ===== Forecast ===== */
.forecast {
    display: none;
}

.forecast.visible {
    display: block;
}

.forecast h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    opacity: 0.9;
}

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

.forecast-card {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 18px 14px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.3s ease, background 0.3s ease;
}

.forecast-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.1);
}

.forecast-card .day {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.forecast-card .f-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.forecast-card .f-temps {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
}

.forecast-card .f-high {
    font-weight: 600;
}

.forecast-card .f-low {
    opacity: 0.5;
}

.forecast-card .f-precip {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* ===== Initial State ===== */
.initial-msg {
    text-align: center;
    padding: 60px 20px;
    opacity: 0.6;
}

.initial-msg .big-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.initial-msg p {
    font-size: 1rem;
}

/* ===== Footer ===== */
footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.4;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container {
        padding: 20px 16px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box button {
        width: 100%;
    }

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

    .temp-block {
        justify-content: center;
    }

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

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

    .forecast-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .weather-header {
        flex-direction: column;
        text-align: center;
    }

    .date-time {
        text-align: center;
    }
}

@media (max-width: 400px) {
    .forecast-grid {
        grid-template-columns: 1fr 1fr;
    }
}
