/* ==========================================
   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);
}

html[data-theme="light"] .weather-widget:hover {
    background: rgba(255, 255, 255, 0.4);
}

.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: 185px;
    background: rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0.7rem;
    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.35);
    border-color: rgba(255, 255, 255, 0.45);
}

.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. 响应式
   ========================= */
@media (max-width: 768px) {
    .weather-detail {
        right: -10px;
        width: 175px;
    }
}

@media (max-width: 480px) {
    .weather-widget {
        padding: 0.3rem 0.55rem;
    }

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

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

    .weather-country {
        font-size: 0.65rem;
        max-width: 40px;
    }

    .weather-city {
        font-size: 0.7rem;
        max-width: 48px;
    }
}
