/* ============================================
   CSS Variables & Reset
   ============================================ */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark: #1e293b;
    --dark-light: #334155;
    --gray: #64748b;
    --gray-light: #cbd5e1;
    --gray-lighter: #f1f5f9;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.weather-icon {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.nav-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

/* ============================================
   Main Content
   ============================================ */
.main {
    padding: 2rem 0 4rem;
}

/* ============================================
   Search Section
   ============================================ */
.search-section {
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-box {
    flex: 1;
    display: flex;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.search-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

.search-input::placeholder {
    color: var(--gray-light);
}

.search-btn {
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-btn:hover {
    background: var(--primary-dark);
}

.search-btn svg {
    width: 20px;
    height: 20px;
}

.location-btn {
    padding: 1rem;
    background: var(--white);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: scale(1.05);
}

.location-btn svg {
    width: 24px;
    height: 24px;
}

.recent-searches {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.recent-search-tag {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-search-tag:hover {
    background: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   Loading & Error States
   ============================================ */
.loading {
    text-align: center;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-lighter);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--danger-color);
}

.error svg {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

/* ============================================
   Weather Views
   ============================================ */
.weather-view {
    display: none;
}

.weather-view.active {
    display: block;
}

/* ============================================
   Current Weather
   ============================================ */
.current-weather {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
}

.weather-header {
    text-align: center;
    margin-bottom: 2rem;
}

.location-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.weather-date {
    color: var(--gray);
    font-size: 1rem;
}

.weather-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: center;
}

.weather-temp-section {
    text-align: center;
}

.weather-icon-large {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.temperature-display {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.weather-description {
    font-size: 1.25rem;
    color: var(--gray);
    text-transform: capitalize;
}

.feels-like {
    font-size: 1rem;
    color: var(--gray);
    margin-top: 0.5rem;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-lighter);
    border-radius: 8px;
}

.detail-icon {
    width: 40px;
    height: 40px;
    color: var(--primary-color);
}

.detail-content h4 {
    font-size: 0.875rem;
    color: var(--gray);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.detail-content p {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
}

.weather-extras {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--gray-lighter);
}

.extra-item {
    text-align: center;
    padding: 1rem;
}

.extra-item h4 {
    font-size: 0.875rem;
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.extra-item p {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

/* ============================================
   Forecast Weather
   ============================================ */
.forecast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.forecast-header h2 {
    color: var(--white);
    font-size: 1.75rem;
}

.forecast-controls {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem;
    border-radius: 8px;
}

.forecast-day-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--white);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.forecast-day-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.forecast-day-btn.active {
    background: var(--white);
    color: var(--primary-color);
}

.forecast-weather {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.forecast-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 1.5rem 1rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.forecast-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.forecast-date {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.forecast-icon {
    font-size: 3rem;
    margin: 0.5rem 0;
}

.forecast-temp {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.forecast-temp-range {
    font-size: 0.875rem;
    color: var(--gray);
}

.forecast-description {
    font-size: 0.875rem;
    color: var(--gray);
    text-transform: capitalize;
    margin-top: 0.5rem;
}

/* ============================================
   Hourly Weather
   ============================================ */
.hourly-weather {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
    overflow-x: auto;
}

.hourly-scroll {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
}

.hourly-card {
    min-width: 120px;
    background: var(--gray-lighter);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: var(--transition);
}

.hourly-card:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: scale(1.05);
}

.hourly-time {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.hourly-icon {
    font-size: 2.5rem;
    margin: 0.5rem 0;
}

.hourly-temp {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.hourly-details {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: rgba(0, 0, 0, 0.2);
    color: var(--white);
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer p {
    margin: 0.25rem 0;
    opacity: 0.9;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .logo {
        justify-content: center;
    }

    .search-container {
        flex-direction: column;
    }

    .search-box {
        flex-direction: column;
    }

    .search-btn {
        justify-content: center;
    }

    .weather-main {
        grid-template-columns: 1fr;
    }

    .weather-details {
        grid-template-columns: 1fr;
    }

    .forecast-weather {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .temperature-display {
        font-size: 3rem;
    }

    .location-name {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .nav {
        width: 100%;
        justify-content: center;
    }

    .nav-btn {
        flex: 1;
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .forecast-weather {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.current-weather,
.forecast-card,
.hourly-card {
    animation: fadeIn 0.5s ease-out;
}

.forecast-card {
    animation-delay: calc(var(--index) * 0.05s);
}
