/* ===== CSS Variables ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(0, 0, 0, 0.05);
    --card-border: rgba(0, 0, 0, 0.1);
    --text-primary: #1a1a1a;
    --text-secondary: rgba(0, 0, 0, 0.7);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    transition: background 0.5s ease;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--text-primary);
}

.logo h1 {
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
}

.theme-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ===== Search Section ===== */
.search-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
}

.search-box {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 500px;
}

.search-box input {
    flex: 1;
    padding: 15px 25px;
    border-radius: 50px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    backdrop-filter: blur(10px);
    outline: none;
    transition: all 0.3s ease;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.search-box button {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.location-btn {
    padding: 12px 25px;
    border-radius: 50px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.location-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* ===== Loading ===== */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    color: var(--text-primary);
}

.loading.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Error Message ===== */
.error-message {
    display: none;
    background: rgba(220, 38, 38, 0.3);
    border: 1px solid rgba(220, 38, 38, 0.5);
    padding: 20px 30px;
    border-radius: 15px;
    color: white;
    text-align: center;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.error-message.active {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

/* ===== Weather Content ===== */
.weather-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Current Weather */
.current-weather {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    padding: 40px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    color: var(--text-primary);
}

.city-info {
    text-align: center;
    margin-bottom: 30px;
}

.city-info h2 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.city-info p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.weather-icon-large {
    width: 150px;
    height: 150px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.2));
}

.temperature {
    text-align: center;
}

.temperature h3 {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
}

.temperature p {
    font-size: 1.3rem;
    text-transform: capitalize;
    margin-top: 10px;
}

.feels-like {
    font-size: 1rem !important;
    color: var(--text-secondary);
    margin-top: 5px !important;
}

.temp-range {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.temp-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.temp-item i {
    font-size: 1.2rem;
}

/* Weather Details Grid */
.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.detail-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.detail-card:hover {
    transform: scale(1.05);
}

.detail-card i {
    font-size: 1.8rem;
    margin-bottom: 10px;
    display: block;
}

.detail-card .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.detail-card .value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Sun Times */
.sun-times {
    display: flex;
    justify-content: center;
    gap: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--card-border);
    flex-wrap: wrap;
}

.sun-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.sun-item i {
    font-size: 2rem;
}

.sun-item span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== Forecast Sections ===== */
.forecast-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    padding: 25px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.forecast-section h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

/* Hourly Forecast */
.hourly-forecast {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.hourly-forecast::-webkit-scrollbar {
    height: 8px;
}

.hourly-forecast::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.hourly-forecast::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.hourly-card {
    min-width: 90px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 20px;
    text-align: center;
    color: var(--text-primary);
    transition: transform 0.3s ease;
}

.hourly-card:hover {
    transform: scale(1.05);
}

.hourly-card .time {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.hourly-card img {
    width: 50px;
    height: 50px;
    margin-bottom: 8px;
}

.hourly-card .temp {
    font-size: 1.2rem;
    font-weight: 600;
}

.hourly-card .precip {
    font-size: 0.8rem;
    color: #60a5fa;
    margin-top: 5px;
}

/* Daily Forecast */
.daily-forecast {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.daily-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.daily-card:hover {
    background: rgba(255, 255, 255, 0.15);
}

.daily-card .day {
    width: 100px;
    font-weight: 600;
}

.daily-card .weather-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.daily-card img {
    width: 45px;
    height: 45px;
}

.daily-card .description {
    text-transform: capitalize;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.daily-card .temp {
    font-size: 1.1rem;
    font-weight: 600;
    width: 60px;
    text-align: right;
}

.daily-card .precip {
    color: #60a5fa;
    font-size: 0.9rem;
    width: 40px;
    text-align: right;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 20px;
    color: var(--text-secondary);
}

.footer a {
    color: var(--text-primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 1.5rem;
    }

    .logo i {
        font-size: 2rem;
    }

    .current-weather {
        padding: 25px;
    }

    .city-info h2 {
        font-size: 2rem;
    }

    .temperature h3 {
        font-size: 3.5rem;
    }

    .weather-icon-large {
        width: 120px;
        height: 120px;
    }

    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }

    .sun-times {
        gap: 30px;
    }

    .daily-card {
        flex-wrap: wrap;
        gap: 10px;
    }

    .daily-card .day {
        width: 100%;
    }

    .daily-card .weather-info {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .search-box {
        flex-direction: column;
    }

    .search-box button {
        width: 100%;
        border-radius: 25px;
    }

    .weather-details {
        grid-template-columns: 1fr;
    }
}
