:root {
    --primary-color: #ffffff;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --transition-speed: 0.4s;

    /* Default theme (Clear/Sunny) */
    --bg-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-gradient);
    background-attachment: fixed;
    transition: background var(--transition-speed) ease;
}

/* Theme classes */
body.sunny { --bg-gradient: linear-gradient(135deg, #f6d365 0%, #fda085 100%); }
body.cloudy { --bg-gradient: linear-gradient(135deg, #bdc3c7 0%, #2c3e50 100%); }
body.rainy { --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
body.snowy { --bg-gradient: linear-gradient(135deg, #e6e9f0 0%, #eef1f5 100%); color: #333; }
body.thunder { --bg-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); }
body.mist { --bg-gradient: linear-gradient(135deg, #9796f0 0%, #fbc7d4 100%); }

body.snowy .glass { --glass-bg: rgba(0, 0, 0, 0.05); --glass-border: rgba(0, 0, 0, 0.1); color: #333; }
body.snowy .search-container input { color: #333; }
body.snowy .search-container input::placeholder { color: #666; }
body.snowy .search-container button { color: #333; }

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    width: 100%;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 0.5rem;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
}

.search-container input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 0.5rem 1rem;
    color: white;
    font-size: 1rem;
}

.search-container input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-container button {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-container button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

.current-weather {
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.location-info h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.location-info p {
    font-size: 1rem;
    opacity: 0.8;
}

.main-display {
    margin: 2rem 0;
}

.weather-emoji {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.temp-container {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
}

.temp-container .unit {
    font-size: 2rem;
    font-weight: 400;
    vertical-align: top;
    margin-left: 5px;
}

#weather-desc {
    font-size: 1.5rem;
    text-transform: capitalize;
    margin-top: 0.5rem;
    opacity: 0.9;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.detail-card {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.detail-card .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.detail-card .value {
    font-size: 1.2rem;
    font-weight: 600;
}

.forecast {
    margin-top: 1rem;
    animation: fadeIn 1s ease-out;
}

.forecast h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.forecast-item {
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.forecast-day {
    font-size: 0.9rem;
    font-weight: 600;
}

.forecast-emoji {
    font-size: 2rem;
}

.forecast-temp {
    font-size: 1rem;
}

.forecast-temp .min {
    opacity: 0.6;
    font-size: 0.8rem;
    margin-left: 4px;
}

/* Utils */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Spinner */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    height: 300px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

/* Error Container */
.error-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

#retry-btn {
    margin-top: 1rem;
    background: white;
    color: #333;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
}

#retry-btn:hover {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 480px) {
    .app-container {
        padding: 1rem;
    }

    .location-info h1 {
        font-size: 2rem;
    }

    .temp-container {
        font-size: 4rem;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .forecast-grid {
        grid-template-columns: 1fr;
    }

    .forecast-item {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
    }
}
