:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
body.theme-light {
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --text-primary: #1e293b;
    --text-secondary: #475569;
}

body.theme-light .forecast-precipitation,
body.theme-light .daily-precipitation,
body.theme-light .temp-low,
body.theme-light .coord-val {
    color: var(--text-secondary);
}

body.theme-light .forecast-precipitation svg,
body.theme-light .daily-precipitation svg {
    color: #2563eb;
    /* Darker blue for light mode */
}

body.theme-light .forecast-item,
body.theme-light .daily-forecast-item {
    border-color: rgba(0, 0, 0, 0.1);
}

/* Weather Themes */
body.theme-clear {
    --bg-gradient: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
}

body.theme-light.theme-clear {
    --bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #7dd3fc 100%);
}

body.theme-clouds {
    --bg-gradient: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
}

body.theme-light.theme-clouds {
    --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
}

body.theme-rain {
    --bg-gradient: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

body.theme-light.theme-rain {
    --bg-gradient: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
}

body.theme-thunder {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #312e81 100%);
}

body.theme-light.theme-thunder {
    --bg-gradient: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

body.theme-snow {
    --bg-gradient: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

body.theme-light.theme-snow {
    --bg-gradient: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg-gradient);
    transition: background 1s ease;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 80%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

header {
    text-align: center;
}

main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo i {
    color: var(--primary);
    width: 32px;
    height: 32px;
}

.logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Search Box */
.search-box {
    width: 100%;
    margin-bottom: 20px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 8px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(8px);
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
}

input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    padding: 12px 12px 12px 48px;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Spinner and Error States */
.spinner-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    backdrop-filter: blur(8px);
    margin-bottom: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.error-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 30px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    color: #fca5a5;
    margin-bottom: 20px;
    backdrop-filter: blur(8px);
    animation: slideUp 0.4s ease-out;
}

.error-card i {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

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

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(12px);
    animation: slideUp 0.6s ease-out;
}

.weather-main {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--glass-border);
}

.weather-icon-large {
    margin-bottom: 20px;
    color: var(--primary);
}

.weather-icon-large svg {
    width: 80px;
    height: 80px;
}

.temp-display {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
}

.temp-value {
    font-family: 'Outfit', sans-serif;
    font-size: 5rem;
    font-weight: 600;
    line-height: 1;
}

.temp-unit {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 12px;
}

.weather-desc {
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.detail-item i {
    color: var(--primary);
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.detail-info {
    display: flex;
    flex-direction: column;
}

.detail-info label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-info span {
    font-weight: 500;
}

.coord-val {
    display: block;
    font-size: 0.9rem;
}

/* Hourly Forecast */
.forecast-container {
    text-align: left;
}

.forecast-container h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.forecast-list {
    display: flex;
    flex-direction: row;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    /* Space for scrollbar */
    scroll-snap-type: x mandatory;
}

/* Custom Scrollbar */
.forecast-list::-webkit-scrollbar {
    height: 8px;
}

.forecast-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.forecast-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.forecast-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.forecast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    min-width: 80px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: var(--transition);
    scroll-snap-align: start;
    flex-shrink: 0;
}

.forecast-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.forecast-time {
    font-weight: 500;
    font-size: 0.9rem;
}

.forecast-precipitation {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.forecast-precipitation svg {
    width: 12px;
    height: 12px;
    color: #93c5fd;
    /* Light blue drop */
}

.forecast-icon-wrapper {
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0;
}

.forecast-icon-wrapper svg {
    width: 24px;
    height: 24px;
}

.forecast-temp {
    font-weight: 600;
    font-size: 1.1rem;
}

/* 7-Day Daily Forecast */
.daily-forecast-container {
    text-align: left;
}

.daily-forecast-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.daily-forecast-item {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 2fr;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.daily-forecast-item:last-child {
    border-bottom: none;
}

.daily-day {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
}

.daily-precipitation {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.daily-precipitation svg {
    width: 14px;
    height: 14px;
    color: #93c5fd;
    /* Light blue drop */
}

.daily-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.daily-icons svg {
    width: 22px;
    height: 22px;
}

.daily-temps {
    text-align: right;
    font-weight: 600;
    font-size: 1.1rem;
}

.daily-temps .temp-low {
    color: rgba(255, 255, 255, 0.6);
    margin-left: 8px;
    font-weight: 400;
}

/* Footer */
footer {
    margin-top: auto;
    text-align: center;
    padding-top: 40px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-links a {
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-links i {
    width: 16px;
    height: 16px;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .app-container {
        padding: 20px;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .input-group {
        flex-direction: column;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        padding: 0;
        gap: 12px;
    }

    .input-group:focus-within {
        background: transparent;
        border: none;
    }

    input {
        width: 100%;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: 16px;
        backdrop-filter: blur(8px);
        padding: 14px 12px 14px 48px;
        transition: var(--transition);
    }

    input:focus {
        border-color: var(--primary);
        background: rgba(255, 255, 255, 0.08);
    }

    .search-icon {
        top: 15px;
    }

    button {
        width: fit-content;
        align-self: center;
        padding: 14px 32px;
        font-size: 1.1rem;
    }

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

    .glass-card {
        padding: 24px;
    }
}

@media (max-width: 400px) {
    .app-container {
        padding: 16px 12px;
    }

    .glass-card {
        padding: 16px;
    }

    .daily-forecast-item {
        grid-template-columns: 2.2fr 1.2fr 1.2fr 1.8fr;
        padding: 12px 0;
        gap: 4px;
    }

    .daily-day {
        font-size: 0.95rem;
    }

    .daily-precipitation {
        font-size: 0.8rem;
    }

    .daily-temps {
        font-size: 0.95rem;
    }

    .daily-icons {
        gap: 4px;
    }

    .daily-icons svg {
        width: 18px;
        height: 18px;
    }

    .daily-temps .temp-low {
        margin-left: 4px;
    }
}