:root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent: #3498db;
    --bg-gradient: linear-gradient(135deg, #2c3e50, #000000);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s ease;
}

.light-mode {
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-primary: #2c3e50;
    --text-secondary: #5d6d7e;
    --accent: #2980b9;
    --bg-gradient: linear-gradient(135deg, #e0f7fa, #80deea);
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    min-height: 100vh;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
}

#body-bg {
    background-size: cover;
    background-position: center;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: -1;
}

.container {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    gap: 20px;
    margin: 20px;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}

/* Sidebar */
.sidebar {
    width: 300px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    flex-shrink: 0;
}

.logo h2 {
    font-weight: 700;
    letter-spacing: -1px;
}

.search-box {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 5px 15px;
    border: 1px solid var(--glass-border);
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    padding: 10px 0;
    width: 100%;
}

.search-box button {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.secondary-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    transition: var(--transition);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.history-section h3, .favorites-section h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

li {
    padding: 10px 15px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

li:hover {
    background: rgba(255, 255, 255, 0.15);
}

.theme-toggle {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 4px; bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(24px); }

/* Dashboard */
.dashboard {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    padding-right: 5px;
}

.top-bar {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-time h1 { font-size: 2rem; }
.date-time p { color: var(--text-secondary); }

.unit-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 5px;
}

.unit-toggle button {
    background: none;
    border: none;
    padding: 8px 15px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
}

.unit-toggle button.active {
    background: var(--glass-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Current Weather Card */
.current-weather {
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.main-info {
    display: flex;
    align-items: center;
    gap: 40px;
}

.weather-icon-lg svg {
    width: 100px;
    height: 100px;
}

.temp-display {
    font-size: 5rem;
    font-weight: 700;
}

.temp-display .unit {
    font-size: 2rem;
    font-weight: 400;
    vertical-align: top;
    margin-left: 5px;
}

.condition-info h2 { font-size: 2.5rem; margin-bottom: 5px; }
.condition-info p { font-size: 1.1rem; color: var(--text-secondary); }

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    border-top: 1px solid var(--glass-border);
    padding-top: 30px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-item .label { font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; }
.detail-item .value { font-size: 1.2rem; font-weight: 600; }

/* Forecast */
.forecast-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.forecast-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.forecast-card .day { font-weight: 600; }
.forecast-card .temp { font-size: 1.2rem; font-weight: 700; }
.forecast-card .desc { font-size: 0.8rem; color: var(--text-secondary); text-align: center; }

/* Bottom Grid */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.aqi-card, .sun-card {
    padding: 25px;
}

.aqi-display {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin: 15px 0;
}

.aqi-value { font-size: 3rem; font-weight: 700; }
.aqi-status {
    padding: 5px 12px;
    border-radius: 20px;
    background: #2ecc71;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.aqi-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.sun-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
}

.sun-item {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Loader & Toast */
.loader {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}

.toast {
    position: fixed;
    bottom: 20px; right: 20px;
    background: #e74c3c;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 1024px) {
    .container { flex-direction: column; height: auto; }
    .sidebar { width: 100%; }
    .forecast-container { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .main-info { flex-direction: column; text-align: center; gap: 10px; }
    .forecast-container { grid-template-columns: repeat(2, 1fr); }
    .bottom-grid { grid-template-columns: 1fr; }
    .temp-display { font-size: 4rem; }
}

@media (max-width: 480px) {
    .forecast-container { grid-template-columns: 1fr; }
}
