﻿/**
 * 主题支付弹窗 - 独立高端样式（不依赖浏览器弹出）
 *
 * @package Xuhuan
 * @since 1.5.0
 */

/* ---- 遮罩 ---- */
.tah-payment-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease, background 0.35s ease, backdrop-filter 0.35s ease;
}

.tah-payment-modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
}

/* ---- 弹窗容器 ---- */
.tah-payment-modal-wrap {
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 48px);
    transform: scale(0.92) translateY(24px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

.tah-payment-modal-backdrop.is-open .tah-payment-modal-wrap {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.tah-payment-modal {
    position: relative;
    width: 100%;
    max-height: calc(100vh - 48px);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 24px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 24px 48px -12px rgba(0, 0, 0, 0.18),
        0 0 80px -20px rgba(59, 130, 246, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 顶部装饰条 */
.tah-payment-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
    opacity: 0.95;
}

/* ---- 关闭按钮 ---- */
.tah-payment-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.06);
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tah-payment-modal__close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #0f172a;
    transform: scale(1.05);
}

.tah-payment-modal__close:active {
    transform: scale(0.98);
}

/* ---- 内容区 ---- */
.tah-payment-modal__content {
    position: relative;
    flex: 1 1 auto;
    min-height: 200px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.tah-payment-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 24px;
    color: #64748b;
    font-size: 15px;
}

.tah-payment-modal__body {
    display: none;
    padding: 0 24px 28px 24px;
}

.tah-payment-modal__body.is-visible {
    display: block;
}

/* 消除顶部空白框：插件/子比可能带有伪元素或默认背景，统一重置 */
.tah-payment-modal__body .modal-content,
.tah-payment-modal__body .modal-body {
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent !important;
    min-height: 0 !important;
}

.tah-payment-modal__body .modal-content::before,
.tah-payment-modal__body .modal-content::after,
.tah-payment-modal__body .modal-body::before,
.tah-payment-modal__body .modal-body::after,
.tah-payment-modal__body .modal-colorful-header::before,
.tah-payment-modal__body .modal-colorful-header::after {
    display: none !important;
    content: none !important;
}

.tah-payment-modal__body .modal-body > *:first-child {
    margin-top: 0 !important;
}

/* ========== 标题区：改为简洁文案标题，避免被误认为按钮 ========== */
.tah-payment-modal__body .modal-colorful-header {
    border-radius: 0;
    margin: 0 -24px 16px -24px;
    padding: 12px 44px 12px 20px !important;
    min-height: 0 !important;
    height: auto;
    background: transparent !important;
    border: none;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: none;
}

.tah-payment-modal__body .modal-colorful-header .text-center {
    justify-content: flex-start;
}

.tah-payment-modal__body .modal-colorful-header .em2x {
    font-size: 1.125rem;
    color: #64748b;
}

.tah-payment-modal__body .modal-colorful-header .em2x i,
.tah-payment-modal__body .modal-colorful-header .em2x .fa {
    color: inherit;
}

.tah-payment-modal__body .modal-colorful-header .mt10.em12 {
    font-size: 1rem !important;
    font-weight: 600;
    color: #0f172a;
}

/* 插件内的关闭按钮：隐藏避免重复（主题已有右上角关闭）及避免 SVG #icon-close 缺失产生灰块 */
.tah-payment-modal__body .modal-colorful-header .close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    opacity: 0;
    pointer-events: none;
}

.tah-payment-modal__body .modal-colorful-header .close svg,
.tah-payment-modal__body .modal-colorful-header .close use {
    display: none;
}

.tah-payment-modal__body .modal-colorful-header .text-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tah-payment-modal__body .modal-colorful-header .em2x {
    font-size: 1.5rem;
    margin: 0;
    opacity: 0.95;
}

.tah-payment-modal__body .modal-colorful-header .em2x i,
.tah-payment-modal__body .modal-colorful-header .em2x .fa {
    color: #fff;
}

.tah-payment-modal__body .modal-colorful-header .mt10.em12 {
    margin: 0 !important;
    font-size: 1.125rem !important;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}

/* 商品信息卡片 */
.tah-payment-modal__body .muted-box {
    border-radius: 14px;
    margin-bottom: 18px;
    padding: 14px 18px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.tah-payment-modal__body .muted-box .pay-tag {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
}

.tah-payment-modal__body .muted-box .pay-mark,
.tah-payment-modal__body .muted-box .em14 {
    font-weight: 700;
    color: #0f172a;
}

/* ========== 支付方式：可点击、选中态明显 ========== */
.tah-payment-modal__body .dependency-box {
    margin-top: 4px;
}

.tah-payment-modal__body .dependency-box .muted-2-color.em09 {
    font-size: 0.8125rem;
    color: #64748b;
    margin-bottom: 10px;
}

.tah-payment-modal__body .flex.mb10 {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.tah-payment-modal__body .payment-method-radio {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 10px;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.tah-payment-modal__body .payment-method-radio:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.tah-payment-modal__body .payment-method-radio.active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 1px #2563eb;
}

.tah-payment-modal__body .payment-method-radio img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.tah-payment-modal__body .payment-method-radio div {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #334155;
}

.tah-payment-modal__body .payment-method-radio.active div {
    color: #1d4ed8;
}

/* 选中勾选标记（无图标时用伪元素） */
.tah-payment-modal__body .payment-method-radio.active::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: #2563eb;
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    background-size: 12px;
    background-repeat: no-repeat;
    background-position: center;
}


/* 立即支付按钮 */
.tah-payment-modal__body .initiate-pay {
    width: 100%;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    padding: 14px 24px;
    border: none;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tah-payment-modal__body .initiate-pay:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.tah-payment-modal__body .initiate-pay .pay-price-text {
    margin-left: 6px;
    opacity: 0.95;
}

.tah-payment-modal__body .initiate-pay.loading,
.tah-payment-modal__body .initiate-pay:disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

/* 加载动画 */
.tah-payment-modal__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: tah-payment-modal-spin 0.9s linear infinite;
}

@keyframes tah-payment-modal-spin {
    to { transform: rotate(360deg); }
}

/* 触发按钮统一样式（可选） */
a.tah-payment-trigger {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

a.tah-payment-trigger:focus {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}
