/* ===== 公共遮罩 ===== */
.tz-popup-modal {
    --tz-popup-accent: var(--title, var(--hot-red, #ff2d55));
    --tz-popup-accent-soft: color-mix(in srgb, var(--tz-popup-accent) 14%, transparent);
    --tz-popup-accent-hover: color-mix(in srgb, var(--tz-popup-accent) 18%, transparent);
}

/* 所有风格：带跳转链接的主按钮统一使用主题色背景 */
.tz-popup-btn-link,
.tz-popup-style-default .tz-popup-btn-action,
.tz-popup-style-luxury .tz-popup-btn-action,
.tz-popup-style-minimal .tz-popup-minimal-btn.tz-popup-btn-link,
.tz-popup-style-bottom .tz-popup-bottom-btn-primary.tz-popup-btn-link,
.tz-popup-style-corner .tz-popup-corner-btn-primary.tz-popup-btn-link {
    background: var(--tz-popup-accent) !important;
    background-color: var(--tz-popup-accent) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.tz-popup-btn-link:hover,
.tz-popup-style-default .tz-popup-btn-action:hover,
.tz-popup-style-luxury .tz-popup-btn-action:hover,
.tz-popup-style-minimal .tz-popup-minimal-btn.tz-popup-btn-link:hover,
.tz-popup-style-bottom .tz-popup-bottom-btn-primary.tz-popup-btn-link:hover,
.tz-popup-style-corner .tz-popup-corner-btn-primary.tz-popup-btn-link:hover {
    opacity: 0.88;
}

.tz-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    animation: tz-fade-in 0.2s ease;
}

.tz-popup-overlay-bottom {
    background: rgba(0, 0, 0, 0.45);
}

.tz-popup-overlay-corner {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
}

@keyframes tz-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tz-scale-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes tz-slide-up {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tz-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== 1. 经典默认（原版弹窗） ===== */
.tz-popup-style-default {
    /* 强制白底卡片，匹配设计稿（不受暗色主题影响） */
    --card: #ffffff;
    --text: #1f1f1f;
    --line: #ededed;
    --name: #8a8a8a;
    --hover-bg: rgba(0, 0, 0, 0.04);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(500px, calc(100vw - 32px));
    max-height: min(80vh, 640px);
    background-color: #ffffff;
    color: #1f1f1f;
    border: 1px solid #ededed;
    border-radius: 18px;
    box-shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: tz-scale-in 0.25s ease;
    font-family: var(--font-family, inherit);
}

.tz-popup-style-default .tz-popup-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--line, #eee);
    font-size: 16px;
    font-weight: 500;
    color: var(--text, #333);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #fff0f0 0%, #ffffff 100%);
}

.tz-popup-style-default .tz-popup-header-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
}

.tz-popup-style-default .tz-popup-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: var(--name, #999);
    transition: color 0.2s ease;
}

.tz-popup-style-default .tz-popup-close:hover {
    color: var(--tz-popup-accent);
}

.tz-popup-style-default .tz-popup-content {
    padding: 20px;
    font-size: 14px;
    color: var(--text, #333);
    line-height: 1.6;
    word-wrap: break-word;
    background-color: var(--card, #fff);
}

/* 原站弹窗无右侧滚动条：兼容超长内容时仍可滚动，但隐藏滚动条视觉 */
.tz-popup-style-default .tz-popup-content {
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tz-popup-style-default .tz-popup-content::-webkit-scrollbar {
    display: none;
}

.tz-popup-style-default .tz-popup-content p {
    line-height: 1.8;
    margin: 0 0 0.75em;
}

.tz-popup-style-default .tz-popup-content p:last-child {
    margin-bottom: 0;
}

.tz-popup-style-default .tz-popup-footer {
    padding: 16px 20px;
    text-align: right;
    border-top: 1px solid var(--line, #eee);
    background-color: var(--card, #fff);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.tz-popup-style-default .tz-popup-btn {
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    border: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tz-popup-style-default .tz-popup-btn-confirm {
    background-color: transparent;
    color: var(--text, #333);
    border: 1px solid var(--line, #ddd);
}

.tz-popup-style-default .tz-popup-btn-confirm:hover {
    background-color: var(--hover-bg, rgba(0, 0, 0, 0.04));
}

.tz-popup-style-default .tz-popup-btn-action {
    background-color: var(--tz-popup-accent);
    color: #fff;
}

.tz-popup-style-default .tz-popup-btn-action:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* ===== 2. 轻奢高端 ===== */
.tz-popup-style-luxury {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(500px, calc(100vw - 32px));
    max-height: min(80vh, 640px);
    background: var(--card, #0d0d0d);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius, 12px);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: tz-scale-in 0.24s ease;
    font-family: var(--font-family, inherit);
}

.tz-popup-style-luxury .tz-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, var(--tz-popup-accent-soft), transparent);
}

.tz-popup-style-luxury .tz-popup-header-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #fff);
}

.tz-popup-style-luxury .tz-popup-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--name, #8f8f8f);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
}

.tz-popup-style-luxury .tz-popup-close:hover {
    background: var(--tz-popup-accent-hover);
    color: var(--tz-popup-accent);
}

.tz-popup-style-luxury .tz-popup-content {
    padding: 18px;
    color: var(--text, #fff);
    font-size: 14px;
    line-height: 1.7;
    overflow: auto;
    flex: 1;
}

.tz-popup-style-luxury .tz-popup-content p {
    margin: 0 0 0.75em;
}

.tz-popup-style-luxury .tz-popup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 18px 18px;
}

.tz-popup-style-luxury .tz-popup-btn {
    min-width: 88px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s, background 0.2s;
}

.tz-popup-style-luxury .tz-popup-btn:active {
    transform: scale(0.98);
}

.tz-popup-style-luxury .tz-popup-btn-confirm {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text, #fff);
    border-color: rgba(255, 255, 255, 0.08);
}

.tz-popup-style-luxury .tz-popup-btn-action {
    background: var(--tz-popup-accent);
    color: #fff;
}

/* ===== 3. 现代简约 ===== */
.tz-popup-style-minimal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(460px, calc(100vw - 32px));
    max-height: min(80vh, 600px);
    background: var(--card, #0d0d0d);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: calc(var(--radius, 12px) + 2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
    z-index: 9999;
    padding: 22px 24px 20px;
    overflow: auto;
    animation: tz-scale-in 0.22s ease;
    font-family: var(--font-family, inherit);
}

.tz-popup-style-minimal .tz-popup-minimal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.tz-popup-style-minimal .tz-popup-minimal-badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--name, #9a9a9a);
    font-size: 12px;
    letter-spacing: 0.04em;
}

.tz-popup-style-minimal .tz-popup-minimal-close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--name, #8f8f8f);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.tz-popup-style-minimal .tz-popup-minimal-close:hover {
    color: var(--text, #fff);
}

.tz-popup-style-minimal .tz-popup-minimal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text, #fff);
    line-height: 1.35;
    margin-bottom: 14px;
}

.tz-popup-style-minimal .tz-popup-minimal-content {
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--name, #c8c8c8);
    font-size: 14px;
    line-height: 1.75;
    max-height: 280px;
    overflow: auto;
    margin-bottom: 18px;
}

.tz-popup-style-minimal .tz-popup-minimal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tz-popup-style-minimal .tz-popup-minimal-link {
    border: none;
    background: transparent;
    color: var(--name, #8f8f8f);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
}

.tz-popup-style-minimal .tz-popup-minimal-link:hover {
    color: var(--text, #fff);
}

.tz-popup-style-minimal .tz-popup-minimal-btn {
    min-width: 108px;
    height: 38px;
    padding: 0 18px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.tz-popup-style-minimal .tz-popup-minimal-btn:not(.tz-popup-btn-link) {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text, #fff);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tz-popup-style-minimal .tz-popup-minimal-btn-plain {
    min-width: 108px;
}

/* ===== 4. 底部抽屉 ===== */
.tz-popup-style-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: min(78vh, 560px);
    background: var(--card, #0d0d0d);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: tz-slide-up 0.28s ease;
    font-family: var(--font-family, inherit);
}

.tz-popup-style-bottom .tz-popup-bottom-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
}

.tz-popup-style-bottom .tz-popup-bottom-handle span {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.tz-popup-style-bottom .tz-popup-bottom-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 18px 12px;
}

.tz-popup-style-bottom .tz-popup-bottom-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text, #fff);
}

.tz-popup-style-bottom .tz-popup-bottom-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--name, #8f8f8f);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.tz-popup-style-bottom .tz-popup-bottom-content {
    padding: 0 18px;
    color: var(--text, #fff);
    font-size: 14px;
    line-height: 1.7;
    overflow: auto;
    flex: 1;
}

.tz-popup-style-bottom .tz-popup-bottom-footer {
    display: flex;
    gap: 10px;
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tz-popup-style-bottom .tz-popup-bottom-btn {
    flex: 1;
    height: 40px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.tz-popup-style-bottom .tz-popup-bottom-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text, #fff);
}

.tz-popup-style-bottom .tz-popup-bottom-btn-primary {
    background: var(--tz-popup-accent);
    color: #fff;
}

@media (min-width: 769px) {
    .tz-popup-style-bottom {
        left: 50%;
        right: auto;
        bottom: 24px;
        width: min(480px, calc(100vw - 32px));
        border-radius: var(--radius, 12px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        animation: tz-scale-in 0.24s ease;
        transform: translateX(-50%);
    }
}

/* ===== 5. 右下角浮卡 ===== */
.tz-popup-style-corner {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: min(360px, calc(100vw - 32px));
    background: var(--card, #0d0d0d);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius, 12px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
    z-index: 9999;
    overflow: hidden;
    animation: tz-slide-in-right 0.26s ease;
    font-family: var(--font-family, inherit);
    pointer-events: auto;
}

.tz-popup-style-corner .tz-popup-corner-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 10px;
}

.tz-popup-style-corner .tz-popup-corner-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--tz-popup-accent-soft);
    color: var(--tz-popup-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.tz-popup-style-corner .tz-popup-corner-title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #fff);
    line-height: 1.4;
}

.tz-popup-style-corner .tz-popup-corner-close {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--name, #8f8f8f);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.tz-popup-style-corner .tz-popup-corner-content {
    padding: 0 14px 12px;
    color: var(--name, #bdbdbd);
    font-size: 13px;
    line-height: 1.65;
    max-height: 160px;
    overflow: auto;
}

.tz-popup-style-corner .tz-popup-corner-footer {
    display: flex;
    gap: 8px;
    padding: 0 14px 14px;
}

.tz-popup-style-corner .tz-popup-corner-btn {
    flex: 1;
    height: 34px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.tz-popup-style-corner .tz-popup-corner-btn-primary {
    background: var(--tz-popup-accent);
    color: #fff;
}

.tz-popup-style-corner .tz-popup-corner-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text, #fff);
}

@media (max-width: 768px) {
    .tz-popup-style-default .tz-popup-footer,
    .tz-popup-style-luxury .tz-popup-footer {
        flex-direction: column;
    }

    .tz-popup-style-default .tz-popup-btn,
    .tz-popup-style-luxury .tz-popup-btn {
        width: 100%;
    }

    .tz-popup-style-minimal .tz-popup-minimal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .tz-popup-style-minimal .tz-popup-minimal-btn {
        width: 100%;
    }

    .tz-popup-style-corner {
        left: 16px;
        right: 16px;
        width: auto;
    }
}
