:root {
    --primary: #0ea5e9;
    --primary-glow: rgba(14, 165, 233, 0.4);
    --accent: #f43f5e;
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(15, 23, 42, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 0% 0%, rgba(14, 165, 233, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(244, 63, 94, 0.15) 0%, transparent 50%),
        linear-gradient(rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.95));
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    padding: 20px;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Container */
.container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    animation: fadeInUp 0.8s ease-out;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

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

.city-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.city-selector label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.city-selector select {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.city-selector select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.city-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.last-update {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.update-indicator {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px var(--primary);
}

.refresh-btn {
    background: linear-gradient(135deg, var(--primary), #0284c7);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 20px var(--primary-glow);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--primary-glow);
}

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

h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 0.5rem;
    font-weight: 900;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.date {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Current Weather */
.current-weather {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
}

.temp-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.temperature {
    font-size: clamp(4rem, 10vw, 6rem);
    font-weight: 700;
    line-height: 1;
}

.weather-icon-large svg {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 0 20px currentColor);
    animation: float 3s ease-in-out infinite;
}

.weather-summary h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.weather-summary p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Weather Details Grid */
.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.detail-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    padding: 1.5rem;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.detail-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.1), transparent);
    transition: left 0.5s;
}

.detail-card:hover::before {
    left: 100%;
}

.detail-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 30px rgba(14, 165, 233, 0.2);
}

.detail-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.detail-label svg {
    width: 20px;
    height: 20px;
}

.detail-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Charts Section */
.charts-section {
    margin-bottom: 3rem;
}

.chart-container {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 2px;
}

/* Temperature Chart */
.temp-chart-wrapper {
    position: relative;
    height: 200px;
    margin-bottom: 2rem;
}

.chart-canvas {
    width: 100%;
    height: 100%;
}

/* Rain Chart */
.rain-chart-container {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    margin-bottom: 3rem;
}

.chart-wrapper {
    display: flex;
    align-items: flex-end;
    height: 180px;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.chart-wrapper::-webkit-scrollbar {
    height: 6px;
}

.chart-wrapper::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 3px;
}

.chart-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.chart-bar-group {
    flex: 1;
    min-width: 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, rgba(14, 165, 233, 0.8), rgba(14, 165, 233, 0.4));
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: all 0.3s ease;
    min-height: 3px;
}

.chart-bar:hover {
    background: linear-gradient(180deg, var(--primary), rgba(14, 165, 233, 0.6));
    transform: scaleY(1.05);
}

.chart-bar .tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.chart-bar:hover .tooltip {
    opacity: 1;
}

.chart-time {
    font-size: 0.7rem;
    margin-top: 8px;
    color: var(--text-muted);
    transform: rotate(-45deg);
    transform-origin: left top;
    white-space: nowrap;
}

/* Alerts Section */
.alerts-section {
    margin-bottom: 3rem;
    background: rgba(244, 63, 94, 0.15);
    backdrop-filter: blur(16px);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(244, 63, 94, 0.4);
    animation: fadeInUp 0.6s ease-out;
}

.alert-title {
    color: #fecaca;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-title svg {
    width: 24px;
    height: 24px;
}

/* Forecast Section */
.forecast-section {
    margin-top: 3rem;
}

.forecast-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: 600;
    text-align: center;
}

.forecast-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
}

.forecast-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.forecast-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}

.forecast-card:hover::after {
    opacity: 1;
}

.forecast-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 10px 40px rgba(14, 165, 233, 0.3);
}

.forecast-icon {
    margin: 1rem 0;
}

.forecast-icon svg {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 0 10px currentColor);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Error State */
.error-message {
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    color: #fecaca;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 2.5rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 2rem;
        border-radius: 24px;
    }
    
    .header-top {
        flex-direction: column;
        align-items: stretch;
    }
    
    .city-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .city-selector select {
        width: 100%;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    .current-weather {
        flex-direction: column;
        text-align: center;
        padding: 2rem;
    }
    
    .temp-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .temperature {
        font-size: 4rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .forecast-container {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .temperature {
        font-size: 3.5rem;
    }
    
    .weather-icon-large svg {
        width: 70px;
        height: 70px;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .detail-card {
        padding: 1.25rem;
    }
    
    .chart-wrapper {
        height: 150px;
    }
    
    .forecast-container {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .refresh-btn,
    .city-selector {
        display: none;
    }
}