/* ========== 支付方式选择弹窗样式 ========== */
/* 弹窗遮罩层 */
.custom-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

/* 弹窗容器 */
.custom-dialog {
    background: white;
    border-radius: 12px;
    animation: slideUp 0.3s ease-out;
}

.payment-dialog {
    max-width: 450px;
    width: 92%;
    max-height: 90vh; /* 限制最大高度为视口的90% */
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column; /* 使用flex布局 */
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 弹窗头部 */
.payment-header {
    background: linear-gradient(135deg, #c61f0d 0%, #e63a2e 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    flex-shrink: 0; /* 不压缩 */
}

.payment-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-header-icon i {
    font-size: 20px;
    color: white;
}

.payment-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.payment-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.payment-close i {
    font-size: 18px;
    color: white;
}

.payment-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* 支付信息框 */
.payment-info-box {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-bottom: 1px solid #ffd4d4;
    flex-shrink: 0; /* 不压缩 */
}

.payment-project-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.payment-notice-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    border-left: 3px solid #c61f0d;
}

.notice-unit {
    font-size: 13px;
    color: #333;
    font-weight: 600;
    margin: 0;
}

.notice-refund {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.payment-amount-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px dashed #ffd4d4;
}

.info-label,
.amount-label {
    font-size: 12px;
    color: #999;
    font-weight: 500;
}

.info-value {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.amount-value {
    font-size: 24px;
    color: #c61f0d;
    font-weight: 700;
}

/* 支付方式包装器 */
.payment-methods-wrapper {
    position: relative;
    flex: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 支付方式列表 */
.payment-methods-container {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 50vh; /* 改为视口高度的50%，更灵活 */
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1; /* 占据剩余空间 */
    min-height: 200px; /* 最小高度 */
    /* 确保滚动条样式美观 */
    scrollbar-width: thin;
    scrollbar-color: #c61f0d #f0f0f0;
}

/* 滚动提示 */
.scroll-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #c61f0d;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.scroll-hint.show {
    opacity: 1;
}

.scroll-hint i {
    font-size: 14px;
    animation: bounce 1.5s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(4px);
    }
}

/* Webkit浏览器滚动条样式 */
.payment-methods-container::-webkit-scrollbar {
    width: 6px;
}

.payment-methods-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.payment-methods-container::-webkit-scrollbar-thumb {
    background: #c61f0d;
    border-radius: 3px;
}

.payment-methods-container::-webkit-scrollbar-thumb:hover {
    background: #a01808;
}

.payment-method-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    gap: 8px;
    position: relative;
    min-height: 100px;
}

.payment-method-item:hover {
    border-color: #c61f0d;
    background: #fff9f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(198, 31, 13, 0.1);
}

.payment-method-item.selected {
    border-color: #c61f0d;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    box-shadow: 0 4px 16px rgba(198, 31, 13, 0.2);
}

/* 支付方式图标 */
.method-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.method-icon-wrapper i {
    font-size: 24px;
}

.method-icon-wrapper.digital-rmb {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.method-icon-wrapper.digital-rmb i {
    color: white;
}

.method-icon-wrapper.wechat {
    background: linear-gradient(135deg, #09bb07 0%, #07a305 100%);
}

.method-icon-wrapper.wechat i {
    color: white;
}

.method-icon-wrapper.alipay {
    background: linear-gradient(135deg, #1677ff 0%, #0d5fd9 100%);
}

.method-icon-wrapper.alipay i {
    color: white;
}

.method-icon-wrapper.unionpay {
    background: linear-gradient(135deg, #e4393c 0%, #d32f2f 100%);
}

.method-icon-wrapper.unionpay i {
    color: white;
}

.payment-method-item.selected .method-icon-wrapper {
    transform: scale(1.1);
}

/* 支付方式内容 */
.method-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    width: 100%;
}

.method-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: visible;
}

.method-desc {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    overflow: visible;
}

/* 选中标记 */
.method-check {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 20px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.method-check i {
    font-size: 24px;
    color: #c61f0d;
}

.payment-method-item.selected .method-check {
    opacity: 1;
    transform: scale(1.2);
}

/* 弹窗底部 */
.payment-footer {
    padding: 20px;
    display: flex;
    gap: 12px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    flex-shrink: 0; /* 不压缩 */
}

.payment-btn {
    flex: 1;
    height: 48px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.payment-btn i {
    font-size: 16px;
}

.payment-cancel {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.payment-cancel:hover {
    background: #f5f5f5;
    border-color: #ccc;
    transform: translateY(-2px);
}

.payment-confirm {
    background: linear-gradient(135deg, #c61f0d 0%, #e63a2e 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(198, 31, 13, 0.3);
}

.payment-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(198, 31, 13, 0.4);
}

.payment-confirm:active,
.payment-cancel:active {
    transform: translateY(0);
}

/* ========== 响应式设计 ========== */
/* 小屏幕优化（高度低于700px） */
@media (max-height: 700px) {
    .payment-dialog {
        max-height: 95vh; /* 小屏幕上使用更多空间 */
    }
    
    .payment-info-box {
        padding: 15px; /* 减少内边距 */
        gap: 10px;
    }
    
    .payment-methods-container {
        padding: 15px;
        max-height: 35vh; /* 减小最大高度，确保底部按钮可见 */
        min-height: 120px; /* 减小最小高度 */
    }
    
    .payment-method-item {
        padding: 10px 6px;
        min-height: 90px; /* 减小最小高度 */
    }
    
    .method-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .method-icon-wrapper i {
        font-size: 20px;
    }
    
    .method-name {
        font-size: 13px;
    }
    
    .method-desc {
        font-size: 10px;
    }
    
    .payment-footer {
        padding: 15px;
    }
    
    .payment-btn {
        height: 44px;
        font-size: 15px;
    }
}

/* 极小屏幕优化（高度低于600px） */
@media (max-height: 600px) {
    .payment-dialog {
        max-height: 98vh;
    }
    
    .payment-header {
        padding: 15px;
    }
    
    .payment-title {
        font-size: 16px;
    }
    
    .payment-info-box {
        padding: 12px;
        gap: 8px;
    }
    
    .amount-value {
        font-size: 20px;
    }
    
    .payment-methods-container {
        padding: 12px;
        gap: 10px;
        max-height: 30vh; /* 进一步减小，确保按钮可见 */
        min-height: 100px; /* 减小最小高度 */
    }
    
    .payment-method-item {
        padding: 8px 4px;
        min-height: 80px;
    }
    
    .payment-footer {
        padding: 12px;
        gap: 10px;
    }
    
    .payment-btn {
        height: 40px;
        font-size: 14px;
    }
}

/* 宽屏幕优化 */
@media (min-width: 768px) {
    .payment-dialog {
        max-width: 500px;
    }
    
    .payment-methods-container {
        grid-template-columns: repeat(3, 1fr); /* 大屏幕显示3列 */
    }
}

/* 大字体模式优化 - 确保按钮始终可见 */
@media (max-height: 800px) and (min-width: 360px) {
    .payment-methods-container {
        max-height: 40vh; /* 限制支付方式列表高度 */
    }
}

@media (max-height: 700px) and (min-width: 360px) {
    .payment-methods-container {
        max-height: 32vh; /* 进一步限制高度 */
    }
}

@media (max-height: 600px) and (min-width: 360px) {
    .payment-methods-container {
        max-height: 28vh; /* 极小屏幕进一步限制 */
    }
    
    .payment-method-item {
        min-height: 75px; /* 减小支付方式卡片高度 */
    }
}

/* ========== 卡号查看弹窗响应式优化 ========== */
/* 小屏幕优化 (iPhone SE, 小屏Android等) */
@media (max-width: 375px) {
    #cardNumberModal .payment-dialog {
        width: 95%;
        max-width: none;
    }
    
    #cardNumberModal .payment-header {
        padding: 16px;
    }
    
    #cardNumberModal .payment-title {
        font-size: 16px;
    }
    
    #cardNumberModal .payment-header-icon {
        width: 36px;
        height: 36px;
    }
    
    #cardNumberModal .payment-header-icon i {
        font-size: 18px;
    }
    
    #cardInfoContainer {
        padding: 16px !important;
    }
    
    #cardInfoContainer .card-field {
        margin-bottom: 12px;
    }
    
    #cardInfoContainer .card-field-label {
        font-size: 13px;
    }
    
    #cardInfoContainer .card-field-value {
        font-size: 14px;
    }
    
    #cardInfoContainer .card-number-large {
        font-size: 16px !important;
    }
    
    #cardInfoContainer .copy-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    #cardInfoContainer button {
        height: 36px;
        font-size: 13px;
        padding: 0 12px;
    }
    
    #cardInfoContainer .card-notice {
        padding: 12px;
        font-size: 12px;
    }
    
    #cardModalFooter {
        padding: 16px;
    }
    
    #cardModalFooter .payment-btn {
        height: 44px;
        font-size: 14px;
    }
}

/* 超小屏幕优化 (iPhone SE 第一代等) */
@media (max-width: 320px) {
    #cardNumberModal .payment-dialog {
        width: 96%;
        border-radius: 12px;
    }
    
    #cardNumberModal .payment-header {
        padding: 14px;
    }
    
    #cardNumberModal .payment-title {
        font-size: 15px;
    }
    
    #cardInfoContainer {
        padding: 12px !important;
    }
    
    #cardInfoContainer .card-field {
        margin-bottom: 10px;
    }
    
    #cardInfoContainer .card-field-label {
        font-size: 12px;
    }
    
    #cardInfoContainer .card-field-value {
        font-size: 13px;
    }
    
    #cardInfoContainer .card-number-large {
        font-size: 15px !important;
        word-break: break-all;
    }
    
    #cardInfoContainer .copy-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    #cardInfoContainer button {
        height: 34px;
        font-size: 12px;
        padding: 0 10px;
        gap: 6px;
    }
    
    #cardInfoContainer button i {
        font-size: 14px;
    }
    
    #cardInfoContainer .card-notice {
        padding: 10px;
        font-size: 11px;
        line-height: 1.5;
    }
    
    #cardInfoContainer .card-notice-icon {
        font-size: 14px;
    }
    
    #cardModalFooter {
        padding: 12px;
    }
    
    #cardModalFooter .payment-btn {
        height: 42px;
        font-size: 13px;
    }
}

/* 高度优化 - 确保内容可滚动 */
@media (max-height: 700px) {
    #cardNumberModal .payment-dialog {
        max-height: 90vh;
    }
    
    #cardInfoContainer {
        max-height: calc(90vh - 200px);
        overflow-y: auto;
    }
}

@media (max-height: 600px) {
    #cardNumberModal .payment-dialog {
        max-height: 95vh;
    }
    
    #cardInfoContainer {
        max-height: calc(95vh - 180px);
        overflow-y: auto;
        padding: 12px !important;
    }
    
    #cardNumberModal .payment-header {
        padding: 12px;
    }
    
    #cardModalFooter {
        padding: 12px;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    #cardNumberModal .custom-dialog-overlay {
        align-items: flex-start;
        padding: 10px 0;
        overflow-y: auto;
    }
    
    #cardNumberModal .payment-dialog {
        max-height: none;
        margin: auto;
    }
    
    #cardInfoContainer {
        max-height: none;
    }
}
