/* 支付模态框样式 */
.payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.payment-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.payment-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease-out;
}

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

.payment-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.payment-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.payment-modal-body {
    padding: 24px;
}

/* 产品信息 */
.payment-summary {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.product-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.product-info h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.price {
    font-size: 2rem;
    font-weight: 700;
    color: #fbbf24;
}

.features-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.features-list li {
    margin: 8px 0;
    font-size: 0.9rem;
    opacity: 0.95;
}

/* 支付表单 */
.payment-form {
    space-y: 20px;
}

.payment-method-selector {
    margin-bottom: 20px;
}

.payment-method-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-method-selector input[type="radio"] {
    margin-right: 8px;
}

.payment-method-selector input[type="radio"]:checked + .payment-method-option {
    border-color: #3b82f6;
    background: #eff6ff;
}

.payment-method-option img {
    height: 24px;
    opacity: 0.8;
}

/* 卡片元素容器 */
.card-element-container {
    margin-bottom: 20px;
}

.card-element-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

#card-element {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    transition: border-color 0.2s;
}

#card-element:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#card-errors {
    margin-top: 8px;
    color: #dc2626;
    font-size: 0.875rem;
    display: none;
}

/* 账单信息 */
.billing-details {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 加载状态 */
.payment-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    text-align: center;
}

.payment-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.payment-loading p {
    margin: 0;
    color: #6b7280;
    font-weight: 500;
}

/* 错误信息 */
.payment-error {
    display: none;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin-bottom: 20px;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
}

/* 成功状态 */
.payment-success {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.payment-success h3 {
    margin: 0 0 16px 0;
    color: #059669;
    font-size: 1.5rem;
    font-weight: 600;
}

.payment-success p {
    margin: 0;
    color: #6b7280;
    line-height: 1.5;
}

/* 模态框底部 */
.payment-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* 安全信息 */
.payment-security {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.payment-security p {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .payment-modal-content {
        width: 95%;
        margin: 20px;
        max-height: 95vh;
    }
    
    .payment-modal-header,
    .payment-modal-body,
    .payment-modal-footer {
        padding: 16px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .product-info {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .price {
        font-size: 1.5rem;
    }
    
    .payment-modal-footer {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .payment-modal-content {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .payment-modal-header {
        border-bottom-color: #374151;
    }
    
    .payment-modal-header h2 {
        color: #f9fafb;
    }
    
    .close-btn {
        color: #9ca3af;
    }
    
    .close-btn:hover {
        background: #374151;
        color: #d1d5db;
    }
    
    .card-element-container label,
    .form-group label {
        color: #d1d5db;
    }
    
    #card-element,
    .form-group input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .payment-modal-footer {
        background: #111827;
        border-top-color: #374151;
    }
    
    .payment-security {
        background: #111827;
        border-top-color: #374151;
    }
}