/**
 * 主题支付弹窗 - 现代极简高端设计
 *
 * @package Xuhuan
 * @since 2.0.0
 */

/* ============================================
   遮罩层
   ============================================ */
.tah-payment-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tah-payment-modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ============================================
   弹窗容器
   ============================================ */
.tah-payment-modal-wrap {
    width: 100%;
    max-width: 400px;
    max-height: calc(100vh - 40px);
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.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 - 40px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

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

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

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

.tah-payment-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 24px;
    color: #94a3b8;
    font-size: 14px;
}

.tah-payment-modal__body {
    display: none;
    padding: 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 {
    display: none !important;
}

/* ============================================
   商品信息卡片 - 极简现代设计
   ============================================ */
.tah-payment-modal__body .tah-product-info {
    margin-bottom: 24px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.tah-payment-modal__body .tah-product-info .product-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.tah-payment-modal__body .tah-product-info .product-tag {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-weight: 600;
}

.tah-payment-modal__body .tah-product-info .product-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.tah-payment-modal__body .tah-product-info .product-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 16px;
    padding-left: 2px;
}

.tah-payment-modal__body .tah-product-info .product-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.tah-payment-modal__body .tah-product-info .original-price {
    font-size: 14px;
    color: #94a3b8;
    text-decoration: line-through;
}

.tah-payment-modal__body .tah-product-info .current-price {
    font-size: 32px;
    font-weight: 800;
    color: #ef4444;
    letter-spacing: -1px;
}

/* ============================================
   支付方式区域 - 极简设计
   ============================================ */
.tah-payment-modal__body .tah-payment-methods-section {
    margin-bottom: 24px;
}

.tah-payment-modal__body .tah-payment-methods-section .payment-section-title {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 12px;
    font-weight: 500;
}

/* 支付方式网格 */
.tah-payment-modal__body .tah-payment-methods .payment-methods-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 支付方式选项 - 紧凑横向布局 */
.tah-payment-modal__body .payment-method-radio {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1 1 auto;
    min-width: 90px;
    max-width: calc(33.333% - 6px);
}

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

.tah-payment-modal__body .payment-method-radio.active {
    border-color: #6366f1;
    background: #f5f3ff;
}

/* 支付方式图标 */
.tah-payment-modal__body .payment-method-radio img,
.tah-payment-modal__body .payment-method-radio .payment-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

/* 积分/余额等使用 span 图标的样式 - 全局通用规则 */
span.payment-method-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    flex-shrink: 0 !important;
    border-radius: 6px !important;
    position: relative !important;
    display: inline-block !important;
}

span.payment-method-icon.points {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
}

span.payment-method-icon.points::after {
    content: '★' !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 16px !important;
    color: rgba(255,255,255,0.95) !important;
}

span.payment-method-icon.balance {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b35 100%) !important;
}

span.payment-method-icon.balance::after {
    content: '¥' !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 16px !important;
    font-weight: bold !important;
    color: rgba(255,255,255,0.95) !important;
}

/* 支付方式名称 */
.tah-payment-modal__body .payment-method-radio div,
.tah-payment-modal__body .payment-method-radio .payment-method-name {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
}

.tah-payment-modal__body .payment-method-radio.active div,
.tah-payment-modal__body .payment-method-radio.active .payment-method-name {
    color: #6366f1;
    font-weight: 600;
}

/* 选中勾选标记 */
.tah-payment-modal__body .payment-method-radio.active::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: #6366f1;
    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='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

/* ============================================
   支付按钮
   ============================================ */
.tah-payment-modal__body .tah-payment-submit {
    margin-top: 0;
}

.tah-payment-modal__body .tah-pay-button,
.tah-payment-modal__body .initiate-pay {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    padding: 14px 24px;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

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

.tah-payment-modal__body .tah-pay-button:active,
.tah-payment-modal__body .initiate-pay:active {
    transform: translateY(0);
}

.tah-payment-modal__body .tah-pay-button:disabled,
.tah-payment-modal__body .tah-pay-button.loading,
.tah-payment-modal__body .initiate-pay:disabled,
.tah-payment-modal__body .initiate-pay.loading {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.tah-payment-modal__body .tah-pay-button .pay-price-text,
.tah-payment-modal__body .initiate-pay .pay-price-text {
    font-weight: 700;
}

.tah-payment-modal__body .tah-pay-button .pay-button-text,
.tah-payment-modal__body .initiate-pay .pay-button-text {
    font-weight: 500;
}

/* 加载动画 */
.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;
}
