/* 
 * 基礎布局
 */
 .modern-checkout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* 
 * 進度步驟
 */
.checkout-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.checkout-steps::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e0e0e0;
    z-index: 1;
}

.step {
    position: relative;
    z-index: 2;
    background: white;
    text-align: center;
    flex: 1;
    max-width: 200px;
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: #2271b1;
    color: white;
}

.step-label {
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

.step.active .step-label {
    color: #2271b1;
    font-weight: bold;
}

/* 
 * 步驟內容
 */
.checkout-step {
    display: none;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

.checkout-step.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.step-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 
 * 導航按鈕
 */
.step-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 15px;
}

button.prev-step,
button.next-step,
button#place_order {
    padding: 12px 24px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: medium;
    line-height: normal;
}

button.prev-step {
    background: #f0f0f0;
    color: #666;
}

button.next-step,
button#place_order {
    background: #2271b1;
    color: white;
}

button.prev-step:hover {
    background: #e0e0e0;
}

button.next-step:hover,
button#place_order:hover {
    background: #135e96;
}

/* 
 * 訂單檢視表格
 */
.order-review-table table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.order-review-table th,
.order-review-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

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

.product-info img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

/* 
 * 表單元素
 */
.form-row {
    margin-bottom: 20px;
}

.form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s ease;
    line-height: normal;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    border-color: #2271b1;
    outline: none;
}

/* 
 * 優惠券區塊
 */
.coupon-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 4px;
}

.coupon-form {
    display: flex;
    gap: 10px;
}

.coupon-form input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 
 * 支付方式
 */
.payment-methods {
    list-style: none;
    padding: 0;
    margin: 0;
}

.payment-method {
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.payment-method:hover {
    border-color: #2271b1;
}

/* 
 * 訂單摘要
 */
.order-summary {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 30px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.grand-total {
    font-weight: bold;
    font-size: 1.2em;
    border-bottom: none;
}
.order-summary-simple {
    padding: 20px;
    background: #f8f8f8;
    border-radius: 4px;
}

.order-summary-simple table {
    width: 100%;
    border-collapse: collapse;
}

.order-summary-simple tr {
    border-bottom: 1px solid #e0e0e0;
}

.order-summary-simple tr:last-child {
    border-bottom: none;
}

.order-summary-simple th,
.order-summary-simple td {
    padding: 12px 0;
}

.order-summary-simple th {
    text-align: left;
    font-weight: normal;
    color: #666;
}

.order-summary-simple td {
    text-align: right;
    font-weight: 500;
}

.order-summary-simple .order-total th,
.order-summary-simple .order-total td {
    font-weight: bold;
    color: #000;
}

@media (max-width: 768px) {
    .order-summary-simple {
        margin-top: 20px;
        padding: 15px;
    }
}

/* 訂單檢視區塊樣式 */
.order-review-wrapper {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
}

.order-review-table {
    flex: 2;
}

.order-summary-section {
    flex: 1;
    min-width: 300px;
}

/* 商品表格樣式 */
.order-review-table table {
    width: 100%;
    border-collapse: collapse;
}

.order-review-table th,
.order-review-table td {
    padding: 1rem;
    border-bottom: 1px solid #ddd;
}

.product-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-info img {
    width: 60px;
    height: 60px;
    object-fit: cover;
}

/* 
 * 折扣區塊
 */
.discount-section {
    position: relative;
    gap:15px;
    display: flex;
    flex-direction: column;
}

.coupon-block,
.points-block {
    display: flex;
    align-items: center;
    gap: 15px;
}

.discount-label {
    min-width: 150px;
    font-weight: 600;
}

.discount-input {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 300px;
    padding-right: 10px;
}

.discount-input input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 0; /* 防止 flex 子元素溢出 */
}

.discount-input button {
    padding: 8px 15px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.discount-row {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.toggle-discount-form {
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
}

a.toggle-text {
    color: #2271b1;
}
a.toggle-text:hover {
    color: #135e96;
}

.discount-form {
    overflow: hidden;
    width: 0;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.discount-form.active {
    width: 100%;
}


.applied-coupons {
    margin-top: 10px;
}

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

.applied-coupons li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.remove-coupon {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0;
    font-size: 18px;
}
.coupon-message,
.points-message {
    margin-left: 165px;
}

.applied-coupons {
    margin-left: 165px;
}

.applied-coupons ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.applied-coupons li {
    display: flex;
    align-items: center;
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 4px;
}

.applied-coupons .remove-coupon {
    background: none;
    border: none;
    padding: 0 0 0 8px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

/* 
 * Loading 動畫
 */
.updating {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.updating:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.discount-section.updating:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 5;
    border-radius: 8px;
}

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

/* 
 * 響應式設計
 */
@media (max-width: 768px) {
    .checkout-steps {
        flex-wrap: wrap;
        gap: 10px;
    }

    .step {
        flex: 0 0 calc(50% - 5px);
        max-width: none;
    }

    .coupon-form {
        flex-direction: column;
    }

    .product-info {
        flex-direction: column;
        text-align: center;
    }

    .step-navigation {
        flex-direction: column;
    }

    button.prev-step,
    button.next-step,
    button#place_order {
        width: 100%;
    }

    .coupon-block,
    .points-block {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .discount-label {
        min-width: auto;
    }

    .coupon-message,
    .points-message,
    .applied-coupons {
        margin-left: 0;
    }

    .order-review-wrapper {
        flex-direction: column;
    }

    .order-summary-section {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .step {
        flex: 0 0 100%;
    }

    .step-content {
        padding: 15px;
    }
}