/* Graph UI Theme — clean, sharp meteogram presentation */
.theme-graph {
    background: linear-gradient(160deg, #f4f7fb 0%, #e8eef6 100%);
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Arial, sans-serif;
}

.theme-graph .container {
    border-radius: 18px;
    background-color: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 34px rgba(30, 41, 59, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.theme-graph .header {
    border-bottom: 1px solid rgba(100, 116, 139, 0.18);
}

.theme-graph .location-container h1 {
    color: #0f172a;
    letter-spacing: -0.02em;
}

.theme-graph #location-input,
.theme-graph #location-search-btn,
.theme-graph #locate-me-btn {
    border: 1px solid rgba(100, 116, 139, 0.3);
    background: rgba(255, 255, 255, 0.7);
    color: #1e293b;
}

.theme-graph #theme-switch,
.theme-graph #refresh-button {
    background-color: #2563eb;
    color: #fff;
    border: none;
    border-radius: 9px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    transition: all 0.2s ease;
}

.theme-graph #theme-switch:hover,
.theme-graph #refresh-button:hover:not(:disabled) {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.theme-graph #refresh-button:disabled {
    background-color: #94a3b8;
    box-shadow: none;
}

.theme-graph .current-weather {
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(30, 41, 59, 0.06);
    border: 1px solid rgba(100, 116, 139, 0.1);
}

.theme-graph .current-temp h2 {
    color: #ef4444;
    letter-spacing: -0.03em;
}

.theme-graph .weather-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.theme-graph .sunny-icon { background-image: url('../icons/sunny-modern.svg'); }
.theme-graph .cloudy-icon { background-image: url('../icons/cloudy-modern.svg'); }
.theme-graph .rainy-icon { background-image: url('../icons/rainy-modern.svg'); }
.theme-graph .stormy-icon { background-image: url('../icons/stormy-modern.svg'); }
.theme-graph .snowy-icon { background-image: url('../icons/snowy-modern.svg'); }
.theme-graph .partly-cloudy-icon { background-image: url('../icons/partly-cloudy-modern.svg'); }

.theme-graph .hourly-forecast {
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(30, 41, 59, 0.06);
    border: 1px solid rgba(100, 116, 139, 0.1);
}

.theme-graph .date-header {
    background-color: #fff;
    color: #475569;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    border-bottom: 1px solid rgba(100, 116, 139, 0.12);
}

.theme-graph .footer {
    color: #64748b;
    border-top: 1px solid rgba(100, 116, 139, 0.18);
}

/* ----- Meteogram ----- */
/* When the meteogram is mounted, free the container from the list layout */
.theme-graph #hourly-data.meteogram {
    flex-direction: row;
    overflow: visible;
    max-height: none;
    min-height: 0;
    padding: 0;
}

.meteogram {
    display: flex;
    align-items: stretch;
    width: 100%;
    --mg-header-h: 74px;
    --mg-temp: #ef4444;
}

/* Left key */
.mg-legend {
    flex: 0 0 132px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: calc(var(--mg-header-h) + 10px) 10px 14px 14px;
    border-right: 1px solid rgba(100, 116, 139, 0.12);
}

.mg-key {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 0.8rem;
    color: #64748b;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mg-key:hover {
    background: rgba(100, 116, 139, 0.07);
}

.mg-key.active {
    background: rgba(37, 99, 235, 0.06);
    border-color: color-mix(in srgb, var(--c) 35%, transparent);
    color: #0f172a;
}

.mg-swatch {
    width: 13px;
    height: 13px;
    border-radius: 4px;
    flex: 0 0 auto;
    background: var(--c);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 22%, transparent);
}

.mg-key-label {
    flex: 1 1 auto;
    font-weight: 600;
}

.mg-key.active .mg-key-label {
    font-weight: 700;
}

.mg-key-unit {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Scrolling plot */
.mg-scroll {
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    cursor: crosshair;
}

.mg-scroll::-webkit-scrollbar { height: 8px; }
.mg-scroll::-webkit-scrollbar-track { background: #f1f5f9; }
.mg-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.mg-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.mg-svg { display: block; }

.mg-night { fill: rgba(30, 41, 59, 0.045); }
.mg-grid { stroke: rgba(100, 116, 139, 0.13); stroke-width: 1; }
.mg-day-sep { stroke: rgba(100, 116, 139, 0.28); stroke-width: 1; stroke-dasharray: 3 3; }

.mg-day-label {
    fill: #0f172a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.mg-hour-label {
    fill: #94a3b8;
    font-size: 10.5px;
    font-weight: 600;
    text-anchor: middle;
}

.mg-cross {
    stroke: #0f172a;
    stroke-width: 1;
    stroke-dasharray: 4 3;
    opacity: 0.55;
    pointer-events: none;
}

.mg-dot {
    stroke: #fff;
    stroke-width: 1.5;
    pointer-events: none;
}

/* Right scale (active series) */
.mg-axis {
    flex: 0 0 54px;
    border-left: 1px solid rgba(100, 116, 139, 0.12);
}

.mg-axis-tick {
    fill: #475569;
    font-size: 11px;
    font-weight: 600;
    text-anchor: end;
}

.mg-axis-unit {
    fill: var(--c, #475569);
    font-size: 11px;
    font-weight: 700;
    text-anchor: middle;
}

/* Tooltip */
.mg-tooltip {
    position: absolute;
    top: 80px;
    z-index: 20;
    min-width: 124px;
    padding: 9px 11px;
    background: rgba(15, 23, 42, 0.93);
    color: #f8fafc;
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
    font-size: 0.78rem;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.mg-tip-time {
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.mg-tip-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 1.5px 0;
    opacity: 0.78;
}

.mg-tip-row.active {
    opacity: 1;
    font-weight: 700;
}

.mg-tip-dot {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    flex: 0 0 auto;
}

.mg-tip-label { flex: 1 1 auto; }
.mg-tip-val { font-variant-numeric: tabular-nums; }

/* Responsive: collapse the left key on narrow screens */
@media (max-width: 600px) {
    .mg-legend {
        flex-basis: 96px;
        padding-left: 8px;
        padding-right: 6px;
    }
    .mg-key-unit { display: none; }
}
