:root {
    --font-primary: 'Outfit', sans-serif;
    --font-secondary: 'Plus Jakarta Sans', sans-serif;
    
    /* Themes */
    --bg-sunny: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #78350f 100%);
    --bg-clear: linear-gradient(135deg, #1e3a8a 0%, #0f172a 60%, #020617 100%);
    --bg-cloudy: linear-gradient(135deg, #64748b 0%, #475569 50%, #1e293b 100%);
    --bg-rainy: linear-gradient(135deg, #38bdf8 0%, #0284c7 40%, #0f172a 100%);
    --bg-stormy: linear-gradient(135deg, #8b5cf6 0%, #4c1d95 50%, #030712 100%);
    --bg-snowy: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #475569 100%);
    
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-muted: rgba(255, 255, 255, 0.45);
}

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

body {
    font-family: var(--font-primary);
    background: var(--bg-clear);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 1.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-x: hidden;
}

/* Dynamic Theme classes applied to body */
body.theme-sunny { background: var(--bg-sunny); }
body.theme-clear { background: var(--bg-clear); }
body.theme-cloudy { background: var(--bg-cloudy); }
body.theme-rainy { background: var(--bg-rainy); }
body.theme-stormy { background: var(--bg-stormy); }
body.theme-snowy { background: var(--bg-snowy); }

a {
    color: inherit;
    text-decoration: none;
}

/* Container & Layout */
.app-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Glassmorphism utility card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.28);
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    animation: pulse 3s infinite ease-in-out;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.live-clock {
    font-family: var(--font-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Custom Toggle Switch */
.toggle-container {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 30px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 1rem;
    border-radius: 30px;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
}

.toggle-btn.active {
    color: #020617;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: #ffffff;
    border-radius: 30px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.toggle-container.fahrenheit .toggle-slider {
    transform: translateX(100%);
}

/* Search Section */
.search-section {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.search-bar-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-bar-wrapper i.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 1.1rem 1.25rem 1.1rem 3.25rem;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 1.05rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.btn-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.btn-circle:hover {
    background: #ffffff;
    color: #0f172a;
    transform: scale(1.05);
    border-color: #ffffff;
}

.btn-circle:active {
    transform: scale(0.95);
}

/* Default Preset Cities */
.preset-cities {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: -0.5rem;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 0.45rem 1.1rem;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Main Content Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.75rem;
}

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

/* Left Column: Current Weather Card */
.current-card {
    padding: 2.25rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.weather-source-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.current-header {
    margin-bottom: 1.5rem;
    width: 100%;
}

.city-name {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.country-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.current-datetime {
    font-family: var(--font-secondary);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.weather-art {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weather-art img {
    width: 130px;
    height: 130px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
    animation: float 6s infinite ease-in-out;
}

.current-temp-container {
    margin-bottom: 0.5rem;
}

.current-temp {
    font-size: 4.8rem;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    position: relative;
    display: inline-block;
}

.current-temp-degree {
    font-size: 2.5rem;
    font-weight: 500;
    position: absolute;
    top: 0.5rem;
    right: -1.75rem;
}

.current-condition {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin-bottom: 0.5rem;
}

.feels-like {
    font-size: 0.95rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.35rem 0.9rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Right Column: Detailed Stats and Forecast */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon-box {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* Forecast Card */
.forecast-card {
    padding: 1.75rem 2rem;
}

.forecast-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

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

.forecast-day-card {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.forecast-day-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.forecast-day-name {
    font-size: 1rem;
    font-weight: 700;
}

.forecast-date {
    font-family: var(--font-secondary);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.forecast-icon {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

.forecast-condition {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.forecast-temps {
    display: flex;
    gap: 0.75rem;
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.forecast-temp-max {
    font-weight: 700;
    color: #ffffff;
}

.forecast-temp-min {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Recent Searches */
.history-card {
    padding: 1.5rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-title {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-clear-history {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.3s ease;
}

.btn-clear-history:hover {
    color: #ef4444;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.history-item-remove {
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.history-item-remove:hover {
    color: #ef4444;
}

.history-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    padding: 0.5rem 0;
}

/* Footer */
footer {
    margin-top: auto;
    text-align: center;
    padding: 2.5rem 1.5rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-secondary);
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.06) 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 8px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

/* Error Banner */
.error-card {
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 500px;
    margin: 2rem auto;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.error-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    margin-bottom: 0.5rem;
}

.error-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.error-msg {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2); }
    50% { transform: scale(1.03); box-shadow: 0 0 15px 5px rgba(255, 255, 255, 0.15); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

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

@keyframes loading-shimmer {
    to { background-position: -200% 0; }
}

/* Utility classes */
.hidden { display: none !important; }
.flex { display: flex !important; }
