/* ==========================================
   Weather - 天气组件样式
   ========================================== */

/* =========================
   1. Canvas 天气画布
   ========================= */
#weather-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    transition: opacity 1.5s ease;
    opacity: 0;
    background: #0c1830;
}

html[data-theme="light"] #weather-canvas {
    background: #3a5a8a;
}

body.weather-active #weather-canvas {
    opacity: 1;
    transition: opacity 0.3s ease;
}

body.weather-active .background-overlay {
    opacity: 0;
    transition: opacity 1.5s ease 0.3s;
}

/* =========================
   1b. 前景天气画布（覆盖在所有 UI 之上）
   ========================= */
#weather-foreground {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

body.weather-active #weather-foreground {
    opacity: 1;
    transition: opacity 0.6s ease 0.3s;
}

/* =========================
   2. 天气小组件
   ========================= */
.weather-widget {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(15, 23, 42, 0.15);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    padding: 0.35rem 0.65rem 0.35rem 0.5rem;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    z-index: 150;
}

html[data-theme="light"] .weather-widget {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.35);
}

.weather-widget:hover {
    background: rgba(15, 23, 42, 0.22);
    transform: scale(1.04);
}

.weather-widget:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.weather-widget-main {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.weather-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.weather-info {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.weather-temp {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.weather-country {
    font-size: 0.7rem;
    color: var(--text-secondary);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.1;
    display: none;
}

.weather-city {
    font-size: 0.78rem;
    color: var(--text-primary);
    max-width: 65px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.1;
}

/* =========================
   3. 详情面板
   ========================= */
.weather-detail {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(34px) saturate(170%);
    -webkit-backdrop-filter: blur(34px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 0.75rem;
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
    pointer-events: none;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 200;
}

html[data-theme="light"] .weather-detail {
    background: rgba(255, 255, 255, 0.58);
    border-color: rgba(255, 255, 255, 0.62);
}

.weather-detail.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

.weather-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
}

.weather-detail-row + .weather-detail-row {
    border-top: 1px solid var(--divider);
}

.weather-detail-label {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.weather-detail-value {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* =========================
   4. 响应式
   ========================= */

.weather-detail-section {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--divider);
}

.weather-section-title {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.28rem;
}

.weather-warning-content {
    font-size: 0.74rem;
}

.weather-warning-main {
    color: #f97316;
    font-weight: 700;
    line-height: 1.25;
}

.weather-warning-sub {
    margin-top: 0.15rem;
    color: var(--text-secondary);
    font-size: 0.68rem;
}

.weather-air-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem;
}

.weather-air-aqi {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.weather-air-level {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.weather-air-sub {
    margin-top: 0.15rem;
    font-size: 0.66rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.weather-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
}

.weather-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.14rem 0.38rem;
    border-radius: 999px;
    font-size: 0.63rem;
    color: var(--text-primary);
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.weather-chip-empty {
    font-size: 0.66rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .weather-detail {
        right: -10px;
        width: 235px;
    }
}

@media (max-width: 480px) {
    .weather-detail {
        position: fixed;
        left: 50%;
        right: auto;
        top: auto;
        bottom: 0.45rem;
        transform: translateX(-50%) translateY(14px) scale(0.985);
        width: min(94vw, 360px);
        max-height: min(66vh, 520px);
        overflow-y: auto;
        border-radius: 16px;
    }

    .weather-detail.show {
        transform: translateX(-50%) translateY(0) scale(1);
    }

    .weather-widget {
        padding: 0.24rem 0.48rem;
        gap: 0.32rem;
    }

    .weather-widget-main {
        gap: 0.3rem;
    }

    .weather-icon {
        width: 18px;
        height: 18px;
    }

    .weather-temp {
        font-size: 0.76rem;
    }

    .weather-country {
        font-size: 0.63rem;
        max-width: 36px;
    }

    .weather-city {
        font-size: 0.66rem;
        max-width: 44px;
    }
}

