/**
 * Weather Widget - Professional Light Theme
 * Clean, polished, and readable.
 */

:root {
    --ww-primary: #2563eb;       /* Professional Blue */
    --ww-bg-surface: #ffffff;    /* Pure White */
    --ww-bg-subtle: #f8fafc;     /* Slate 50 */
    --ww-border: #e2e8f0;        /* Slate 200 */
    --ww-text-main: #1e293b;     /* Slate 800 */
    --ww-text-muted: #64748b;    /* Slate 500 */
    --ww-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Overlay */
.weather-widget-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4); /* Professional dim */
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.weather-widget-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Main Drawer */
.weather-widget-drawer {
    position: relative;
    width: 100%;
    max-width: 1040px;
    max-height: 95vh;
    
    /* Clean Light Surface */
    background: var(--ww-bg-surface);
    border: 1px solid var(--ww-border);
    border-radius: 20px;
    box-shadow: var(--ww-shadow-lg);
    color: var(--ww-text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Smooth spring */
    margin: 0 auto;
}

.weather-widget-overlay.open .weather-widget-drawer {
    transform: translateY(0);
}

/* Header */
.weather-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--ww-border);
    background: var(--ww-bg-surface);
    border-radius: 20px 20px 0 0; /* Match container radius */
    flex-shrink: 0;
}

.weather-widget-location {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ww-text-main);
}

.weather-widget-location i {
    color: var(--ww-primary);
    font-size: 1.2rem;
}

.weather-widget-close-btn {
    background: var(--ww-bg-subtle);
    border: 1px solid transparent;
    color: var(--ww-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 2px; /* Visual alignment fix */
}

.weather-widget-close-btn:hover {
    background: #e2e8f0;
    color: var(--ww-text-main);
}

/* Content */
.weather-widget-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
    padding: 10px 0;
    background: #ffffff;
}

/* Scrollbar Styling (Darker for light theme) */
.weather-widget-content::-webkit-scrollbar {
    width: 6px;
}

.weather-widget-content::-webkit-scrollbar-track {
    background: transparent;
}

.weather-widget-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.weather-widget-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Days Container */
.weather-widget-days {
    display: flex;
    flex-direction: column;
}

/* Wind Graph */
.weather-widget-wind-graph {
    height: 120px;
    margin-top: 8px;
    border-top: 1px solid var(--ww-border);
    background: var(--ww-bg-surface);
    position: relative;
    overflow: visible;
    width: 100%;
    z-index: 1;
}

.weather-widget-wind-graph svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Wind Graph Tooltip */
.weather-widget-wind-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.weather-widget-wind-tooltip.visible {
    opacity: 1;
}

/* Day Row */
.weather-widget-day-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--ww-border);
}

.weather-widget-day-row:last-child {
    border-bottom: none;
}

/* Day Header */
.weather-widget-day-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.weather-widget-day-header .day-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--ww-text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-widget-day-header .day-date {
    font-size: 0.85rem;
    color: var(--ww-text-muted);
    font-weight: 500;
}

/* Hours Scroll */
.weather-widget-hours-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px; /* Space for scrollbar */
    -webkit-overflow-scrolling: touch;
}

.weather-widget-hours-scroll::-webkit-scrollbar {
    height: 4px;
}

.weather-widget-hours-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.weather-widget-hours-scroll::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}

.weather-widget-hours-container {
    display: flex;
    gap: 10px;
    /* Added padding so the zoomed card doesn't get cut off at the top */
    padding: 12px 6px; 
    min-width: max-content;
}

/* Hour Card */
.weather-widget-hour-card {
    background: var(--ww-bg-subtle);
    border: 1px solid var(--ww-border);
    border-radius: 12px;
    padding: 12px 14px;
    width: 100px;
    text-align: center;
    /* Bouncy bezier for smooth zoom effect */
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
    position: relative; /* Necessary for z-index on hover */
}

/* Zoom Effect */
.weather-widget-hour-card:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    /* Scales up 15% */
    transform: scale(1.15); 
    /* Ensures it sits on top of neighboring cards */
    z-index: 10;
    /* Deeper shadow for "lifted" look */
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

/* Current Hour Highlight */
.weather-widget-hour-card.current {
    background: #eff6ff; /* Blue-50 */
    border-color: #bfdbfe; /* Blue-200 */
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
}

.weather-widget-hour {
    font-size: 0.75rem;
    color: var(--ww-text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.weather-widget-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
    display: block;
    /* Shadows to make icons pop on white */
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.05));
}

.weather-widget-temp {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ww-text-main);
}

.weather-widget-temp-unit {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ww-text-muted);
    vertical-align: top;
    margin-left: 1px;
}

/* Weather Details */
.weather-widget-details {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.weather-widget-detail-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--ww-text-muted);
    font-weight: 500;
}

.weather-widget-detail-row i {
    font-size: 0.75rem;
}

.weather-widget-detail-row.rain {
    color: #2563eb; /* Stronger blue */
}

.weather-widget-detail-row.wind {
    color: #64748b;
}

/* Icon Colors - Adjusted for Light Backgrounds */
.weather-widget-icon.sunny { color: #d97706; }        /* Amber-600 */
.weather-widget-icon.cloudy { color: #64748b; }       /* Slate-500 */
.weather-widget-icon.partly-cloudy { color: #f59e0b; }/* Amber-500 */
.weather-widget-icon.rainy { color: #2563eb; }        /* Blue-600 */
.weather-widget-icon.stormy { color: #7c3aed; }       /* Violet-600 */
.weather-widget-icon.night { color: #4f46e5; }        /* Indigo-600 */

/* Loading State */
.weather-widget-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--ww-text-muted);
    text-align: center;
}

.weather-widget-loading-icon {
    font-size: 3rem;
    color: #f59e0b;
    animation: weather-widget-pulse 1.5s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes weather-widget-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.weather-widget-loading p {
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

/* Error State */
.weather-widget-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #ef4444; /* Alert Red */
    text-align: center;
}

.weather-widget-error i {
    font-size: 3rem;
    margin-bottom: 15px;
}

.weather-widget-error p {
    margin: 0 0 20px 0;
    color: var(--ww-text-main);
}

.weather-widget-retry-btn {
    background: #ffffff;
    border: 1px solid var(--ww-border);
    color: var(--ww-text-main);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.weather-widget-retry-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .weather-widget-drawer {
        border-radius: 16px 16px 0 0;
    }

    .weather-widget-day-header .day-name {
        font-size: 0.9rem;
    }

    .weather-widget-day-row {
        padding: 12px 16px;
    }

    .weather-widget-hour-card {
        min-width: 80px;
        padding: 10px 8px;
    }
}