/* --- NEW "LIVE WEATHER" THEME --- */
:root {
    --card-bg: rgba(0, 0, 0, 0.35);
    --text-primary: #FFFFFF;
    --text-secondary: #E0E0E0;
    --border-color: rgba(255, 255, 255, 0.2);
    --accent-color: #87CEEB; /* Sky Blue */
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 2rem 1rem;
    box-sizing: border-box;
    /* The transition makes the background change smoothly */
    transition: background 1s ease-in-out;
    background-size: cover;
    background-position: center;
}

/* --- DYNAMIC BACKGROUNDS START --- */
/* Default Background */
.default-bg {
    background: linear-gradient(135deg, #1d2b4b, #334d7a);
}
/* Sunny/Clear Background */
.sunny {
    background: linear-gradient(to top, #FFD700, #FDB813, #FFA500);
}
/* Cloudy Background */
.cloudy {
    background: linear-gradient(to top, #B0C4DE, #778899);
}
/* Rainy Background */
.rainy {
    background: linear-gradient(to top, #4682B4, #2F4F4F);
}
/* Stormy Background */
.stormy {
    background: linear-gradient(to top, #2c3e50, #161e27);
}
/* Snowy Background */
.snowy {
    background: linear-gradient(to top, #E6E6FA, #FFFFFF);
}
/* Misty/Foggy Background */
.misty {
    background: linear-gradient(to top, #D3D3D3, #A9A9A9);
}
/* --- DYNAMIC BACKGROUNDS END --- */


.container {
    width: 100%;
    max-width: 1000px; /* <-- CHANGED */
}

.weather-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 24px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* App Title and Subtitle */
.app-title { 
    font-size: 2.2rem; 
    font-weight: 700; 
    margin: 0; }

.app-subtitle { 
    font-size: 1rem; 
    margin-bottom: 2rem; 
    font-weight: 400; 
    color: var(--text-secondary); }

/* Search bar and button */
.search-container { 
    display: flex; 
    gap: 0.75rem; 
    margin-bottom: 2rem; }

#locationInput {
    flex-grow: 1;
    padding: 0.8rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}
#locationInput::placeholder { 
    color: var(--text-secondary); }
    
#locationInput:focus { 
    background-color: rgba(0, 0, 0, 0.3); 
    border-color: var(--accent-color); 
}

#submitBtn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 12px;
    background: var(--accent-color);
    color: #111;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
#submitBtn:hover { transform: scale(1.05); box-shadow: 0 0 15px var(--accent-color); }

/* Weather Info Display */
.weather-info-container { 
    display: none; 
    flex-direction: column; 
    align-items: center; 
    gap: 0.2rem; 
    animation: fadeIn 0.5s ease-in-out; }

@keyframes fadeIn { 
    from { 
        opacity: 0; 
        transform: translateY(10px); } 
    to { opacity: 1; 
        transform: translateY(0); } }

.city-name { font-size: 2.5rem; 
    font-weight: 700; }

.current-date { font-size: 1rem;
    color: var(--text-secondary); 
    margin-bottom: 0.5rem; }

.weather-icon { width: 120px; 
    height: 120px; 
    margin-top: -1rem; 
    margin-bottom: -1rem; 
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.3)); }

.temperature { font-size: 4.5rem; 
    font-weight: 300; }

.high-low { font-size: 1.1rem; 
    color: var(--text-secondary); }

.description { font-size: 1.5rem; 
    text-transform: capitalize; 
    margin-top: 0.5rem; }

/* Weather Details Grid */
.weather-details { display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 1rem; width: 100%; 
    margin-top: 2rem; 
    text-align: left; }

.detail-item { background: rgba(0,0,0,0.2); 
    padding: 1rem; 
    border-radius: 12px; 
    display: flex; 
    flex-direction: column; 
    gap: 0.25rem; }

.detail-label { font-size: 0.8rem; 
    color: var(--text-secondary); }

.detail-value { font-size: 1.2rem; 
    font-weight: 500; }

/* Forecast Sections */
.forecast-container, .hourly-forecast-container { 
    display: none; 
    /* margin-top: 2.5rem; */ /* <-- REMOVED */
    animation: fadeIn 0.5s ease-in-out; 
}

.forecast-title { font-size: 1.2rem; 
    font-weight: 500; 
    margin-bottom: 1rem; 
    text-align: left; 
    color: var(--text-secondary); 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 0.5rem; }

.forecast-days, .hourly-items { display: flex; 
    gap: 0.75rem; 
    overflow-x: auto; 
    padding-bottom: 15px; }

/* Styled Scrollbar */
.forecast-days::-webkit-scrollbar, .hourly-items::-webkit-scrollbar { 
    height: 8px; }

.forecast-days::-webkit-scrollbar-track, .hourly-items::-webkit-scrollbar-track { 
    background: rgba(0, 0, 0, 0.2); 
    border-radius: 4px; }

.forecast-days::-webkit-scrollbar-thumb, .hourly-items::-webkit-scrollbar-thumb { 
    background: rgba(255, 255, 255, 0.4); 
    border-radius: 4px; }

.forecast-days::-webkit-scrollbar-thumb:hover, .hourly-items::-webkit-scrollbar-thumb:hover { 
    background: rgba(255, 255, 255, 0.6); }

/* Forecast Individual Items */
.forecast-day, .hourly-item { 
    flex-shrink: 0; 
    min-width: 75px; 
    padding: 1rem 0.5rem; 
    background: rgba(0,0,0,0.2); 
    border-radius: 15px; 
    display: flex;
    flex-direction: column; 
    align-items: center; 
    gap: 0.5rem; 
    transition: background-color 0.2s ease; }

.forecast-day:hover, .hourly-item:hover { background: rgba(0,0,0,0.4); }
.forecast-day .day-name, .hourly-item .hour-time { font-weight: 500; font-size: 0.9rem; }
.forecast-day img, .hourly-item img { width: 50px; height: 50px; }
.forecast-day .day-temp, .hourly-item .hour-temp { font-weight: 500; font-size: 1rem; }

/* Loader and Error Message */
.loader { 
    display: none; 
    border: 4px solid var(--border-color); 
    border-top: 4px solid var(--accent-color); 
    border-radius: 50%; 
    width: 40px; 
    height: 40px; 
    animation: spin 1s linear infinite; 
    margin: 20px auto; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.error-container { 
    display: none; 
    margin-top: 1rem; 
    padding: 1rem; 
    background-color: rgba(248, 113, 113, 0.2); 
    border: 1px solid rgba(248, 113, 113, 0.5); 
    color: #F87171; 
    border-radius: 12px; 
    font-weight: 500; 
    animation: fadeIn 0.5s; }

/* Responsive Adjustments */
@media (max-width: 480px) { body { padding: 1rem; } .weather-card { padding: 1.5rem; } .temperature { font-size: 4rem; } }


/* --- NEW STYLES FOR HORIZONTAL LAYOUT --- */

.weather-display-grid {
    display: none; /* Hidden by default, JS will show it */
    grid-template-columns: 1fr 1fr; /* Two equal columns */
    gap: 2.5rem; /* Space between the two columns */
    margin-top: 2rem;
    align-items: flex-start; /* Aligns columns to the top */
}



.forecasts-column {
    display: flex;
    flex-direction: column;
    gap: 2.5rem; /* Space between hourly and 5-day forecasts */
    width: 100%;
    min-width: 0; /* <-- ADD THIS LINE TO FIX OVERFLOW */
}
/* Make sure the weather info container doesn't add its own margin */
.current-weather-column .weather-info-container {
    animation: none; /* We animate the grid, not the items */
}

/* Responsive adjustment for the new layout */
@media (max-width: 800px) {
    .weather-display-grid {
        grid-template-columns: 1fr; /* Stack columns on small screens */
        gap: 2rem;
    }
}