/* ========== 天气卡片 - 毛玻璃贴边设计 ========== */

/* ========== PC端 ========== */
@media (min-width: 769px) {
    .weather-card {
        position: fixed;
        right: 0;
        top: 75%;
        transform: translateY(-50%);
        z-index: 99999;
        cursor: pointer;
        pointer-events: none;
    }
    
    /* 只有可见部分可以触发悬停 */
    .weather-card .weather-card-inner {
        pointer-events: auto;
    }

    .weather-card-inner {
        background: rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-radius: 28px 0 0 28px;
        padding: 18px 20px;
        box-shadow: -4px 6px 20px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.5);
        border-right: none;
        transition: transform 0.35s ease;
        transform: translateX(50%);
        min-width: 180px;
        max-width: 180px;
        min-height: 330px;
        box-sizing: border-box;
        
        /* 按钮贴底布局 */
        display: flex;
        flex-direction: column;
    }

    /* 内容区域 - 正常文档流 */
    .weather-content {
        flex: 1;
        width: 100%;
    }

    /* 今日和未来3天内容 - 正常显示 */
    #todayContent,
    #forecastContent {
        width: 100%;
    }

    .weather-card-main {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        text-align: center;
        flex-shrink: 0;
    }

    .weather-icon {
        font-size: 32px;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    }

    .weather-temp {
        font-size: 20px;
        font-weight: 700;
        color: #e67e22;
        line-height: 1;
        white-space: nowrap;
    }

    .weather-temp small {
        font-size: 12px;
        font-weight: 400;
        color: rgba(0, 0, 0, 0.5);
        vertical-align: super;
    }

    .weather-city {
        font-size: 11px;
        color: rgba(0, 0, 0, 0.65);
        white-space: nowrap;
        font-weight: 500;
        text-align: center;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .weather-details {
        margin-top: 10px;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.3);
        width: 100%;
    }

    .detail-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 4px 0;
        font-size: 11px;
        white-space: nowrap;
    }

    .detail-row .label {
        width: 36px;
        opacity: 0.65;
        font-size: 10px;
        color: #333;
    }

    .detail-row .value {
        flex: 1;
        font-weight: 500;
        color: #333;
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 未来3天天气预报样式 */
    .forecast-container {
        margin-top: 10px;
        width: 100%;
    }

    .forecast-week-row,
    .forecast-icon-row,
    .forecast-weather-row,
    .forecast-temp-row,
    .forecast-wind-row,
    .forecast-power-row {
        display: flex;
        justify-content: space-around;
        text-align: center;
        margin: 4px 0;
    }

    .forecast-week-item {
        flex: 1;
        font-size: 11px;
        font-weight: 600;
        color: #e67e22;
        padding: 4px 0;
    }

    .forecast-icon-item {
        flex: 1;
        font-size: 24px;
        padding: 4px 0;
    }

    .forecast-weather-item {
        flex: 1;
        font-size: 10px;
        color: #333;
        padding: 2px 0;
    }

    .forecast-temp-item {
        flex: 1;
        font-size: 10px;
        color: #333;
        padding: 2px 0;
        white-space: nowrap;
    }

    .forecast-wind-item {
        flex: 1;
        font-size: 10px;
        color: #333;
        padding: 2px 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .forecast-power-item {
        flex: 1;
        font-size: 10px;
        color: #333;
        padding: 2px 0;
    }

    /* 按钮 - 始终在底部 */
    .forecast-btn {
        margin-top: 12px;
        padding: 5px 0;
        text-align: center;
        font-size: 10px;
        color: rgba(0, 0, 0, 0.6);
        background: rgba(255, 255, 255, 0.3);
        border-radius: 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 100%;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }

    .forecast-btn:hover {
        background: rgba(255, 255, 255, 0.5);
        color: #e67e22;
    }

    .forecast-btn .btn-icon {
        font-size: 10px;
        transition: transform 0.3s ease;
    }

    .forecast-btn.active .btn-icon {
        transform: rotate(180deg);
    }

    /* 更新时间 */
    .update-time {
        margin-top: 8px;
        padding-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        font-size: 9px;
        text-align: center;
        color: rgba(0, 0, 0, 0.5);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .weather-content.fade-out {
        opacity: 0;
    }

    .weather-card:hover .weather-card-inner {
        transform: translateX(0);
        background: rgba(255, 255, 255, 0.3);
    }

    .weather-card.show-full .weather-card-inner {
        transform: translateX(0);
        background: rgba(255, 255, 255, 0.3);
    }
    
    /* 预报标识样式 */
    .forecast-badge {
        display: none;
        font-size: 9px;
        color: rgba(0, 0, 0, 0.5);
        text-align: center;
        margin-top: 0;
    }
    
    /* 深色模式 */
        .forecast-badge {
            color: rgba(255, 255, 255, 0.5);
        }
    }

/* ========== 移动端 ========== */
@media (max-width: 768px) {
    .weather-card {
        position: fixed;
        bottom: 16px;
        right: 16px;
        z-index: 99999;
    }

    .weather-card .weather-card-inner {
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 0;
        border: none;
        box-shadow: none;
        transition: all 0.2s ease;
    }

    .weather-card .weather-card-main {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        background: transparent;
    }

    .weather-card .weather-icon {
        font-size: 28px;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
        background: transparent;
    }

    .weather-card .weather-temp {
        font-size: 16px;
        font-weight: 700;
        color: #e67e22;
        line-height: 1;
        background: transparent;
    }

    .weather-card .weather-temp small {
        font-size: 10px;
        font-weight: 400;
        color: rgba(0, 0, 0, 0.5);
    }

    .weather-card .weather-city,
    .weather-card .weather-details,
    .weather-card .forecast-btn,
    .weather-card .update-time {
        display: none;
    }

    .weather-card.open .weather-card-inner {
        position: fixed;
        bottom: 80px;
        right: 16px;
        width: 230px;
        background: rgba(255, 255, 255, 0.3) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border-radius: 24px;
        padding: 16px 18px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.4);
        display: block;
        transition: all 0.25s ease;
    }

    .weather-card.open .weather-card-main {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 14px;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        width: 100%;
    }

    .weather-card.open .weather-icon {
        font-size: 40px;
        background: transparent;
    }

    .weather-card.open .weather-temp {
        font-size: 28px;
        background: transparent;
    }

    .weather-card.open .weather-temp small {
        font-size: 14px;
        vertical-align: super;
    }

    .weather-card.open .weather-city {
        display: block;
        font-size: 14px;
        font-weight: 500;
        color: #333;
        text-align: right;
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        background: transparent;
    }

    .weather-card.open .weather-details {
        display: block;
        margin-bottom: 12px;
    }

    .detail-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        font-size: 13px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .detail-row:last-child {
        border-bottom: none;
    }

    .detail-row .label {
        opacity: 0.6;
        font-size: 12px;
        color: #555;
    }

    .detail-row .value {
        font-weight: 600;
        color: #333;
        font-size: 13px;
    }

    /* 移动端未来3天样式 */
    .forecast-week-row,
    .forecast-icon-row,
    .forecast-weather-row,
    .forecast-temp-row,
    .forecast-wind-row,
    .forecast-power-row {
        display: flex;
        justify-content: space-around;
        text-align: center;
        margin: 6px 0;
    }

    .forecast-week-item {
        flex: 1;
        font-size: 13px;
        font-weight: 600;
        color: #e67e22;
        padding: 4px 0;
    }

    .forecast-icon-item {
        flex: 1;
        font-size: 28px;
        padding: 4px 0;
    }

    .forecast-weather-item {
        flex: 1;
        font-size: 12px;
        color: #333;
        padding: 2px 0;
    }

    .forecast-temp-item {
        flex: 1;
        font-size: 11px;
        color: #333;
        padding: 2px 0;
        white-space: nowrap;
    }

    .forecast-wind-item {
        flex: 1;
        font-size: 11px;
        color: #333;
        padding: 2px 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .forecast-power-item {
        flex: 1;
        font-size: 11px;
        color: #333;
        padding: 2px 0;
    }

    .weather-card.open .forecast-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
        padding: 10px 0;
        margin-top: 10px;
        background: rgba(0, 0, 0, 0.06);
        border-radius: 30px;
        font-size: 13px;
        font-weight: 500;
        color: #e67e22;
        cursor: pointer;
    }

    .weather-card.open .update-time {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        margin-top: 10px;
        padding-top: 8px;
        font-size: 10px;
        color: rgba(0, 0, 0, 0.45);
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }
}

/* ========== 深色模式 ========== */

/* 深色模式 - 移动端 */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .weather-card .weather-temp {
        color: #ffb347;
    }

    .weather-card .weather-temp small {
        color: rgba(255, 255, 255, 0.5);
    }

    .weather-card.open .weather-card-inner {
        background: rgba(30, 30, 45, 0.6) !important;
        border-color: rgba(255, 255, 255, 0.2);
    }

    .weather-card.open .weather-city {
        color: #eee;
    }

    .detail-row .label {
        color: rgba(255, 255, 255, 0.6);
    }

    .detail-row .value {
        color: #eee;
    }

    .forecast-weather-item,
    .forecast-temp-item,
    .forecast-wind-item,
    .forecast-power-item {
        color: #eee;
    }

    .weather-card.open .forecast-btn {
        background: rgba(255, 255, 255, 0.1);
        color: #ffb347;
    }

    .weather-card.open .update-time {
        color: rgba(255, 255, 255, 0.4);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

/* 深色模式 - PC端 */
@media (min-width: 769px) and (prefers-color-scheme: dark) {
    .forecast-weather-item,
    .forecast-temp-item,
    .forecast-wind-item,
    .forecast-power-item {
        color: #eee;
    }

    .forecast-btn {
        background: rgba(255, 255, 255, 0.15);
        color: #ffb347;
    }

    .forecast-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }
    
    .forecast-badge {
        color: rgba(255, 255, 255, 0.5);
    }
}

/* ========== 写实天气动画 ========== */

/* 动画容器 */
.weather-animation {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
    z-index: 0;
}

/* 确保卡片内容在动画上层 */
.weather-card-inner > *:not(.weather-animation) {
    position: relative;
    z-index: 1;
}

/* 晴天动画 */
.weather-animation.sunny {
    background: radial-gradient(ellipse at 30% 30%, rgba(255, 230, 120, 0.25) 0%, rgba(255, 200, 80, 0.1) 40%, transparent 70%);
    animation: sunnyPulse 4s ease-in-out infinite;
}

@keyframes sunnyPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
}

.sun-ray {
    position: absolute;
    background: linear-gradient(90deg, rgba(255, 215, 100, 0.6), rgba(255, 215, 100, 0));
    width: 100px;
    height: 2px;
    border-radius: 50%;
    filter: blur(1px);
}

/* 雨天动画 */
.weather-animation.rainy {
    overflow: hidden;
}

.rain-drop-front {
    position: absolute;
    top: -30px;
    width: 2px;
    height: 15px;
    background: linear-gradient(180deg, rgba(100, 180, 255, 0.9), rgba(80, 140, 220, 0.3));
    border-radius: 2px;
    animation: rainFallFront linear infinite;
}

@keyframes rainFallFront {
    0% { top: -30px; opacity: 0; }
    10% { opacity: 0.9; }
    90% { opacity: 0.9; }
    100% { top: 100%; opacity: 0; }
}

.rain-ripple {
    position: absolute;
    bottom: 10px;
    border-radius: 50%;
    animation: rippleExpand 1.5s ease-out infinite;
}

.rain-ripple::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(100, 180, 255, 0.5);
}

@keyframes rippleExpand {
    0% { width: 0; height: 0; opacity: 0.6; }
    100% { width: 40px; height: 40px; opacity: 0; }
}

/* 雪天动画 */
.weather-animation.snowy {
    overflow: hidden;
}

.snow-flake-real {
    position: absolute;
    top: -15px;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    filter: blur(1px);
    animation: snowFallReal linear infinite;
}

@keyframes snowFallReal {
    0% { top: -15px; opacity: 0; }
    10% { opacity: 0.9; }
    90% { opacity: 0.9; }
    100% { top: 100%; opacity: 0; }
}

/* 多云/阴天动画 */
.weather-animation.cloudy {
    background: linear-gradient(135deg, rgba(120, 120, 140, 0.15) 0%, rgba(90, 90, 110, 0.08) 100%);
}

.cloud-real {
    position: absolute;
    background: radial-gradient(ellipse at 30% 40%, rgba(160, 160, 175, 0.4), rgba(120, 120, 140, 0.15));
    border-radius: 50%;
    filter: blur(12px);
    animation: cloudFloatReal 20s ease-in-out infinite;
}

@keyframes cloudFloatReal {
    0% { transform: translateX(-15px); }
    50% { transform: translateX(15px); }
    100% { transform: translateX(-15px); }
}

/* 雾天动画 */
.weather-animation.foggy {
    background: linear-gradient(90deg, rgba(180, 180, 190, 0.25), rgba(200, 200, 210, 0.15), rgba(180, 180, 190, 0.25));
    background-size: 200% 100%;
    animation: fogMoveReal 10s ease-in-out infinite;
}

@keyframes fogMoveReal {
    0% { background-position: 0% 0; opacity: 0.4; }
    50% { background-position: 100% 0; opacity: 0.7; }
    100% { background-position: 0% 0; opacity: 0.4; }
}

/* 动画可见度控制 */
@media (min-width: 769px) {
    .weather-card:hover .weather-animation {
        opacity: 1;
        transition: opacity 0.4s ease;
    }

    .weather-card .weather-animation {
        opacity: 0.5;
        transition: opacity 0.4s ease;
    }
}

@media (max-width: 768px) {
    .weather-card.open .weather-animation {
        opacity: 1;
    }

    .weather-card .weather-animation {
        opacity: 0;
        transition: opacity 0.3s ease;
    }
}

/* 加载动画 */
.weather-loading {
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ========== 切换动画 ========== */

/* 内容容器过渡效果 */
#todayContent,
#forecastContent {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* 淡出动画 */
.fade-out {
    opacity: 0 !important;
    transform: translateY(-8px);
    pointer-events: none;
}

/* 淡入动画 */
.fade-in {
    animation: fadeInUp 0.25s ease forwards;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}