* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    transition: all 0.3s ease;
    color: #333;
    line-height: 1.6;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: clamp(15px, 4vw, 30px);
    border-radius: 20px;
    min-width: 320px;
    max-width: 1200px;
    width: 100%;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 16px rgba(0, 0, 0, 0.05);
    text-align: center;
    margin: 10px auto;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
    border-radius: 20px 20px 0 0;
}

h1 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h1 .fas {
    margin-right: 10px;
    color: #3498db;
    background: none;
    -webkit-text-fill-color: #3498db;
}

/* Enhanced Search Section */
.search-section {
    margin-bottom: 25px;
}

.input-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: stretch;
}

input {
    padding: 14px 18px;
    min-width: 200px;
    flex: 1;
    max-width: 300px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

input::placeholder {
    color: #94a3b8;
}

button {
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 50px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

button:active {
    transform: translateY(0);
}

button i {
    font-size: 0.9rem;
}

/* Enhanced Control Panel */
.control-panel {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-panel button {
    padding: 10px 16px;
    font-size: 0.85rem;
    margin: 0;
    min-height: 42px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.control-panel button:nth-child(2) {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.control-panel button:nth-child(3) {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.control-panel button:nth-child(4) {
    background: linear-gradient(135deg, #fa709a, #fee140);
}

#themeToggleBtn {
    background: linear-gradient(135deg, #6c757d, #495057) !important;
}

/* Loading Indicator */
.loading-indicator {
    display: none;
    margin: 20px 0;
    font-size: 1.1rem;
    color: #667eea;
    font-weight: 500;
}

.loading-indicator .fa-spinner {
    margin-right: 10px;
    color: #667eea;
    font-size: 1.2rem;
}

/* Enhanced Weather Result Cards */
.weather-result,
.forecast-result,
.hourly-forecast,
.air-quality,
.weather-map,
.city-comparison {
    margin-top: 25px;
    padding: clamp(15px, 3vw, 25px);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    text-align: left;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.weather-result:hover,
.forecast-result:hover,
.hourly-forecast:hover,
.air-quality:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Enhanced Current Weather Display */
.current-weather {
    text-align: center;
}

.weather-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}

.weather-header img {
    width: clamp(80px, 15vw, 120px);
    height: clamp(80px, 15vw, 120px);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.location-info {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.city-name {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.coordinates {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 5px;
    font-weight: 500;
}

.temperature-section {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.main-temp {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    line-height: 1;
}

.feels-like {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #64748b;
    margin-bottom: 15px;
    font-weight: 500;
}

.condition {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    color: #2c3e50;
    text-transform: capitalize;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 25px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.detail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.detail-item i {
    color: #667eea;
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.detail-item span:first-of-type {
    font-weight: 600;
    color: #374151;
    min-width: 80px;
}

.detail-item span:last-of-type {
    font-weight: 500;
    color: #6b7280;
    margin-left: auto;
}

/* Enhanced Forecast Section */
.forecast-result h3,
.hourly-forecast h3,
.air-quality h3,
.weather-map h3,
.city-comparison h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: clamp(1.3rem, 3vw, 1.6rem);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.forecast-result h3 i,
.hourly-forecast h3 i,
.air-quality h3 i,
.weather-map h3 i,
.city-comparison h3 i {
    color: #667eea;
    font-size: 1.2rem;
}

/* Enhanced Forecast Section Header */
.forecast-result {
    position: relative;
}

.forecast-result h3 {
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.forecast-result h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* Forecast Navigation Hint */
.forecast-cards::before {
    content: '← Swipe to see more →';
    position: absolute;
    top: -5px;
    right: 10px;
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
    opacity: 0.8;
}

@media (min-width: 769px) {
    .forecast-cards::before {
        display: none;
    }
}

/* Smooth scroll indicators */
.forecast-result {
    position: relative;
}

.forecast-scroll-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.forecast-scroll-indicator:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.forecast-scroll-left {
    left: -20px;
}

.forecast-scroll-right {
    right: -20px;
}

@media (max-width: 768px) {
    .forecast-scroll-indicator {
        display: none;
    }
}

.forecast-cards {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 15px 0;
    scroll-behavior: smooth;
    justify-content: flex-start;
}

.forecast-cards::-webkit-scrollbar {
    height: 6px;
}

.forecast-cards::-webkit-scrollbar-track {
    background: rgba(100, 116, 139, 0.1);
    border-radius: 3px;
}

.forecast-cards::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
}

.forecast-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    backdrop-filter: blur(10px);
    min-width: 160px;
    flex-shrink: 0;
    padding: 20px 16px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.forecast-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.forecast-card:hover {
    transform: translateY(-6px);
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.15),
        0 4px 8px rgba(0, 0, 0, 0.1);
}

.forecast-card h4 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.forecast-card img {
    width: 55px;
    height: 55px;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.weather-desc {
    color: #64748b;
    font-size: 0.8rem;
    margin-bottom: 10px;
    text-transform: capitalize;
    font-weight: 500;
}

.temp-range {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    align-items: center;
    gap: 8px;
}

.max-temp {
    font-weight: 700;
    font-size: 1.1rem;
    color: #f5576c;
}

.min-temp {
    color: #4facfe;
    font-weight: 600;
    font-size: 0.95rem;
}

.additional-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #64748b;
    padding-top: 8px;
    border-top: 1px solid rgba(100, 116, 139, 0.2);
    gap: 4px;
}

.additional-info > div {
    display: flex;
    align-items: center;
    gap: 2px;
}

.additional-info i {
    color: #667eea;
    font-size: 0.6rem;
}

/* Enhanced Hourly Forecast */
.hourly-cards {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 15px 0;
    scroll-behavior: smooth;
}

.hourly-cards::-webkit-scrollbar {
    height: 6px;
}

.hourly-cards::-webkit-scrollbar-track {
    background: rgba(100, 116, 139, 0.1);
    border-radius: 3px;
}

.hourly-cards::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
}

.hourly-card {
    min-width: 130px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
    backdrop-filter: blur(10px);
    padding: 18px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.hourly-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.hour-time {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.hourly-card img {
    width: 45px;
    height: 45px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.hour-temp {
    font-size: 1.3rem;
    font-weight: 700;
    color: #f5576c;
    margin: 8px 0;
}

.hour-desc {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 10px;
    font-weight: 500;
}

.hour-details {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

.hour-details div {
    margin: 3px 0;
}

/* Enhanced Air Quality */
.air-quality-content {
    display: flex;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.aqi-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.aqi-score::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: conic-gradient(from 0deg, #00e400, #ffff00, #ff7e00, #ff0000, #8f3f97);
    border-radius: 50%;
    z-index: -1;
}

.aqi-score::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: inherit;
    border-radius: 50%;
    z-index: -1;
}

.aqi-number {
    font-size: 2.5rem;
    font-weight: 800;
    z-index: 1;
}

.aqi-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 1;
}

.pollutants {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    flex-grow: 1;
}

.pollutant {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.pollutant:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pollutant span:first-child {
    color: #374151;
    font-weight: 700;
}

.pollutant span:last-child {
    color: #6b7280;
}

/* Recent Searches */
.recent-searches {
    margin-top: 15px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.6));
    backdrop-filter: blur(10px);
    border-radius: 12px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.recent-searches h4 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recent-searches h4 i {
    color: #667eea;
}

#recentCities {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-city {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.recent-city:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* Weather Map Enhanced */
.weather-map {
    text-align: center;
}

.map-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.map-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.map-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.map-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.map-placeholder {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* City Comparison Enhanced */
.comparison-inputs {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.comparison-inputs input {
    min-width: 180px;
    flex: 1;
    max-width: 250px;
}

.comparison-cards {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 25px;
    align-items: center;
}

.comparison-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.comparison-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.comparison-card h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-weight: 700;
    font-size: 1.1rem;
}

.comparison-card img {
    width: 70px;
    height: 70px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.comparison-temp {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 15px 0;
}

.comparison-desc {
    color: #64748b;
    margin-bottom: 20px;
    text-transform: capitalize;
    font-weight: 500;
    font-size: 1.1rem;
}

.comparison-details {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
}

.comparison-details div {
    margin: 6px 0;
    padding: 4px 0;
    border-bottom: 1px solid rgba(107, 114, 128, 0.1);
}

.comparison-details div:last-child {
    border-bottom: none;
}

.comparison-vs {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    align-self: center;
}

.comparison-summary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.comparison-summary h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-weight: 700;
    font-size: 1.2rem;
}

.summary-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(236, 240, 241, 0.8);
    color: #64748b;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

/* Enhanced Dark Theme */
body.dark-theme {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e2e8f0;
}

body.dark-theme .container {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 2px 16px rgba(0, 0, 0, 0.2);
}

body.dark-theme .container::before {
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
}

body.dark-theme h1 {
    background: linear-gradient(135deg, #667eea, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-theme h1 .fas {
    color: #667eea !important;
    -webkit-text-fill-color: #667eea !important;
}

body.dark-theme input {
    background: rgba(51, 65, 85, 0.8);
    color: #e2e8f0;
    border-color: rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(10px);
}

body.dark-theme input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

body.dark-theme input::placeholder {
    color: #94a3b8;
}

body.dark-theme .weather-result,
body.dark-theme .forecast-result,
body.dark-theme .hourly-forecast,
body.dark-theme .air-quality,
body.dark-theme .weather-map,
body.dark-theme .city-comparison {
    background: rgba(51, 65, 85, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .city-name,
body.dark-theme .forecast-result h3,
body.dark-theme .hourly-forecast h3,
body.dark-theme .air-quality h3,
body.dark-theme .weather-map h3,
body.dark-theme .city-comparison h3 {
    color: #e2e8f0;
}

body.dark-theme .condition {
    color: #cbd5e1;
}

body.dark-theme .coordinates,
body.dark-theme .feels-like {
    color: #94a3b8;
}

body.dark-theme .detail-item {
    background: rgba(71, 85, 105, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .detail-item span {
    color: #cbd5e1;
}

body.dark-theme .forecast-card,
body.dark-theme .hourly-card,
body.dark-theme .pollutant,
body.dark-theme .comparison-card,
body.dark-theme .comparison-summary {
    background: rgba(71, 85, 105, 0.8);
    backdrop-filter: blur(10px);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .forecast-card::before {
    background: linear-gradient(90deg, #667eea, #764ba2);
}

body.dark-theme .forecast-card h4,
body.dark-theme .comparison-card h4,
body.dark-theme .comparison-summary h4,
body.dark-theme .hour-time {
    color: #e2e8f0;
}

body.dark-theme .weather-desc,
body.dark-theme .hour-desc,
body.dark-theme .comparison-desc {
    color: #94a3b8;
}

body.dark-theme .additional-info {
    color: #94a3b8;
    border-top-color: rgba(148, 163, 184, 0.2);
}

body.dark-theme .additional-info i {
    color: #667eea;
}

body.dark-theme .recent-searches {
    background: rgba(51, 65, 85, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .recent-searches h4 {
    color: #e2e8f0;
}

body.dark-theme .temperature-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border: 1px solid rgba(102, 126, 234, 0.3);
}

body.dark-theme .map-placeholder {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .search-section,
body.dark-theme .recent-searches {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .recent-searches h4 {
    color: #ecf0f1;
}

body.dark-theme .city-name {
    color: #ecf0f1;
}

body.dark-theme .condition {
    color: #bdc3c7;
}

body.dark-theme .detail-item {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .hourly-forecast,
body.dark-theme .air-quality,
body.dark-theme .weather-map,
body.dark-theme .city-comparison {
    background: #4a6078;
}

body.dark-theme .hourly-card,
body.dark-theme .pollutant,
body.dark-theme .comparison-card,
body.dark-theme .comparison-summary {
    background: #5a708a;
    color: #ecf0f1;
}

body.dark-theme .comparison-card h4,
body.dark-theme .comparison-summary h4 {
    color: #ecf0f1;
}

/* Error message styling */
.error-message {
    color: #ef4444;
    font-weight: 600;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 4px solid #ef4444;
    backdrop-filter: blur(10px);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message::before {
    content: '⚠️';
    font-size: 1.2rem;
}

/* Enhanced Responsive Design */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
        margin: 5px auto;
    }
    
    .weather-details {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }
    
    .forecast-card {
        min-width: 150px;
    }
    
    .comparison-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .comparison-vs {
        order: 2;
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: clamp(12px, 3vw, 20px);
        border-radius: 16px;
        margin: 5px;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    input {
        min-width: unset;
        max-width: unset;
        width: 100%;
    }
    
    button {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }
    
    .control-panel {
        gap: 8px;
    }
    
    .control-panel button {
        flex: 1;
        min-width: 0;
        padding: 10px 8px;
        font-size: 0.8rem;
    }
    
    .weather-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .location-info {
        text-align: center;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .detail-item {
        padding: 12px;
    }
    
    .forecast-cards {
        gap: 12px;
        padding: 10px 0;
    }
    
    .forecast-card {
        min-width: 140px;
        padding: 18px 14px;
    }
    
    .forecast-card h4 {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .forecast-card img {
        width: 50px;
        height: 50px;
    }
    
    .hourly-cards {
        gap: 12px;
        padding: 10px 0;
    }
    
    .hourly-card {
        min-width: 110px;
        padding: 15px;
    }
    
    .air-quality-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .pollutants {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .map-controls {
        gap: 8px;
    }
    
    .map-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .comparison-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .comparison-inputs input {
        min-width: unset;
        max-width: unset;
        width: 100%;
    }
    
    .comparison-cards {
        gap: 12px;
    }
    
    .comparison-card {
        padding: 20px;
    }
    
    .comparison-temp {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: clamp(10px, 2.5vw, 15px);
        border-radius: 12px;
    }
    
    h1 {
        font-size: clamp(1.5rem, 5vw, 2rem);
        margin-bottom: 20px;
    }
    
    .main-temp {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
    
    .control-panel {
        flex-direction: column;
        gap: 8px;
    }
    
    .control-panel button {
        width: 100%;
    }
    
    .forecast-cards {
        gap: 10px;
    }
    
    .forecast-card {
        min-width: 130px;
        padding: 15px 12px;
    }
    
    .forecast-card h4 {
        font-size: 0.85rem;
    }
    
    .forecast-card img {
        width: 45px;
        height: 45px;
    }
    
    .hourly-card {
        min-width: 100px;
        padding: 12px;
    }
    
    .hour-temp {
        font-size: 1.1rem;
    }
    
    .aqi-score {
        width: 100px;
        height: 100px;
    }
    
    .aqi-number {
        font-size: 2rem;
    }
    
    .pollutants {
        grid-template-columns: 1fr;
    }
    
    .comparison-vs {
        font-size: 1.8rem;
    }
    
    .comparison-temp {
        font-size: 1.8rem;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 10px;
        margin: 2px;
    }
    
    .detail-item {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .hourly-card {
        min-width: 90px;
        padding: 10px;
    }
    
    .forecast-card {
        padding: 15px;
    }
    
    .comparison-card {
        padding: 15px;
    }
}

/* High DPI/Retina Display Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .weather-header img,
    .forecast-card img,
    .hourly-card img,
    .comparison-card img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Landscape Mode for Mobile Devices */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding: 15px;
    }
    
    .weather-header {
        flex-direction: row;
        gap: 20px;
    }
    
    .temperature-section {
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .main-temp {
        font-size: 3rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .container {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    .control-panel,
    .map-controls,
    button {
        display: none !important;
    }
    
    .weather-map,
    .city-comparison {
        display: none !important;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Accessibility */
button:focus-visible,
input:focus-visible,
.recent-city:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .container {
        border: 2px solid currentColor;
    }
    
    .forecast-card,
    .hourly-card,
    .detail-item {
        border: 1px solid currentColor;
    }
}