/**
 * PayPal Gateway Popup Styles
 * 模拟 PayPal 官方登录弹窗样式
 * 参考 PayPal 官方颜色: #003087 (深蓝), #009cde (浅蓝), #0070ba (按钮蓝)
 */

/* =============================================
   遮罩层 (默认隐藏，由 JS 控制显示)
   ============================================= */
.cpg-paypal-overlay {
    /* 不设置 display，让内联 style="display: none" 生效 */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* =============================================
   弹窗容器
   ============================================= */
.cpg-paypal-modal {
    background: #fff !important;
    border-radius: 16px !important;
    width: 100% !important;
    max-width: 450px !important;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3) !important;
    overflow: hidden !important;
    animation: cpgPaypalSlideIn 0.3s ease-out;
    margin: 20px !important;
}

@keyframes cpgPaypalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =============================================
   步骤容器 (由 JS 控制显示/隐藏)
   ============================================= */
/* 默认不设置 display，让 JS 完全控制 */

/* =============================================
   步骤容器 - 统一大小（与3D验证模板680px一致）
   ============================================= */
.cpg-paypal-step {
    min-height: 580px !important; /* 浏览器壳子占用约100px，内容区580px */
    background: #fff !important;
}

.cpg-paypal-login-step {
    padding: 40px 35px 30px !important;
}

.cpg-paypal-card-step {
    padding: 0 !important;
}

/* PayPal 文字 Logo */
.cpg-paypal-logo-text {
    text-align: center !important;
    margin-bottom: 35px !important;
    font-size: 32px !important;
    font-weight: 700 !important;
    font-family: "PayPal Sans Big", "Helvetica Neue", Arial, sans-serif !important;
    letter-spacing: -0.5px !important;
}

.cpg-paypal-logo-text .pay {
    color: #003087 !important;
}

.cpg-paypal-logo-text .pal {
    color: #009cde !important;
}

/* =============================================
   表单组件
   ============================================= */
.cpg-paypal-form-group {
    margin-bottom: 16px !important;
}

/* 输入框 */
.cpg-paypal-input {
    width: 100% !important;
    padding: 14px 16px !important;
    border: 1px solid #cbd2d6 !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    background: #fff !important;
    color: #2c2e2f !important;
    font-family: "PayPal Sans Small", "Helvetica Neue", Arial, sans-serif !important;
}

.cpg-paypal-input:focus {
    outline: none !important;
    border-color: #0070ba !important;
    box-shadow: 0 0 0 3px rgba(0, 112, 186, 0.15) !important;
}

.cpg-paypal-input.error {
    border-color: #d20000 !important;
    box-shadow: 0 0 0 3px rgba(210, 0, 0, 0.1) !important;
}

.cpg-paypal-input::placeholder {
    color: #6c7378 !important;
}

/* 标签 */
.cpg-paypal-label {
    display: block !important;
    font-size: 14px !important;
    color: #2c2e2f !important;
    margin-bottom: 8px !important;
    font-weight: 500 !important;
}

/* 错误提示 */
.cpg-paypal-error {
    color: #d20000 !important;
    font-size: 13px !important;
    margin-top: 6px !important;
}

/* =============================================
   链接样式
   ============================================= */
.cpg-paypal-forgot-link,
.cpg-paypal-change-link {
    display: block !important;
    color: #0070ba !important;
    text-decoration: none !important;
    font-size: 14px !important;
    margin-bottom: 20px !important;
    text-align: left !important;
}

.cpg-paypal-forgot-link:hover,
.cpg-paypal-change-link:hover {
    text-decoration: underline !important;
}

/* =============================================
   按钮样式
   ============================================= */
.cpg-paypal-btn {
    width: 100% !important;
    padding: 14px 24px !important;
    border: none !important;
    border-radius: 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s !important;
    margin-bottom: 12px !important;
    font-family: "PayPal Sans Small", "Helvetica Neue", Arial, sans-serif !important;
    text-align: center !important;
    display: block !important;
}

.cpg-paypal-btn:active {
    transform: scale(0.98) !important;
}

/* 主按钮 - 蓝色 */
.cpg-paypal-btn-primary {
    background: #0070ba !important;
    color: #fff !important;
}

.cpg-paypal-btn-primary:hover {
    background: #005ea6 !important;
    box-shadow: 0 2px 8px rgba(0, 112, 186, 0.4) !important;
}

.cpg-paypal-btn-primary:disabled {
    background: #cbd2d6 !important;
    cursor: not-allowed !important;
}

/* 次要按钮 - 边框 */
.cpg-paypal-btn-secondary {
    background: transparent !important;
    color: #0070ba !important;
    border: 1px solid #0070ba !important;
}

.cpg-paypal-btn-secondary:hover {
    background: rgba(0, 112, 186, 0.05) !important;
}

/* 金色按钮 - Link Card */
.cpg-paypal-btn-gold {
    background: linear-gradient(to bottom, #ffc439 0%, #f5b526 100%) !important;
    color: #003087 !important;
    font-weight: 700 !important;
}

.cpg-paypal-btn-gold:hover {
    background: linear-gradient(to bottom, #f5b526 0%, #e6a617 100%) !important;
    box-shadow: 0 2px 8px rgba(255, 196, 57, 0.5) !important;
}

/* =============================================
   分隔线
   ============================================= */
.cpg-paypal-divider {
    display: flex !important;
    align-items: center !important;
    text-align: center !important;
    margin: 24px 0 !important;
    color: #6c7378 !important;
    font-size: 14px !important;
}

.cpg-paypal-divider::before,
.cpg-paypal-divider::after {
    content: '' !important;
    flex: 1 !important;
    border-bottom: 1px solid #cbd2d6 !important;
}

.cpg-paypal-divider span {
    padding: 0 16px !important;
}

/* =============================================
   语言切换
   ============================================= */
.cpg-paypal-lang {
    text-align: center !important;
    margin-top: 24px !important;
    font-size: 13px !important;
}

.cpg-paypal-lang a {
    color: #6c7378 !important;
    text-decoration: none !important;
}

.cpg-paypal-lang a:hover {
    text-decoration: underline !important;
}

.cpg-paypal-lang span {
    color: #cbd2d6 !important;
    margin: 0 8px !important;
}

/* =============================================
   步骤2: 用户信息头部
   ============================================= */
.cpg-paypal-user-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 30px !important;
    padding: 20px !important;
    background: #f5f7fa !important;
    border-radius: 12px !important;
}

.cpg-paypal-user-avatar {
    width: 64px !important;
    height: 64px !important;
    background: #e0e6eb !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.cpg-paypal-user-avatar svg {
    width: 36px !important;
    height: 36px !important;
    fill: #6c7378 !important;
}

.cpg-paypal-user-email-display {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #2c2e2f !important;
    word-break: break-all !important;
    text-align: center !important;
}

/* =============================================
   步骤3: 卡片步骤
   ============================================= */
.cpg-paypal-card-step {
    background: #fff !important;
}

/* 深蓝色头部 */
.cpg-paypal-card-header {
    background: linear-gradient(135deg, #003087 0%, #001f5c 100%) !important;
    padding: 20px 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}

.cpg-paypal-back-btn {
    position: absolute !important;
    left: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: none !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer !important;
    padding: 8px !important;
    border-radius: 50% !important;
    transition: background 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.cpg-paypal-back-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
}

.cpg-paypal-back-btn svg {
    width: 20px !important;
    height: 20px !important;
}

.cpg-paypal-card-header-logo {
    font-size: 24px !important;
    font-weight: 700 !important;
    font-family: "PayPal Sans Big", "Helvetica Neue", Arial, sans-serif !important;
    letter-spacing: -0.5px !important;
}

/* 卡片表单内容 */
.cpg-paypal-card-body {
    padding: 30px !important;
}

.cpg-paypal-card-title {
    font-size: 22px !important;
    font-weight: 600 !important;
    color: #2c2e2f !important;
    margin: 0 0 10px 0 !important;
    text-align: center !important;
}

.cpg-paypal-card-subtitle {
    font-size: 14px !important;
    color: #6c7378 !important;
    margin: 0 0 24px 0 !important;
    text-align: center !important;
    line-height: 1.5 !important;
}

/* 卡片品牌图标 */
.cpg-paypal-card-brands {
    display: flex !important;
    justify-content: center !important;
    gap: 16px !important;
    margin-bottom: 28px !important;
}

.cpg-paypal-card-brands img {
    height: 32px !important;
    width: auto !important;
    opacity: 0.4 !important;
    transition: opacity 0.2s, transform 0.2s !important;
    border-radius: 4px !important;
}

.cpg-paypal-card-brands img.active {
    opacity: 1 !important;
    transform: scale(1.1) !important;
}

/* 卡片表单 */
.cpg-paypal-card-form {
    margin-bottom: 20px !important;
}

/* 卡号输入包装 */
.cpg-paypal-card-input-wrapper {
    position: relative !important;
}

.cpg-paypal-card-brand {
    position: absolute !important;
    right: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.cpg-paypal-card-brand img {
    height: 24px !important;
    width: auto !important;
}

/* 表单行 */
.cpg-paypal-form-row {
    display: flex !important;
    gap: 16px !important;
}

.cpg-paypal-form-half {
    flex: 1 !important;
}

/* 安全提示 */
.cpg-paypal-secure-note {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    font-size: 13px !important;
    color: #6c7378 !important;
    margin-bottom: 24px !important;
    padding: 12px !important;
    background: #f5f7fa !important;
    border-radius: 8px !important;
}

.cpg-paypal-secure-note svg {
    width: 18px !important;
    height: 18px !important;
    fill: #6c7378 !important;
    flex-shrink: 0 !important;
}

/* =============================================
   底部页脚
   ============================================= */
.cpg-paypal-footer {
    padding: 16px 30px !important;
    background: #f5f7fa !important;
    text-align: center !important;
    border-top: 1px solid #e9ecef !important;
}

.cpg-paypal-footer-links {
    display: flex !important;
    justify-content: center !important;
    gap: 20px !important;
    flex-wrap: wrap !important;
}

.cpg-paypal-footer-links a {
    color: #6c7378 !important;
    text-decoration: none !important;
    font-size: 12px !important;
}

.cpg-paypal-footer-links a:hover {
    text-decoration: underline !important;
}

/* =============================================
   加载动画
   ============================================= */
.cpg-paypal-loading {
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-top-color: #fff !important;
    border-radius: 50% !important;
    animation: cpgPaypalSpin 0.8s linear infinite !important;
}

@keyframes cpgPaypalSpin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   移动端适配
   ============================================= */
@media (max-width: 480px) {
    .cpg-paypal-modal {
        max-width: 100% !important;
        margin: 12px !important;
        border-radius: 12px !important;
    }
    
    .cpg-paypal-login-step,
    .cpg-paypal-password-step {
        padding: 30px 24px 24px !important;
    }
    
    .cpg-paypal-logo-text {
        font-size: 28px !important;
        margin-bottom: 28px !important;
    }
    
    .cpg-paypal-card-body {
        padding: 24px !important;
    }
    
    .cpg-paypal-card-header {
        padding: 16px 20px !important;
    }
    
    .cpg-paypal-btn {
        padding: 12px 20px !important;
        font-size: 15px !important;
    }
    
    .cpg-paypal-form-row {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    .cpg-paypal-card-brands {
        gap: 10px !important;
    }
    
    .cpg-paypal-card-brands img {
        height: 26px !important;
    }
}

/* =============================================
   PayPal 结账区域信息样式
   ============================================= */
.cpg-paypal-content {
    padding: 0 !important;
}

.cpg-paypal-info {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 12px 0 !important;
}

.cpg-redirect-icon {
    flex-shrink: 0 !important;
}

.cpg-redirect-icon svg {
    width: 50px !important;
    height: 32px !important;
    color: #6c7378 !important;
}

.cpg-paypal-text {
    font-size: 13px !important;
    color: #6c7378 !important;
    line-height: 1.5 !important;
    margin: 0 !important;
}

/* =============================================
   🔥 真实浏览器弹窗模式说明
   ============================================= */
/*
 * PayPal 现在使用真实的浏览器弹窗（window.open）
 * 浏览器自带真实的地址栏、标签页和窗口控制按钮
 * 以下样式仅用于移动端备用模态框
 */

/* =============================================
   说明文字
   ============================================= */
.cpg-paypal-description {
    text-align: center;
    color: #0070ba;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 28px;
    padding: 0 10px;
}

/* =============================================
   Pay with a Card 按钮（黑色边框）
   ============================================= */
.cpg-paypal-btn-outline {
    background: #fff !important;
    color: #2c2e2f !important;
    border: 2px solid #2c2e2f !important;
    font-weight: 600 !important;
}

.cpg-paypal-btn-outline:hover {
    background: #f5f7fa !important;
}

/* =============================================
   移动端适配 - 模态框备用样式
   ============================================= */
@media (max-width: 540px) {
    .cpg-paypal-modal {
        margin: 10px !important;
        border-radius: 12px !important;
        max-width: calc(100% - 20px) !important;
    }
}
