:root {
    --bg: #f4f7f9;
    --card-bg: #ffffff;
    --text-main: #1a1c20;
    --text-muted: #64748b;
    --accent: #4361ee;
    --border: #e2e8f0;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; transition: background 0.3s, border 0.3s; }

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.wrapper { max-width: 700px; margin: 0 auto; padding: 40px 20px; }

/* Navigation */
nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.back-link { text-decoration: none; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

#theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    width: 40px; height: 40px; border-radius: 12px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Search Box */
.search-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex; padding: 8px;
    box-shadow: var(--shadow);
}

#city-input {
    flex: 1; border: none; background: transparent;
    padding: 10px 15px; color: var(--text-main); font-size: 1rem;
}
#city-input:focus { outline: none; }

#search-btn {
    background: var(--accent); color: white; border: none;
    width: 45px; height: 45px; border-radius: 14px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Hero Section */
.weather-hero { text-align: center; margin: 40px 0; }
.location-info h1 { font-size: 2.2rem; letter-spacing: -1px; }
.location-info p { color: var(--text-muted); font-size: 0.9rem; margin-top: 5px; }

.main-temp {
    display: flex; align-items: center; justify-content: center;
    gap: 20px; margin: 20px 0;
}
.temp-val { font-size: 5rem; font-weight: 700; }
.degree { font-size: 2rem; color: var(--accent); }
#weather-icon { width: 100px; height: 100px; }

.condition-pill {
    display: inline-block; background: var(--card-bg);
    border: 1px solid var(--border); padding: 8px 20px;
    border-radius: 50px; font-weight: 600; text-transform: capitalize;
}

/* Stats Grid (Desktop) */
.stats-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.stat-card {
    background: var(--card-bg); border: 1px solid var(--border);
    padding: 24px; border-radius: 20px; display: flex; align-items: center; gap: 15px;
    box-shadow: var(--shadow);
}
.stat-icon { font-size: 1.5rem; }
.stat-meta .label { display: block; font-size: 0.8rem; color: var(--text-muted); }
.stat-meta .value { font-size: 1.1rem; font-weight: 700; }

/* Mobile Compact Logic */
@media (max-width: 600px) {
    .temp-val { font-size: 3.5rem; }
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .stat-card { padding: 16px; border-radius: 14px; }
    .stat-icon { font-size: 1.2rem; }
    .stat-meta .value { font-size: 1rem; }
}

.hidden { display: none; }
.status-msg { text-align: center; padding: 50px; color: var(--text-muted); }