/* CSS Variables for theming */
:root {
    /* Light Theme */
    --bg-primary: #667eea;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-card: rgba(255, 255, 255, 0.98);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-color: #667eea;
    --accent-secondary: #764ba2;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --border-radius-lg: 24px;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-primary: #1a1a2e;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-card: rgba(30, 38, 65, 0.95);
    --bg-card-hover: rgba(40, 50, 80, 0.98);
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --accent-color: #7c3aed;
    --accent-secondary: #6366f1;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
    padding: 20px;
}

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

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    margin-bottom: 20px;
}

.location {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.location .icon {
    font-size: 1.6rem;
}

.controls {
    display: flex;
    gap: 12px;
}

.btn {
    background: var(--bg-card);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn .theme-icon,
.btn .lang-text {
    color: var(--text-primary);
}

/* Main Weather Card */
.main-weather-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.current-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.location-name {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.update-time {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.temperature-display {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}

.temperature-value {
    font-size: 5rem;
    font-weight: 200;
    line-height: 1;
    color: var(--text-primary);
}

.temperature-unit {
    font-size: 1.8rem;
    font-weight: 300;
    margin-top: 10px;
    color: var(--text-secondary);
}

.weather-description {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 15px;
}

.weather-icon {
    font-size: 2.5rem;
}

.wind-info {
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wind-info::before {
    content: '💨';
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.detail-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.detail-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.detail-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.detail-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Temperature Chart Section */
.chart-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-high { background: #ef4444; }
.legend-low { background: #3b82f6; }

.chart-container {
    position: relative;
    height: 180px;
    margin: 0 10px;
}

#tempChart {
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius-sm);
}

/* 7-Day Forecast Section */
.forecast-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.forecast-list {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.forecast-item {
    background: rgba(102, 126, 234, 0.06);
    border-radius: var(--border-radius-sm);
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

[data-theme="dark"] .forecast-item {
    background: rgba(255, 255, 255, 0.05);
}

.forecast-item:hover {
    background: rgba(102, 126, 234, 0.12);
    transform: translateY(-2px);
}

[data-theme="dark"] .forecast-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.forecast-item.active {
    background: var(--accent-color);
    color: white;
}

.forecast-item.active .forecast-date,
.forecast-item.active .forecast-weather,
.forecast-item.active .forecast-temp {
    color: white;
}

.forecast-date {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.forecast-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.forecast-weather {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

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

.forecast-temp .high {
    color: var(--text-primary);
}

.forecast-temp .low {
    color: var(--text-muted);
}

/* Hourly Forecast Section */
.hourly-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.hourly-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.day-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.day-tab {
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

[data-theme="dark"] .day-tab {
    background: rgba(255, 255, 255, 0.08);
}

.day-tab:hover {
    background: rgba(102, 126, 234, 0.15);
}

[data-theme="dark"] .day-tab:hover {
    background: rgba(255, 255, 255, 0.15);
}

.day-tab.active {
    background: var(--accent-color);
    color: white;
}

.hourly-table-container {
    overflow-x: auto;
}

.hourly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.hourly-table th,
.hourly-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .hourly-table th,
[data-theme="dark"] .hourly-table td {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.hourly-table th {
    background: rgba(102, 126, 234, 0.06);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8rem;
}

[data-theme="dark"] .hourly-table th {
    background: rgba(255, 255, 255, 0.05);
}

.hourly-table td {
    color: var(--text-primary);
}

.hourly-table tr:hover td {
    background: rgba(102, 126, 234, 0.05);
}

[data-theme="dark"] .hourly-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

.hourly-table .wicon {
    font-size: 1.3rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 25px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.footer p {
    margin-bottom: 8px;
}

.auto-update {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-weather-card {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .details-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .forecast-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .main-weather-card {
        padding: 20px;
    }
    
    .temperature-value {
        font-size: 4rem;
    }
    
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .forecast-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .forecast-item {
        padding: 12px 8px;
    }
    
    .forecast-icon {
        font-size: 1.5rem;
    }
    
    .hourly-table {
        font-size: 0.8rem;
    }
    
    .hourly-table th,
    .hourly-table td {
        padding: 10px 6px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 5px 10px;
    }
    
    .location {
        font-size: 1.1rem;
    }
    
    .btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .temperature-value {
        font-size: 3.5rem;
    }
    
    .weather-description {
        font-size: 1.2rem;
    }
    
    .forecast-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .forecast-item {
        padding: 10px 6px;
    }
    
    .forecast-date {
        font-size: 0.75rem;
    }
    
    .forecast-icon {
        font-size: 1.3rem;
    }
    
    .forecast-weather {
        font-size: 0.7rem;
    }
    
    .forecast-temp {
        font-size: 0.8rem;
    }
}