/* 天气模块 - 最终修复版（问号提示层级最高，不被卡片遮挡） */
.jw-weather-btn {
    position: relative;
    display: inline-block;
    cursor: pointer;
}
.jw-weather-temp {
    position: absolute !important;
    top: -6px !important;
    right: -10px !important;
    font-size: 10px !important;
    line-height: 1 !important;
    padding: 2px 4px !important;
    border-radius: 4px !important;
    background: rgba(255,255,255,0.9) !important;
    color: #333 !important;
    font-weight: 500 !important;
    display: none;
    white-space: nowrap !important;
}
.io-black-mode .jw-weather-temp {
    background: rgba(50,50,50,0.9) !important;
    color: #fff !important;
}

/* 弹窗遮罩 */
.jw-weather-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 100002;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.2s, opacity 0.2s;
}
.jw-weather-modal.active {
    visibility: visible;
    opacity: 1;
}

/* 弹窗卡片 */
.jw-weather-panel {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    border-radius: 44px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    color: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "微软雅黑", sans-serif;
    padding: 28px 22px;
    box-sizing: border-box;
    text-align: center;
    scrollbar-width: none;
    -ms-overflow-style: none;
    outline: none;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(2px);
    transition: background 0.3s ease;
}
.jw-weather-panel::-webkit-scrollbar {
    display: none;
}

/* 画布层（动画粒子） */
#weatherCanvas {
    border-radius: 44px;
    overflow: hidden;
    display: block;
}

/* 头部 */
.jw-weather-header {
    margin-bottom: 20px;
}
.jw-weather-city {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: -0.3px;
}
.jw-weather-datetime {
    font-size: 13px;
    opacity: 0.9;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    display: inline-block;
    padding: 6px 16px;
    border-radius: 40px;
    font-weight: 500;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 定位状态 & 更新时间 */
.jw-weather-locate-status {
    font-size: 12px;
    margin: 8px 0 4px;
    min-height: 20px;
}
.jw-weather-update {
    font-size: 11px;
    opacity: 0.7;
    margin-bottom: 20px;
}

/* 主温度区域 */
.jw-weather-main {
    padding: 6px 0 20px;
}
.jw-weather-icon {
    font-size: 60px;
    font-weight: 400;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}
.jw-weather-temp {
    font-size: 82px;
    font-weight: 300;
    line-height: 1;
    margin: 8px 0 6px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.jw-weather-desc {
    font-size: 18px;
    opacity: 0.95;
    margin: 8px 0 6px;
}
.jw-weather-range {
    font-size: 15px;
    opacity: 0.85;
}

/* 七宫格（自适应） */
.jw-weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
    gap: 14px;
    margin: 24px 0;
}
.jw-weather-item {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border-radius: 28px;
    padding: 12px 5px;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
}
.jw-weather-item:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}
.jw-weather-item-label {
    font-size: 12px;
    opacity: 0.85;
    margin-bottom: 8px;
}
.jw-weather-item-value {
    font-size: 16px;
    font-weight: 500;
}

/* 七日预报 */
.jw-weather-forecast-title {
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 16px 0;
    text-align: center;
}
.jw-weather-forecast {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border-radius: 32px;
    padding: 6px 18px;
    margin-bottom: 28px;
    text-align: left;
}
.jw-weather-forecast-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.jw-weather-forecast-item:last-child {
    border-bottom: none;
}
.jw-weather-forecast-day {
    width: 70px;
    font-weight: 500;
}
.jw-weather-forecast-weather {
    flex: 1;
    text-align: center;
}
.jw-weather-forecast-temp {
    width: 80px;
    text-align: right;
}

/* 生活指数标题 + 问号提示（向上弹出，层级最高） */
.jw-weather-indices-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 1000;  /* 提高父容器层级 */
}
.jw-weather-indices-title .help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.jw-weather-indices-title .help-icon:hover {
    background: rgba(255,255,255,0.6);
    transform: scale(1.1);
}
.jw-weather-indices-title .help-icon::before {
    content: "?";
}
/* 提示向上弹出，并确保不被任何元素遮挡 */
.jw-weather-indices-title .help-icon:hover::after {
    content: "数据仅供参考，请结合当地实际情况";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    background: rgba(0,0,0,0.9);
    color: #fff;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 30px;
    white-space: nowrap;
    z-index: 999999;  /* 极高优先级 */
    pointer-events: none;
    font-weight: normal;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    line-height: 1.4;
}

/* 生活指数网格 - 降低层级，避免遮挡提示 */
.jw-weather-indices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;  /* 确保卡片在提示下方 */
}
.jw-weather-index-item {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(8px);
    border-radius: 28px;
    text-align: center;
    padding: 12px 6px;
    transition: transform 0.2s;
}
.jw-weather-index-item:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.3);
}
.jw-weather-index-name {
    font-size: 12px;
    opacity: 0.85;
    margin-bottom: 6px;
}
.jw-weather-index-brief {
    font-size: 13px;
    font-weight: 500;
}

/* 底部温馨提示 */
.jw-weather-note {
    font-size: 11px;
    text-align: center;
    opacity: 0.6;
    margin-top: 20px;
    margin-bottom: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.2);
}
.jw-weather-footer {
    font-size: 10px;
    text-align: center;
    opacity: 0.45;
    margin-top: 6px;
    padding-bottom: 4px;
}

/* 返回与关闭按钮 */
.jw-weather-back-btn,
.jw-weather-close {
    position: absolute;
    top: 22px;
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: 0.2s;
    z-index: 10;
    backdrop-filter: blur(4px);
}
.jw-weather-back-btn {
    left: 18px;
}
.jw-weather-close {
    right: 18px;
}
.jw-weather-back-btn:hover,
.jw-weather-close:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.08);
}
.jw-weather-back-btn.hidden {
    display: none;
}

/* 搜索栏 */
.jw-weather-search {
    display: flex;
    gap: 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 60px;
    padding: 5px;
    margin: 52px 0 28px 0;
    backdrop-filter: blur(4px);
}
.jw-weather-search input {
    flex: 1;
    padding: 12px 18px;
    border: none;
    background: rgba(255,255,255,0.25);
    border-radius: 60px;
    font-size: 15px;
    color: white;
    outline: none;
    text-align: left;
}
.jw-weather-search input::placeholder {
    color: rgba(255,255,255,0.8);
}
.jw-weather-search button {
    background: rgba(255,255,255,0.3);
    border: none;
    border-radius: 60px;
    padding: 0 24px;
    font-size: 15px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: 0.2s;
}
.jw-weather-search button:active {
    transform: scale(0.96);
    background: rgba(255,255,255,0.5);
}

/* 移动端适配 */
@media (max-width: 560px) {
    .jw-weather-panel {
        padding: 20px 16px;
        border-radius: 36px;
    }
    #weatherCanvas {
        border-radius: 36px;
    }
    .jw-weather-city {
        font-size: 26px;
    }
    .jw-weather-datetime {
        font-size: 11px;
        padding: 4px 12px;
    }
    .jw-weather-temp {
        font-size: 66px;
    }
    .jw-weather-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 10px;
    }
    .jw-weather-item-value {
        font-size: 14px;
    }
    .jw-weather-forecast-day {
        width: 55px;
        font-size: 13px;
    }
    .jw-weather-forecast-temp {
        width: 70px;
        font-size: 13px;
    }
    .jw-weather-indices {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
    }
    .jw-weather-back-btn,
    .jw-weather-close {
        top: 16px;
        width: 34px;
        height: 34px;
    }
    .jw-weather-search {
        margin-top: 48px;
    }
    /* 手机上提示改为向下弹出，避免溢出，且确保不被遮挡 */
    .jw-weather-indices-title .help-icon:hover::after {
        white-space: normal;
        width: max(180px, 80%);
        text-align: center;
        bottom: auto;
        top: 100%;
        margin-top: 8px;
        margin-bottom: 0;
        left: 50%;
        transform: translateX(-50%);
    }
}