/* ==========================================================================
   4MQTT Flow - Weather Widget & Details Inspector Styles
   ========================================================================== */

/* --- DASHBOARD WIDGET CARD --- */
.widget-card:has(.widget-weather-card) {
    overflow: hidden;
}

.widget-card:has(.widget-weather-card) .widget-head {
    margin-bottom: 4px;
    flex-shrink: 0;
}

.widget-card:has(.widget-weather-card) .widget-body {
    flex: 1 1 auto;
    min-height: 0 !important;
    width: 100%;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    align-items: stretch;
}

.widget-card:has(.widget-weather-card) .widget-body-row {
    align-items: stretch;
    justify-content: stretch;
    min-height: 0 !important;
}

.widget-weather-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    user-select: none;
    transition: box-shadow 0.18s ease, border-color 0.18s ease, background 0.3s ease;
}

.widget-weather-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.widget-weather-card:active {
    opacity: 0.95;
}

/* Card Styles: Tinted vs Standard */
.widget-weather-card.style-tinted.is-day-clear {
    background: linear-gradient(135deg, rgba(14, 116, 144, 0.32) 0%, rgba(30, 41, 59, 0.85) 100%);
    border: 1px solid rgba(56, 189, 248, 0.28);
}

.widget-weather-card.style-tinted.is-day-cloudy {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.35) 0%, rgba(15, 23, 42, 0.88) 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.widget-weather-card.style-tinted.is-rain {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.42) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.widget-weather-card.style-tinted.is-night {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.45) 0%, rgba(15, 23, 42, 0.92) 100%);
    border: 1px solid rgba(129, 140, 248, 0.25);
}

.widget-weather-card.style-standard {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 4px 2px;
}

.widget-weather-card.style-standard:hover {
    box-shadow: none !important;
}

/* Header line inside card */
.widget-weather-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
    flex-shrink: 0;
}

/* Leave room for floating 3-dots actions menu when widget title is hidden */
.widget-card.is-no-title .widget-weather-top {
    padding-right: 28px;
}

.widget-weather-city-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f8fafc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.widget-weather-city-badge i {
    color: var(--accent-cyan, #38bdf8);
    font-size: 0.76rem;
}

.widget-weather-updated-pill {
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Hero Row: Big Icon + Big Temp + Condition */
.widget-weather-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2px 0 4px 0;
    flex: 1 1 auto;
    min-height: 0;
}

.widget-weather-temp-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.widget-weather-temp {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    font-family: var(--font-display, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
}

.widget-weather-temp-deg {
    font-size: 1.15rem;
    font-weight: 400;
    opacity: 0.85;
    margin-left: 2px;
}

.widget-weather-cond-text {
    font-size: 0.8rem;
    line-height: 1.15;
    color: #cbd5e1;
    font-weight: 500;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 170px;
}

.widget-weather-feels {
    font-size: 0.7rem;
    line-height: 1.15;
    color: #94a3b8;
    margin-top: 1px;
}

.widget-weather-icon-hero {
    font-size: 2.2rem;
    color: var(--accent-cyan, #38bdf8);
    filter: drop-shadow(0 4px 12px rgba(56, 189, 248, 0.35));
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    flex-shrink: 0;
}

/* Sub-metrics bar */
.widget-weather-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    padding: 3px 8px;
    margin-top: auto;
    flex-shrink: 0;
}

.widget-weather-sub-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    color: #cbd5e1;
    font-weight: 500;
    white-space: nowrap;
}

.widget-weather-sub-item i {
    font-size: 0.7rem;
    color: var(--accent-cyan, #38bdf8);
    opacity: 0.9;
}

/* Mini forecast strip on widget */
.widget-weather-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.widget-weather-strip-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    font-size: 0.7rem;
    color: #cbd5e1;
}

.widget-weather-strip-day {
    font-weight: 600;
    color: #94a3b8;
}

.widget-weather-strip-col i {
    font-size: 0.95rem;
    color: var(--accent-cyan, #38bdf8);
    margin: 2px 0;
}

.widget-weather-strip-temp {
    font-size: 0.72rem;
    font-weight: 600;
}

/* --- DETAILED WEATHER INSPECTOR --- */
.weather-details-viewport {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #090d16;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.weather-details-viewport.is-fullscreen-pure {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    background: #060911 !important;
}

/* Fullscreen Top HUD */
.weather-details-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: rgba(9, 13, 22, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Scrollable Container */
.weather-details-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px 32px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.weather-details-viewport.is-fullscreen-pure .weather-details-scroll {
    padding-top: 64px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* Smart Alert Banner */
.weather-alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.18) 0%, rgba(245, 158, 11, 0.08) 100%);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 10px;
    padding: 10px 16px;
    color: #fed7aa;
    font-size: 0.85rem;
    font-weight: 500;
    flex-shrink: 0;
    animation: weatherAlertPulse 3s infinite ease-in-out;
}

@keyframes weatherAlertPulse {
    0%, 100% { border-color: rgba(245, 158, 11, 0.35); }
    50% { border-color: rgba(245, 158, 11, 0.7); box-shadow: 0 0 14px rgba(245, 158, 11, 0.2); }
}

.weather-alert-banner i {
    font-size: 1.25rem;
    color: #fb923c;
    flex-shrink: 0;
}

/* Hero Overview Card in Inspector */
.weather-details-hero-card {
    background: linear-gradient(135deg, rgba(14, 116, 144, 0.2) 0%, rgba(30, 41, 59, 0.6) 100%);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 14px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
    flex-shrink: 0;
}

.weather-hero-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.weather-hero-city-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.weather-hero-city-title i {
    color: var(--accent-cyan, #38bdf8);
}

.weather-hero-temp-large {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    color: #ffffff;
    margin: 8px 0 4px 0;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.weather-hero-condition {
    font-size: 1.05rem;
    color: #e2e8f0;
    font-weight: 500;
}

.weather-hero-range-pills {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #94a3b8;
}

.weather-hero-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.weather-hero-big-icon {
    font-size: 4.5rem;
    color: var(--accent-cyan, #38bdf8);
    filter: drop-shadow(0 6px 18px rgba(56, 189, 248, 0.4));
}

/* 24h Hourly Forecast Timeline */
.weather-section-block {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.weather-section-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.weather-section-title i {
    color: var(--accent-cyan, #38bdf8);
}

.weather-hourly-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.weather-hourly-card {
    min-width: 68px;
    padding: 10px 8px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.15s ease;
}

.weather-hourly-card:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.3);
    transform: translateY(-2px);
}

.weather-hourly-hour {
    font-size: 0.76rem;
    color: #94a3b8;
    font-weight: 500;
}

.weather-hourly-icon {
    font-size: 1.3rem;
    color: var(--accent-cyan, #38bdf8);
    margin: 3px 0;
}

.weather-hourly-temp {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.weather-hourly-rain {
    font-size: 0.68rem;
    color: #60a5fa;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
}

.weather-hourly-wind {
    font-size: 0.68rem;
    color: #94a3b8;
}

/* 7-Day Forecast Cards List */
.weather-daily-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.weather-daily-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: background 0.15s ease;
}

.weather-daily-row:hover {
    background: rgba(30, 41, 59, 0.7);
}

.weather-daily-day {
    min-width: 80px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #f8fafc;
}

.weather-daily-icon-box {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.weather-daily-icon-box i {
    font-size: 1.25rem;
    color: var(--accent-cyan, #38bdf8);
    width: 24px;
    text-align: center;
}

.weather-daily-condition-label {
    font-size: 0.82rem;
    color: #cbd5e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weather-daily-rain-pill {
    font-size: 0.72rem;
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.15);
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
}

.weather-daily-temp-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 260px;
}

.weather-daily-tmin {
    font-size: 0.82rem;
    color: #94a3b8;
    min-width: 35px;
    text-align: right;
    font-weight: 500;
}

.weather-daily-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.weather-daily-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #38bdf8 0%, #fbbf24 100%);
}

.weather-daily-tmax {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    min-width: 35px;
}

/* Atmospheric Metrics 2x2 Grid */
.weather-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .weather-metrics-grid {
        grid-template-columns: 1fr;
    }
}

.weather-metric-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.weather-metric-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.weather-metric-card-header i {
    color: var(--accent-cyan, #38bdf8);
    font-size: 0.85rem;
}

.weather-metric-val-large {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.weather-metric-unit {
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
}

.weather-metric-subtext {
    font-size: 0.78rem;
    color: #cbd5e1;
    line-height: 1.35;
}
