/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    font-weight: 600;
}

.header p {
    opacity: 0.9;
    font-size: 1.1em;
}

/* 支付表单样式 */
.payment-form {
    padding: 40px 30px;
}

/* 商品信息 */
.product-info {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e1e5e9;
}

.product-info h2 {
    color: #32325d;
    font-size: 1.4em;
    margin-bottom: 20px;
}

.product {
    display: flex;
    align-items: center;
    gap: 20px;
}

.product-image {
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.product-details h3 {
    color: #32325d;
    font-size: 1.2em;
    margin-bottom: 8px;
}

.product-details p {
    color: #8898aa;
    margin-bottom: 12px;
    line-height: 1.5;
}

.price {
    font-size: 1.8em;
    font-weight: 600;
    color: #32325d;
}

/* 表单样式 */
.stripe-form h2 {
    color: #32325d;
    font-size: 1.4em;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    color: #6b7c93;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #fafbfc;
}

input[type="email"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background-color: white;
}

/* 快速支付按钮样式 */
.quick-pay-button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.3s ease;
    margin-top: 10px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.quick-pay-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.quick-pay-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Stripe Elements样式 */
.stripe-element {
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background-color: #fafbfc;
    transition: all 0.3s ease;
}

.stripe-element:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background-color: white;
}

.error-message {
    color: #e25950;
    font-size: 0.9em;
    margin-top: 8px;
    min-height: 20px;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

/* 支付按钮样式 */
.pay-button {
    width: 100%;
    border: none;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pay-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.pay-button.secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.pay-button.secondary:hover:not(:disabled) {
    background: #f0f3ff;
    border-color: #5a67d8;
}

.pay-button:hover:not(:disabled) {
    transform: translateY(-2px);
}

.pay-button.primary:hover:not(:disabled) {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.pay-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* 加载动画 */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 支付结果样式 */
.payment-result {
    text-align: center;
    padding: 40px 20px;
}

.success-message h2 {
    color: #00d924;
    font-size: 1.6em;
    margin-bottom: 15px;
}

.success-message p {
    color: #6b7c93;
    font-size: 1.1em;
    margin-bottom: 20px;
}

#payment-intent-id {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    color: #32325d;
    word-break: break-all;
}

/* 测试信息样式 */
.test-info {
    background: #f8f9fa;
    padding: 30px;
    border-top: 1px solid #e1e5e9;
}

.test-info h3 {
    color: #32325d;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.test-info p {
    color: #6b7c93;
    margin-bottom: 15px;
    line-height: 1.5;
}

.test-info ul {
    list-style: none;
    margin-bottom: 15px;
}

.test-info li {
    color: #6b7c93;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.test-info li::before {
    content: "•";
    color: #667eea;
    position: absolute;
    left: 0;
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 0;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .payment-form {
        padding: 30px 20px;
    }
    
    .test-info {
        padding: 20px;
    }
    
    .product {
        flex-direction: column;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .button-group {
        flex-direction: column;
        gap: 10px;
    }
}

/* 支付说明样式 */
.payment-note {
    color: #6b7c93;
    font-size: 0.9em;
    line-height: 1.4;
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* 保存卡片功能相关样式 */

/* 已保存卡片区域 */
.saved-cards-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.saved-cards-section h3 {
    color: #32325d;
    font-size: 1.2em;
    margin-bottom: 20px;
}

.saved-cards-list {
    margin-bottom: 20px;
}

.saved-card-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.saved-card-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.saved-card-item.selected {
    border-color: #667eea;
    background: #f0f3ff;
}

.saved-card-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.card-brand {
    font-size: 1.5em;
}

.card-details {
    display: flex;
    flex-direction: column;
}

.card-last4 {
    font-weight: 600;
    color: #32325d;
    font-size: 1.1em;
}

.card-exp {
    color: #6b7c93;
    font-size: 0.9em;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.card-radio {
    accent-color: #667eea;
    transform: scale(1.2);
}

.delete-card-btn {
    background: none;
    border: none;
    color: #e25950;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.delete-card-btn:hover {
    background: #fee;
}

/* 使用新卡片按钮 */
.use-new-card-btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.use-new-card-btn:hover {
    background: #667eea;
    color: white;
}

/* 演示按钮样式 */
.demo-button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.3s ease;
    margin-top: 10px;
    width: 100%;
}

.demo-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

/* 复选框样式 */
.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    margin-top: 2px;
}

.checkbox-wrapper label {
    flex: 1;
    color: #32325d;
    font-weight: 500;
    font-size: 0.95em;
    line-height: 1.4;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
    margin: 0;
}

.save-card-note {
    color: #6b7c93;
    font-size: 0.85em;
    line-height: 1.4;
    margin-left: 30px;
    font-style: italic;
}

/* CVC 输入区域 */
.saved-card-cvc-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #fff8e1;
    border-radius: 8px;
    border: 1px solid #ffc107;
}

.cvc-input {
    width: 120px;
    padding: 12px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    background-color: #fafbfc;
}

.cvc-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background-color: white;
}

/* 新卡片区域 */
.new-card-section {
    transition: all 0.3s ease;
}

/* 空状态提示 */
.no-saved-cards {
    text-align: center;
    padding: 40px 20px;
    color: #6b7c93;
    font-style: italic;
}

/* 加载状态 */
.loading-cards {
    text-align: center;
    padding: 20px;
    color: #6b7c93;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .saved-card-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .card-actions {
        align-self: stretch;
        justify-content: space-between;
    }
    
    .save-card-note {
        margin-left: 0;
        margin-top: 8px;
    }
    
    .checkbox-wrapper {
        flex-direction: column;
        gap: 8px;
    }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

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

.modal-header {
    padding: 20px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #32325d;
    font-size: 1.3em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #8898aa;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #32325d;
}

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

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-button {
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 100px;
}

.modal-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-button.primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.modal-button.secondary {
    background: #f8f9fa;
    color: #6b7c93;
    border: 1px solid #e1e5e9;
}

.modal-button.secondary:hover {
    background: #e9ecef;
}

.modal-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* 选中的卡片显示样式 */
.selected-card-display {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.selected-card-display .card-brand {
    font-size: 1.5em;
}

.selected-card-display .card-details {
    flex: 1;
}

.selected-card-display .card-last4 {
    font-weight: 600;
    color: #32325d;
    font-size: 1.1em;
    margin-bottom: 4px;
}

.selected-card-display .card-exp {
    color: #6b7c93;
    font-size: 0.9em;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        border-radius: 8px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-button {
        width: 100%;
    }
}
