/* Base Reset & Fonts */
:root {
    --primary-font: 'Inter', sans-serif;
    --heading-font: 'Outfit', sans-serif;

    /* Light Theme Colors */
    --bg-color: #f0fdf4;
    --text-main: #0f172a;
    --text-muted: #475569;
    --card-bg: rgba(255, 255, 255, 0.4);
    --card-border: rgba(255, 255, 255, 0.6);
    --accent: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    /* Weather Gradient Overlays (Default) */
    --gradient-1: #38bdf8;
    --gradient-2: #818cf8;
    --gradient-3: #c084fc;
}

.theme-dark {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.5);
    --card-border: rgba(255, 255, 255, 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Weather Specifc Themes */
body.weather-clear {
    --gradient-1: #fcd34d;
    --gradient-2: #fb923c;
    --gradient-3: #f87171;
}

body.weather-cloudy {
    --gradient-1: #94a3b8;
    --gradient-2: #64748b;
    --gradient-3: #475569;
}

body.weather-rain {
    --gradient-1: #38bdf8;
    --gradient-2: #3b82f6;
    --gradient-3: #1d4ed8;
}

body.weather-snow {
    --gradient-1: #e0f2fe;
    --gradient-2: #bae6fd;
    --gradient-3: #7dd3fc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--primary-font);
    color: var(--text-main);
    background-color: var(--bg-color);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Animated Background */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-color);
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 20s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--gradient-1) 0%, transparent 70%);
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--gradient-2) 0%, transparent 70%);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--gradient-3) 0%, transparent 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(5%, 10%) scale(1.1);
    }

    100% {
        transform: translate(-5%, -5%) scale(0.9);
    }
}

/* Layout */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo h1 {
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.controls {
    display: flex;
    gap: 1rem;
}

.icon-button {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-family: var(--heading-font);
    font-weight: 700;
}

.icon-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background: rgba(255, 255, 255, 0.8);
}

.theme-dark .icon-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Search */
.search-section {
    margin-bottom: 2.5rem;
    position: relative;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

#searchInput {
    width: 100%;
    padding: 1.25rem 1.25rem 1.25rem 3.5rem;
    border-radius: 100px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    color: var(--text-main);
    font-size: 1.1rem;
    font-family: var(--primary-font);
    outline: none;
    box-shadow: var(--shadow-glass);
    transition: all 0.3s ease;
}

#searchInput:focus {
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-glass);
    background: rgba(255, 255, 255, 0.7);
}

.theme-dark #searchInput:focus {
    background: rgba(30, 41, 59, 0.8);
}

.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    max-height: 350px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--shadow-glass);
    overflow-y: auto;
    z-index: 10;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

.suggestions-dropdown::-webkit-scrollbar {
    width: 6px;
}

.suggestions-dropdown::-webkit-scrollbar-thumb {
    background-color: var(--text-muted);
    border-radius: 10px;
}

.suggestions-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.suggestion-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--card-border);
    transition: background 0.2s ease, padding-left 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active-suggestion {
    background: rgba(255, 255, 255, 0.4);
    padding-left: 1.5rem;
}

.theme-dark .suggestion-item:hover,
.theme-dark .suggestion-item.active-suggestion {
    background: rgba(255, 255, 255, 0.15);
}

.suggestion-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.suggestion-city {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

.suggestion-region {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Glass Card Global Styles */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    padding: 2rem;
    box-shadow: var(--shadow-glass);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px 0 rgba(0, 0, 0, 0.1);
}

/* Main Layout */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.main-content.fade-out {
    opacity: 0;
}

.hidden {
    display: none !important;
}

.top-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

/* Current Weather */
.current-weather {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.city-info h2 {
    font-family: var(--heading-font);
    font-size: 2.5rem;
    font-weight: 700;
}

.city-info p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2rem 0;
}

.weather-icon-large svg {
    width: 100px;
    height: 100px;
    color: var(--text-main);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
    animation: bounceIcon 3s ease-in-out infinite;
}

@keyframes bounceIcon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.temperature {
    display: flex;
    align-items: flex-start;
}

.temp-value {
    font-family: var(--heading-font);
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -2px;
}

.unit {
    font-size: 2rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.weather-desc {
    font-size: 1.25rem;
    font-weight: 500;
    text-transform: capitalize;
}

/* Recommendations */
.recommendation-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.1));
}

.theme-dark .recommendation-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.4));
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-family: var(--heading-font);
    font-size: 1.25rem;
}

.accent-icon {
    color: #eab308;
}

.recommendation-card p {
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.4;
    font-family: var(--heading-font);
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
}

.detail-item {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    border-radius: 25px;
}

.detail-item svg {
    color: var(--accent);
    width: 28px;
    height: 28px;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.value {
    font-weight: 600;
    font-size: 1.1rem;
    font-family: var(--heading-font);
}

/* 7-Day Forecast */
.forecast-section {
    margin-top: 1rem;
}

.forecast-section h3 {
    margin-bottom: 1.5rem;
    font-family: var(--heading-font);
    font-size: 1.25rem;
    padding-left: 0.5rem;
}

.forecast-slider {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scroll-behavior: smooth;
    /* Hide scrollbar for clean look */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.forecast-slider::-webkit-scrollbar {
    display: none;
}

.forecast-card {
    min-width: 120px;
    flex: 0 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border-radius: 25px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, background 0.3s ease;
    cursor: pointer;
}

.forecast-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.6);
}

.theme-dark .forecast-card:hover {
    background: rgba(255, 255, 255, 0.15);
}

.forecast-day {
    font-weight: 500;
    color: var(--text-muted);
}

.forecast-icon svg {
    width: 40px;
    height: 40px;
}

.forecast-temp {
    display: flex;
    gap: 0.5rem;
    font-family: var(--heading-font);
    font-weight: 600;
}

.temp-high {
    color: var(--text-main);
}

.temp-low {
    color: var(--text-muted);
}

/* Loading State */
.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    gap: 1.5rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--card-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-state svg {
    width: 48px;
    height: 48px;
    color: #ef4444;
}

/* Responsive */
@media (max-width: 768px) {
    .top-grid {
        grid-template-columns: 1fr;
    }

    .app-container {
        padding: 1rem;
    }

    .city-info h2 {
        font-size: 2rem;
    }

    .temp-value {
        font-size: 4rem;
    }

    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}