/* Checkout页面样式 */

body {
    background-color: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#checkout-main {
    padding: 40px 0;
    min-height: 80vh;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #333;
}

/* 订单摘要区域 */
.order-summary-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 20px;
}

#cart-items-container {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 30px;
}

.cart-item {
    display: flex;
    align-items: flex-start;
    padding: 20px 0;
    border-bottom: 1px solid #e9ecef;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 20px;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.cart-item-spec {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.cart-item-spec strong {
    color: #333;
}

.cart-item-price {
    font-size: 18px;
    font-weight: 600;
    color: #523A28;
    text-align: right;
}

.cart-item-quantity {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* 价格汇总 */
.price-summary {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 16px;
    color: #666;
}

.price-row.total-row {
    border-top: 2px solid #dee2e6;
    margin-top: 10px;
    padding-top: 20px;
    font-size: 20px;
    color: #333;
}

/* 表单区域 */
.checkout-form-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
}

.form-section {
    margin-bottom: 30px;
}

.form-section h5 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.required {
    color: #dc3545;
}

.form-control {
    border-radius: 4px;
    border: 1px solid #ced4da;
    padding: 12px 15px;
    font-size: 14px;
}

.form-control:focus {
    border-color: #523A28;
    box-shadow: 0 0 0 0.2rem rgba(82, 58, 40, 0.25);
}

.invalid-feedback {
    display: none;
    font-size: 13px;
    margin-top: 5px;
}

.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-invalid~.invalid-feedback {
    display: block;
}

/* 支付区域 */
.payment-notice {
    background-color: #e7f3ff;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #0066cc;
}

.payment-notice i {
    margin-right: 8px;
}

#card-element {
    padding: 15px;
    background-color: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    margin-bottom: 20px;
}

#card-errors {
    font-size: 13px;
}

/* 提交按钮 */
#submit-order {
    background-color: #523A28;
    border-color: #523A28;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s ease;
}

#submit-order:hover {
    background-color: #3d2b1e;
    border-color: #3d2b1e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(82, 58, 40, 0.3);
}

#submit-order:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

#submit-order i {
    margin-right: 10px;
}

.btn-link {
    color: #523A28;
    text-decoration: none;
}

.btn-link:hover {
    color: #3d2b1e;
    text-decoration: underline;
}

/* 加载状态 */
#page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-size: 20px;
    color: #523A28;
}

#page-loading i {
    margin-right: 15px;
    font-size: 24px;
}

/* 订单成功模态框 */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 40px;
}

.modal-body i.fa-check-circle {
    color: #28a745;
}

.modal-footer .btn-primary {
    background-color: #523A28;
    border-color: #523A28;
    padding: 12px 40px;
}

.modal-footer .btn-primary:hover {
    background-color: #3d2b1e;
    border-color: #3d2b1e;
}

/* 空购物车提示 */
.empty-cart-message {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart-message i {
    font-size: 64px;
    color: #dee2e6;
    margin-bottom: 20px;
}

.empty-cart-message h4 {
    color: #666;
    margin-bottom: 30px;
}

/* 响应式设计 */
@media (max-width: 768px) {

    .order-summary-section,
    .checkout-form-section {
        padding: 20px;
    }

    .cart-item {
        flex-direction: column;
    }

    .cart-item-image {
        margin-right: 0;
        margin-bottom: 15px;
        width: 100%;
        height: 200px;
    }

    .cart-item-price {
        text-align: left;
        margin-top: 10px;
    }

    .section-title {
        font-size: 20px;
    }

    #submit-order {
        font-size: 16px;
    }
}

/* ── Guest address migration toast ──────────────────────────────────────── */
#guest-addr-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e0d4c8;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(82, 58, 40, .18);
    padding: 20px 24px 16px;
    width: min(440px, 92vw);
    z-index: 9999;
    display: none;
    animation: toast-in .3s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

#guest-addr-toast h6 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #523A28;
    margin-bottom: 6px;
}

#guest-addr-toast p {
    font-size: 13px;
    color: #6b5040;
    margin-bottom: 14px;
    line-height: 1.5;
}

.toast-addr-preview {
    background: #fdf8f4;
    border: 1px solid #e8d8c8;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: #4a3020;
    margin-bottom: 14px;
    line-height: 1.6;
}

.toast-btns {
    display: flex;
    gap: 10px;
}

.toast-btn-save {
    flex: 1;
    padding: 9px 0;
    background: #523A28;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.toast-btn-save:hover {
    background: #3b2314;
}

.toast-btn-dismiss {
    flex: 1;
    padding: 9px 0;
    background: none;
    color: #8a7060;
    border: 1px solid #c8b4a0;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}

.toast-btn-dismiss:hover {
    background: #f5ede8;
    border-color: #a08070;
}

/* ── Address selector cards (logged-in users) ───────────────────────────── */
.checkout-saved-addresses {
    background: #fdf8f4;
    border: 1px solid #e0d4c8;
    border-radius: 8px;
    padding: 16px 18px 12px;
    margin-bottom: 20px;
}

.checkout-saved-addresses h6 {
    font-size: 13px;
    font-weight: 700;
    color: #523A28;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.checkout-addr-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e0d4c8;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .18s, background .18s;
    background: #fff;
}

.checkout-addr-option:hover {
    border-color: #8B6B4A;
    background: #fdf6f0;
}

.checkout-addr-option.selected {
    border-color: #523A28;
    background: #fdf6f0;
    box-shadow: 0 0 0 2px rgba(82, 58, 40, .12);
}

.checkout-addr-option input[type="radio"] {
    margin-top: 3px;
    accent-color: #523A28;
    flex-shrink: 0;
}

.checkout-addr-text {
    font-size: 13.5px;
    color: #3a2515;
    line-height: 1.55;
}

.checkout-addr-new-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #523A28;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-top: 4px;
}

.checkout-addr-new-toggle:hover {
    color: #3b2314;
}

/* ── Manage-addresses link ───────────────────────────────────────────────── */
.checkout-addr-manage-link {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #8B6B4A;
    text-decoration: none;
    margin-top: 6px;
}

.checkout-addr-manage-link:hover {
    color: #523A28;
    text-decoration: underline;
}

/* ── Readonly address field look ─────────────────────────────────────────── */
.form-control[readonly],
.form-control:disabled {
    background-color: #f8f5f2 !important;
    color: #6b5040;
    cursor: default;
}