/* 火星弹窗 - 悬浮卡片样式 */

/* ===== 桌面端（≥768px） ===== */
.hx-popup {
    position: fixed;
    z-index: 99998;
    width: 33vw;
    min-width: 420px;
    max-width: 560px;
    padding: 24px 64px;
    border-radius: 14px;
    box-shadow: 0 2px 24px rgba(0,0,0,0.13);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.hx-popup--show {
    pointer-events: auto;
}

/* ===== 七种位置 ===== */

/* --- 桌面端独立定位 --- */
.hx-popup--top-left {
    top: var(--hx-safe-top, 90px);
    left: 24px;
    right: auto;
    transform: translateY(-16px);
    opacity: 0;
}
.hx-popup--top-left.hx-popup--show { transform: translateY(0); opacity: 1; }

.hx-popup--top-center {
    top: var(--hx-safe-top, 90px);
    left: 50%;
    right: auto;
    transform: translate(-50%, -16px);
    opacity: 0;
}
.hx-popup--top-center.hx-popup--show { transform: translate(-50%, 0); opacity: 1; }

.hx-popup--top-right {
    top: var(--hx-safe-top, 90px);
    right: 24px;
    left: auto;
    transform: translateY(-16px);
    opacity: 0;
}
.hx-popup--top-right.hx-popup--show { transform: translateY(0); opacity: 1; }

.hx-popup--middle {
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0;
}
.hx-popup--middle.hx-popup--show { transform: translate(-50%, -50%) scale(1); opacity: 1; }

.hx-popup--bottom-left {
    bottom: var(--hx-safe-bottom, 30px);
    left: 24px;
    right: auto;
    transform: translateY(16px);
    opacity: 0;
}
.hx-popup--bottom-left.hx-popup--show { transform: translateY(0); opacity: 1; }

.hx-popup--bottom-center {
    bottom: var(--hx-safe-bottom, 30px);
    left: 50%;
    right: auto;
    transform: translate(-50%, 16px);
    opacity: 0;
}
.hx-popup--bottom-center.hx-popup--show { transform: translate(-50%, 0); opacity: 1; }

.hx-popup--bottom-right {
    bottom: var(--hx-safe-bottom, 30px);
    right: 24px;
    left: auto;
    transform: translateY(16px);
    opacity: 0;
}
.hx-popup--bottom-right.hx-popup--show { transform: translateY(0); opacity: 1; }
/* ===== 内部布局 ===== */
.hx-popup-close {
    position: absolute;
    right: -12px;
    top: -12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.hx-popup-close svg { width: 16px; height: 16px; }
.hx-popup-close:hover {
    color: #444;
    background: #ddd;
}

.hx-popup-body {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 左侧：图标 + 文字 ===== */
.hx-popup-main {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.hx-popup-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    flex-shrink: 0;
    object-fit: cover;
}

.hx-popup-info {
    flex: 1;
    min-width: 0;
}

.hx-popup-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--hx-theme, #f1404b);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.hx-popup-arrow {
    display: inline-flex;
    align-items: center;
    color: var(--hx-theme, #f1404b);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.hx-popup-main:hover .hx-popup-arrow {
    opacity: 1;
    transform: translateX(0);
}

.hx-popup-desc {
    font-size: 13px;
    color: #888;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 右侧：按钮 ===== */
.hx-popup-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.hx-popup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 20px;
    background: var(--hx-theme, #f1404b);
    color: #fff;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.2s, transform 0.2s;
}
.hx-popup-btn:hover {
    opacity: 0.85;
    transform: scale(1.04);
    color: #fff;
}

/* ===== 背景模式 ===== */
.hx-popup--bg-solid {
    background: var(--hx-popup-bg, #ffffff);
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
.hx-popup--bg-blur {
    background: var(--hx-popup-blur-bg, rgba(255,255,255,0.85));
    -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
    backdrop-filter: saturate(180%) blur(20px) !important;
}

/* ===== 暗黑模式 ===== */
.io-black-mode .hx-popup {
    box-shadow: 0 2px 24px rgba(0,0,0,0.38);
}
.io-black-mode .hx-popup-desc {
    color: #aaa;
}
.io-black-mode .hx-popup-close {
    color: #999;
    background: #555;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.io-black-mode .hx-popup-close:hover {
    color: #eee;
    background: #666;
}


/* ===== 移动端（＜768px） ===== */
@media (max-width: 767px) {
    .hx-popup {
        width: auto;
        min-width: unset;
        max-width: unset;
        padding: 14px 16px;
        border-radius: 12px;
    }

    /* 三个有效位置：撑满浮动图标之间 (55px边距) */
    .hx-popup--top-center,
    .hx-popup--middle,
    .hx-popup--bottom-center {
        left: 55px !important;
        right: 55px !important;
        width: auto !important;
    }
    /* 左上/右上 → 降级为顶部居中 */
    .hx-popup--top-left,
    .hx-popup--top-right {
        left: 55px !important;
        right: 55px !important;
        width: auto !important;
        top: var(--hx-safe-top, 70px) !important;
        bottom: auto !important;
        transform: translateY(0) !important;
    }
    /* 左下/右下 → 降级为底部居中 */
    .hx-popup--bottom-left,
    .hx-popup--bottom-right {
        left: 55px !important;
        right: 55px !important;
        width: auto !important;
        bottom: var(--hx-safe-bottom, 86px) !important;
        top: auto !important;
        transform: translateY(0) !important;
    }
    /* 中间：垂直居中 */
    .hx-popup--middle {
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) scale(0.92) !important;
    }
    .hx-popup--middle.hx-popup--show {
        transform: translateY(-50%) scale(1) !important;
    }
    /* 底部/顶部居中：去除水平偏移 */
    .hx-popup--bottom-center,
    .hx-popup--bottom-center.hx-popup--show {
        transform: translateY(0) !important;
    }
    .hx-popup--top-center,
    .hx-popup--top-center.hx-popup--show {
        transform: translateY(0) !important;
    }

    /* 移动端：按钮折行到下一行，图标+文字居中 */
    .hx-popup-body {
        flex-wrap: wrap;
        gap: 12px;
    }
    .hx-popup-main {
        flex: 1 1 auto;
    }
    .hx-popup-info {
        text-align: left;
    }
    .hx-popup-btns {
        flex: 1 1 100%;
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }

    .hx-popup-btn {
        padding: 8px 18px;
        font-size: 13px;
    }

    .hx-popup-icon {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    .hx-popup-title {
        font-size: 15px;
    }

    .hx-popup-desc {
        font-size: 12px;
    }
}

/* ===== 弹窗可见时隐藏浮动工具 ===== */
.hx-popup-visible .tools-right { transform: translateX(200%); }
.hx-popup-visible .tools-left  { transform: translateX(-200%); }
