/**
 * PC端购买弹窗样式
 *
 * @package HiTemp
 * @since 1.0.0
 */

/* ===== 购买弹窗 ===== */
.purchase-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.purchase-modal.show {
    opacity: 1;
    visibility: visible;
}

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

.purchase-modal-content {
    position: relative;
    width: 480px;
    max-width: 95%;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.purchase-modal.show .purchase-modal-content {
    transform: scale(1) translateY(0);
}

/* 弹窗头部 */
.purchase-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg, #fff7ed 0%, #fff 100%);
}

.purchase-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.purchase-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.purchase-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

/* 弹窗内容 */
.purchase-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* 商品信息 */
.purchase-product-info {
    display: flex;
    gap: 15px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e2e8f0;
    margin-bottom: 20px;
}

.purchase-product-thumb {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.purchase-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.purchase-product-thumb .no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 24px;
}

.purchase-product-detail {
    flex: 1;
    min-width: 0;
}

.purchase-product-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.purchase-product-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 价格信息 */
.purchase-price-section {
    background: #f8fafc;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.purchase-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.purchase-price-row:not(:last-child) {
    border-bottom: 1px dashed #e2e8f0;
}

.purchase-price-label {
    font-size: 14px;
    color: #64748b;
}

.purchase-price-value {
    font-size: 14px;
    color: #1e293b;
    font-weight: 500;
}

.purchase-price-value.discount {
    color: #10b981;
}

.member-discount-row {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.08) 0%, rgba(139, 92, 246, 0.02) 100%);
    margin: 0 -12px;
    padding: 8px 12px !important;
    border-radius: 6px;
}

.member-discount-row .purchase-price-label {
    color: #7c3aed;
    font-weight: 500;
}

.member-discount-row .purchase-price-value {
    color: #7c3aed;
    font-weight: 600;
}

.purchase-price-row.total-row {
    padding-top: 12px;
    margin-top: 4px;
}

.purchase-price-row.total-row .purchase-price-label {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.purchase-price-row.total-row .purchase-price-value.total {
    font-size: 22px;
    font-weight: 700;
    color: #f66600;
}

/* 优惠券区域 - 下拉式 */
.purchase-coupon-section {
    margin-bottom: 20px;
    position: relative;
    z-index: 10;
}

/* 下拉容器 */
.coupon-dropdown {
    position: relative;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* 下拉头部 */
.coupon-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #fffbeb;
    cursor: pointer;
    transition: background 0.2s;
}

.coupon-dropdown-header:hover {
    background: #fef3c7;
}

.coupon-dropdown-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coupon-dropdown-left i {
    font-size: 16px;
    color: #f59e0b;
}

.coupon-dropdown-label {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.coupon-discount-label {
    font-size: 14px;
    font-weight: 600;
    color: #ea580c;
}

.coupon-dropdown-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coupon-dropdown-status {
    font-size: 13px;
}

.coupon-available-count {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
}

.coupon-none-text {
    color: #94a3b8;
}

.coupon-dropdown-arrow {
    font-size: 12px;
    color: #64748b;
    transition: transform 0.3s;
}

.coupon-dropdown.open .coupon-dropdown-arrow {
    transform: rotate(180deg);
}


/* 下拉列表 - fixed定位悬浮在弹窗外层 */
.coupon-dropdown-list {
    position: fixed;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, max-height 0.3s ease;
    z-index: 999999;
}

.coupon-dropdown-list.show {
    max-height: 320px;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
}

.coupon-list-inner {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.coupon-list-inner::-webkit-scrollbar {
    width: 4px;
}

.coupon-list-inner::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* 优惠券项 */
.coupon-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    flex-direction: row-reverse;
}

.coupon-item:hover:not(.disabled) {
    border-color: #f59e0b;
}

.coupon-item.active {
    border-color: #f59e0b;
    background: #fffbeb;
}

.coupon-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8fafc;
}

.coupon-item input[type="radio"] {
    display: none;
}

/* 自定义单选框 */
.coupon-radio {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    position: relative;
    transition: all 0.2s;
}

.coupon-item.active .coupon-radio {
    border-color: #f59e0b;
    background: #f59e0b;
}

.coupon-item.active .coupon-radio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

/* 不使用优惠券选项 */
.coupon-item.coupon-none {
    padding: 14px 12px;
    align-items: center;
}

.coupon-item.coupon-none .coupon-item-text {
    flex: 1;
    font-size: 14px;
    color: #64748b;
}

.coupon-item.coupon-none.active .coupon-item-text {
    color: #1e293b;
}

/* 优惠券卡片样式 */
.coupon-item.coupon-card {
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    position: relative;
    align-items: stretch;
}

.coupon-item.coupon-card .coupon-radio {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    z-index: 2;
}

.coupon-card-content {
    flex: 1;
    display: flex;
    min-width: 0;
}

/* 虚线分隔效果 */
.coupon-card-content::before {
    content: '';
    position: absolute;
    left: 90px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 4px,
        #e5e7eb 4px,
        #e5e7eb 8px
    );
}

.coupon-card-left {
    flex-shrink: 0;
    width: 90px;
    text-align: center;
    padding: 16px 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.coupon-item.disabled .coupon-card-left {
    background: #e5e7eb;
    color: #9ca3af;
}

.coupon-card-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
}

.coupon-card-value .value-num {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.coupon-card-value .value-unit {
    font-size: 26px;
    font-weight: 500;
    margin-left: 2px;
}

.coupon-card-type {
    font-size: 11px;
    margin-top: 6px;
    opacity: 0.9;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

.coupon-card-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 14px 16px 14px 20px;
}

.coupon-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 30px;
}

.coupon-item.disabled .coupon-card-name {
    color: #9ca3af;
}

.coupon-card-condition {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.coupon-card-condition::before {
    content: '';
    width: 4px;
    height: 4px;
    background: #f59e0b;
    border-radius: 50%;
}

.coupon-item.disabled .coupon-card-condition::before {
    background: #9ca3af;
}

.coupon-card-expire {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
}

.coupon-card-expire i {
    margin-right: 5px;
    font-size: 11px;
}

/* 无优惠券提示 */
.no-coupon-tip {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 13px;
    background: #f8fafc;
    border-radius: 8px;
}

.no-coupon-tip i {
    margin-right: 6px;
}

/* 登录提示 */
.purchase-login-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 14px;
    color: #64748b;
}

.purchase-login-tip i {
    font-size: 20px;
    color: #94a3b8;
}

.purchase-login-tip a {
    color: #f66600;
    text-decoration: none;
    font-weight: 500;
}

.purchase-login-tip a:hover {
    text-decoration: underline;
}

/* 弹窗底部 */
.purchase-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
}

.purchase-footer-price {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.footer-price-label {
    font-size: 14px;
    color: #64748b;
}

.footer-price-value {
    font-size: 26px;
    font-weight: 700;
    color: #f66600;
}

.btn-purchase-confirm {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 40px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #f66600, #ff8534);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-purchase-confirm:hover {
    background: linear-gradient(135deg, #e55a00, #f66600);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(246, 102, 0, 0.3);
}

.btn-purchase-confirm:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-purchase-confirm.loading {
    pointer-events: none;
}

.btn-purchase-confirm.loading i {
    animation: purchase-spin 1s linear infinite;
}

@keyframes purchase-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 购买结果提示 */
.purchase-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 28px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    z-index: 999999;
    animation: purchaseResultIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.purchase-result.success {
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.purchase-result.success i {
    font-size: 22px;
}

.purchase-result.error {
    border: 1px solid #fecaca;
    color: #dc2626;
}

.purchase-result.error i {
    font-size: 22px;
}

.purchase-result.warning {
    border: 1px solid #fef3c7;
    color: #d97706;
}

.purchase-result.warning i {
    font-size: 22px;
}

@keyframes purchaseResultIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 自定义确认弹窗 */
.purchase-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.purchase-confirm-overlay.show {
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.5);
}

.purchase-confirm-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 380px;
    max-width: 90%;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.purchase-confirm-overlay.show .purchase-confirm-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.purchase-confirm-header {
    padding: 24px 24px 0;
    text-align: center;
}

.purchase-confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: #fef3c7;
    color: #d97706;
}

.purchase-confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.purchase-confirm-body {
    padding: 16px 24px 24px;
    text-align: center;
}

.purchase-confirm-message {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.purchase-confirm-footer {
    display: flex;
    border-top: 1px solid #e2e8f0;
}

.purchase-confirm-btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.purchase-confirm-btn:first-child {
    border-right: 1px solid #e2e8f0;
    color: #64748b;
    border-radius: 0 0 0 16px;
}

.purchase-confirm-btn:first-child:hover {
    background: #f8fafc;
    color: #475569;
}

.purchase-confirm-btn:last-child {
    color: #fff;
    background: var(--primary-color, #f66600);
    border-radius: 0 0 16px 0;
}

.purchase-confirm-btn:last-child:hover {
    background: var(--primary-hover, #e55a00);
}

/* 弹窗打开时禁止滚动 */
body.modal-open {
    overflow: hidden;
}

/* 弹窗响应式 */
@media (max-width: 520px) {
    .purchase-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .purchase-modal-body {
        padding: 20px 15px;
    }
    
    .purchase-modal-footer {
        padding: 15px;
    }
    
    .btn-purchase-confirm {
        padding: 12px 30px;
    }
}

