/**
 * WooCommerce One Page Checkout - 前台樣式
 * 自適應主題設計 - 不覆蓋主題顏色
 *
 * @package Woo_Onepage_Checkout
 */

/* ==========================================================================
   基礎樣式 - 繼承主題
   ========================================================================== */

.woo-opc-checkout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

.woo-opc-checkout * {
    box-sizing: border-box;
}

/* ==========================================================================
   主要版面配置
   ========================================================================== */

/* 滿版區塊（購物車、加購） */
.woo-opc-full-width {
    width: 100%;
}

/* 結帳資訊 + 訂單摘要 並排 */
.woo-opc-checkout-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}

.woo-opc-checkout-row > .woo-opc-checkout-form-section {
    flex: 1 1 auto !important;
    min-width: 0;
    max-width: calc(100% - 430px);
}

.woo-opc-checkout-row > .woo-opc-sidebar {
    flex: 0 0 400px !important;
    width: 400px !important;
    max-width: 400px;
}

@media (max-width: 991px) {
    .woo-opc-checkout-row {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }

    .woo-opc-checkout-row > .woo-opc-checkout-form-section {
        max-width: 100%;
        width: 100%;
    }

    .woo-opc-checkout-row > .woo-opc-sidebar {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100%;
    }
}

/* ==========================================================================
   區塊樣式 - 使用透明/半透明背景
   ========================================================================== */

.woo-opc-cart-section,
.woo-opc-upsell-section,
.woo-opc-checkout-form-section,
.woo-opc-order-summary {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 亮色主題自動適應 */
@media (prefers-color-scheme: light) {
    .woo-opc-cart-section,
    .woo-opc-upsell-section,
    .woo-opc-checkout-form-section,
    .woo-opc-order-summary {
        background: rgba(0, 0, 0, 0.02);
        border-color: rgba(0, 0, 0, 0.1);
    }
}

.woo-opc-section-title {
    font-size: 1.15em;
    font-weight: 600;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}

/* ==========================================================================
   購物車表格 - 繼承主題
   ========================================================================== */

.woo-opc-cart-table {
    width: 100%;
    border-collapse: collapse;
    border: none !important;
}

.woo-opc-cart-table th,
.woo-opc-cart-table td {
    padding: 10px 8px;
    text-align: left;
    vertical-align: middle;
    border: none;
}

.woo-opc-cart-table th {
    font-weight: 600;
    font-size: 0.9em;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.woo-opc-cart-table thead th {
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

/* 商品圖片 */
.woo-opc-cart-item-image {
    width: 60px;
}

.woo-opc-cart-item-image img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

/* 商品資訊 */
.woo-opc-cart-item-details {
    min-width: 150px;
}

.woo-opc-cart-item-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.woo-opc-cart-item-name a {
    color: inherit;
    text-decoration: none;
}

.woo-opc-cart-item-name a:hover {
    opacity: 0.8;
}

.woo-opc-cart-item-meta {
    font-size: 0.85em;
    opacity: 0.7;
}

/* 數量選擇 */
.woo-opc-cart-item-quantity {
    width: 130px;
}

.woo-opc-quantity-wrapper {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.woo-opc-qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #fff;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woo-opc-qty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.woo-opc-qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.woo-opc-qty-input {
    width: 50px !important;
    height: 32px !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 0 !important;
    font-size: 14px !important;
    background: transparent !important;
    color: #fff !important;
    padding: 0 !important;
    -moz-appearance: textfield !important;
}

.woo-opc-qty-input::-webkit-outer-spin-button,
.woo-opc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.woo-opc-qty-input:focus {
    outline: none;
}

/* 價格與移除 */
.woo-opc-cart-item-price,
.woo-opc-cart-item-subtotal {
    white-space: nowrap;
    font-weight: 500;
}

.woo-opc-cart-item-remove {
    width: 50px;
    text-align: center;
}

.woo-opc-remove-btn {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    transition: opacity 0.2s;
}

.woo-opc-remove-btn:hover {
    opacity: 1;
    color: #e74c3c;
}

/* 空購物車 */
.woo-opc-empty-cart {
    text-align: center;
    padding: 40px 20px;
    opacity: 0.7;
}

.woo-opc-empty-cart-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* 已套用優惠券 */
.woo-opc-applied-coupons {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
}

.woo-opc-coupon-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: rgba(128, 128, 128, 0.15);
    border-radius: 20px;
    font-size: 0.9em;
    margin-right: 8px;
}

.woo-opc-coupon-tag .woo-opc-remove-coupon {
    color: inherit;
    opacity: 0.6;
    text-decoration: none;
    font-size: 1.1em;
}

.woo-opc-coupon-tag .woo-opc-remove-coupon:hover {
    opacity: 1;
}

/* ==========================================================================
   加價購區塊
   ========================================================================== */

.woo-opc-upsell-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.woo-opc-upsell-item {
    padding: 12px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.woo-opc-upsell-item:hover {
    border-color: rgba(128, 128, 128, 0.4);
    background: rgba(128, 128, 128, 0.05);
}

.woo-opc-upsell-image {
    flex-shrink: 0;
}

.woo-opc-upsell-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.woo-opc-upsell-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.woo-opc-upsell-top {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.woo-opc-upsell-bottom {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
}

.woo-opc-upsell-name {
    font-size: 0.9em;
    font-weight: 500;
    line-height: 1.3;
}

.woo-opc-upsell-name a {
    color: inherit;
    text-decoration: none;
}

.woo-opc-upsell-price {
    font-size: 0.9em;
    font-weight: 600;
}

.woo-opc-upsell-price del {
    opacity: 0.5;
    font-weight: normal;
}

.woo-opc-upsell-price ins {
    text-decoration: none;
}

.woo-opc-upsell-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* 加入按鈕 - 使用主題預設樣式 */
.woo-opc-upsell-add-btn {
    padding: .618em 1em !important;
}

.woo-opc-upsell-add-btn.adding {
    opacity: 0.6;
    pointer-events: none;
}

/* 加價購變體選擇器 */
.woo-opc-upsell-variations {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.woo-opc-variation-row {
    flex: 1;
    min-width: 100px;
}

.woo-opc-variation-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-size: 0.85em;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.woo-opc-variation-select:focus {
    outline: none;
    border-color: rgba(128, 128, 128, 0.6);
}

.woo-opc-variation-select:hover {
    border-color: rgba(128, 128, 128, 0.5);
}

.woo-opc-upsell-variation-price {
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 6px;
    text-align: center;
}

.woo-opc-upsell-variation-price del {
    opacity: 0.5;
    font-weight: normal;
}

.woo-opc-upsell-variation-price ins {
    text-decoration: none;
}

/* 可變商品按鈕狀態 */
.woo-opc-upsell-variable-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(128, 128, 128, 0.1);
}

.woo-opc-upsell-variable-btn.woo-opc-out-of-stock {
    opacity: 0.5;
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.3);
}

.woo-opc-upsell-variable-btn.woo-opc-variation-selected {
    background: rgba(39, 174, 96, 0.1);
    border-color: rgba(39, 174, 96, 0.4);
}

/* 加價購數量選擇器 */
.woo-opc-upsell-quantity {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.woo-opc-upsell-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #fff;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woo-opc-upsell-qty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.woo-opc-upsell-qty-input {
    width: 40px !important;
    height: 28px !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.3) !important;
    font-size: 13px !important;
    background: transparent !important;
    color: #fff !important;
    -moz-appearance: textfield !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.woo-opc-upsell-qty-input::-webkit-outer-spin-button,
.woo-opc-upsell-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.woo-opc-upsell-qty-input:focus {
    outline: none;
    border-color: rgba(128, 128, 128, 0.6);
}

/* ==========================================================================
   結帳表單 - 繼承 WooCommerce 樣式
   ========================================================================== */

.woo-opc-checkout-form-section .woocommerce-checkout {
    margin: 0;
}

/* 客戶資訊單欄佈局 */
.woo-opc-checkout-form-section .woo-opc-customer-details {
    display: block;
}

.woo-opc-checkout-form-section .col2-set {
    display: block;
}

.woo-opc-checkout-form-section .col2-set .col-1,
.woo-opc-checkout-form-section .col2-set .col-2 {
    width: 100%;
}

.woo-opc-checkout-form-section h3 {
    font-size: 1em;
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

/* 表單欄位 - 確保 label 可見 */
.woo-opc-checkout-form-section .form-row {
    margin-bottom: 10px;
}

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

.woo-opc-checkout-form-section .form-row label .required {
    color: #e74c3c;
}

.woo-opc-checkout-form-section .form-row input[type="text"],
.woo-opc-checkout-form-section .form-row input[type="email"],
.woo-opc-checkout-form-section .form-row input[type="tel"],
.woo-opc-checkout-form-section .form-row input[type="number"],
.woo-opc-checkout-form-section .form-row select,
.woo-opc-checkout-form-section .form-row textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-size: 0.95em;
}

.woo-opc-checkout-form-section .form-row input:focus,
.woo-opc-checkout-form-section .form-row select:focus,
.woo-opc-checkout-form-section .form-row textarea:focus {
    outline: none;
    border-color: rgba(128, 128, 128, 0.6);
}

/* Select2 下拉選單適應 */
.woo-opc-checkout-form-section .select2-container--default .select2-selection--single {
    background: transparent;
    border-color: rgba(128, 128, 128, 0.3);
    height: auto;
    padding: 8px 12px;
}

.woo-opc-checkout-form-section .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: inherit;
    line-height: 1.5;
    padding: 0;
}

/* ==========================================================================
   訂單摘要（側邊欄）
   ========================================================================== */

/* Sidebar 在 checkout-row 內時使用 sticky */
.woo-opc-checkout-row > .woo-opc-sidebar {
    position: sticky;
    top: 20px;
}

/* WooCommerce 訂單明細表格樣式 - 使用 flexbox 確保正常顯示 */
.woo-opc-order-summary .woocommerce-checkout-review-order-table,
.woo-opc-order-summary table.shop_table {
    display: block !important;
    width: 100% !important;
    border: none !important;
}

/* 隱藏表頭和商品列 */
.woo-opc-order-summary .woocommerce-checkout-review-order-table thead,
.woo-opc-order-summary .woocommerce-checkout-review-order-table tbody,
.woo-opc-order-summary .woocommerce-checkout-review-order-table tr.cart_item,
.woo-opc-order-summary table.shop_table thead,
.woo-opc-order-summary table.shop_table tbody,
.woo-opc-order-summary table.shop_table tr.cart_item {
    display: none !important;
}

/* tfoot 顯示為 block */
.woo-opc-order-summary .woocommerce-checkout-review-order-table tfoot,
.woo-opc-order-summary table.shop_table tfoot {
    display: block !important;
    width: 100% !important;
}

/* tfoot 內的行使用 flexbox 佈局 */
.woo-opc-order-summary .woocommerce-checkout-review-order-table tfoot tr,
.woo-opc-order-summary table.shop_table tfoot tr {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 0 !important;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15) !important;
    width: 100% !important;
}

.woo-opc-order-summary .woocommerce-checkout-review-order-table tfoot th,
.woo-opc-order-summary .woocommerce-checkout-review-order-table tfoot td,
.woo-opc-order-summary table.shop_table tfoot th,
.woo-opc-order-summary table.shop_table tfoot td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    white-space: nowrap !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

.woo-opc-order-summary .woocommerce-checkout-review-order-table tfoot th,
.woo-opc-order-summary table.shop_table tfoot th {
    text-align: left !important;
    font-weight: normal !important;
    flex-shrink: 0 !important;
}

.woo-opc-order-summary .woocommerce-checkout-review-order-table tfoot td,
.woo-opc-order-summary table.shop_table tfoot td {
    text-align: right !important;
    font-weight: 500 !important;
    margin-left: auto !important;
}

.woo-opc-order-summary .woocommerce-checkout-review-order-table .order-total,
.woo-opc-order-summary table.shop_table .order-total {
    border-bottom: none !important;
}

.woo-opc-order-summary .woocommerce-checkout-review-order-table .order-total th,
.woo-opc-order-summary .woocommerce-checkout-review-order-table .order-total td,
.woo-opc-order-summary table.shop_table .order-total th,
.woo-opc-order-summary table.shop_table .order-total td {
    font-weight: 600 !important;
    font-size: 1.1em !important;
}

/* 付款方式區塊 */
.woo-opc-order-summary .wc_payment_methods {
    list-style: none !important;
    margin: 15px 0 0 0 !important;
    padding: 0 !important;
    display: block !important;
    width: 100% !important;
}

.woo-opc-order-summary .wc_payment_method {
    display: block !important;
    padding: 12px 0 !important;
    border-bottom: 1px solid rgba(128, 128, 128, 0.1) !important;
    width: 100% !important;
}

.woo-opc-order-summary .wc_payment_method:last-child {
    border-bottom: none !important;
}

.woo-opc-order-summary .wc_payment_method > label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    writing-mode: horizontal-tb !important;
    width: 100% !important;
}

.woo-opc-order-summary .wc_payment_method input[type="radio"] {
    flex-shrink: 0 !important;
    width: 18px !important;
    height: 18px !important;
}

.woo-opc-order-summary .payment_box {
    margin-top: 10px !important;
    padding: 12px !important;
    background: rgba(128, 128, 128, 0.1) !important;
    border-radius: 4px !important;
    writing-mode: horizontal-tb !important;
}

.woo-opc-order-review {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.woo-opc-order-review th,
.woo-opc-order-review td {
    padding: 8px 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.woo-opc-order-review th {
    font-weight: normal;
    opacity: 0.8;
    text-align: left;
}

.woo-opc-order-review td {
    text-align: right;
}

.woo-opc-order-review .order-total th,
.woo-opc-order-review .order-total td {
    font-size: 1.1em;
    font-weight: 600;
    border-bottom: none;
    padding-top: 10px;
}

/* 優惠券輸入 */
.woo-opc-coupon-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.woo-opc-coupon-toggle {
    display: block;
    color: inherit;
    opacity: 0.8;
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
}

.woo-opc-coupon-toggle:hover {
    opacity: 1;
}

.woo-opc-coupon-form {
    display: none;
    margin-top: 10px;
}

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

.woo-opc-coupon-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-size: 14px;
}

.woo-opc-coupon-btn {
    padding: 10px 18px;
    background: rgba(128, 128, 128, 0.2);
    color: inherit;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.woo-opc-coupon-btn:hover {
    background: rgba(128, 128, 128, 0.3);
}

/* 物流選項 */
.woo-opc-shipping-methods {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.woo-opc-shipping-methods h4,
.woo-opc-payment-section h4 {
    font-size: 0.95em;
    margin: 0 0 8px;
    font-weight: 600;
}

/* 物流和金流選項 - 繼承 WooCommerce 樣式 */
.woo-opc-order-summary #shipping_method li,
.woo-opc-order-summary .wc_payment_methods li {
    list-style: none;
    padding: 6px 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.woo-opc-order-summary #shipping_method li:last-child,
.woo-opc-order-summary .wc_payment_methods li:last-child {
    border-bottom: none;
}

.woo-opc-order-summary #shipping_method label,
.woo-opc-order-summary .wc_payment_methods label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* 付款方式 */
.woo-opc-payment-section {
    margin-bottom: 12px;
}

.woo-opc-payment-section .wc_payment_methods {
    margin: 0;
    padding: 0;
}

.woo-opc-payment-section .payment_box {
    padding: 10px;
    margin-top: 6px;
    background: rgba(128, 128, 128, 0.1);
    border-radius: 4px;
    font-size: 0.85em;
}

/* 結帳按鈕 */
.woo-opc-order-summary .place-order {
    margin-top: 12px;
}

.woo-opc-place-order-btn,
.woo-opc-order-summary #place_order {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: var(--wc-primary, #7f54b3);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.woo-opc-place-order-btn:hover,
.woo-opc-order-summary #place_order:hover {
    opacity: 0.9;
}

.woo-opc-place-order-btn:disabled,
.woo-opc-order-summary #place_order:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   快速結帳按鈕（商品頁）
   ========================================================================== */

.woo-opc-quick-buy-wrapper {
    margin-top: 10px;
}

.woo-opc-quick-buy-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    border: 2px solid;
}

/* 主要樣式 - 使用主題按鈕顏色 */
.woo-opc-quick-buy-btn.style-primary {
    background: var(--wc-primary, #7f54b3);
    border-color: var(--wc-primary, #7f54b3);
    color: #fff;
}

.woo-opc-quick-buy-btn.style-primary:hover {
    opacity: 0.9;
}

/* 次要樣式 */
.woo-opc-quick-buy-btn.style-secondary {
    background: transparent;
    border-color: currentColor;
    color: inherit;
}

.woo-opc-quick-buy-btn.style-secondary:hover {
    background: rgba(128, 128, 128, 0.1);
}

/* 強調樣式 */
.woo-opc-quick-buy-btn.style-accent {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.woo-opc-quick-buy-btn.style-accent:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.woo-opc-quick-buy-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ==========================================================================
   訊息提示
   ========================================================================== */

.woo-opc-notice {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.woo-opc-notice-success {
    background: rgba(39, 174, 96, 0.15);
    border: 1px solid rgba(39, 174, 96, 0.3);
    color: #27ae60;
}

.woo-opc-notice-error {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.woo-opc-notice-info {
    background: rgba(52, 152, 219, 0.15);
    border: 1px solid rgba(52, 152, 219, 0.3);
    color: #3498db;
}

/* ==========================================================================
   載入狀態
   ========================================================================== */

.woo-opc-loading {
    position: relative;
    pointer-events: none;
}

.woo-opc-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.woo-opc-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: woo-opc-spin 1s linear infinite;
    z-index: 11;
}

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

/* ==========================================================================
   響應式調整
   ========================================================================== */

@media (max-width: 767px) {
    .woo-opc-checkout {
        padding: 15px;
    }

    .woo-opc-cart-section,
    .woo-opc-upsell-section,
    .woo-opc-checkout-form-section,
    .woo-opc-order-summary {
        padding: 15px;
    }

    .woo-opc-cart-table th.woo-opc-cart-col-price,
    .woo-opc-cart-table td.woo-opc-cart-item-price {
        display: none;
    }

    .woo-opc-cart-table th,
    .woo-opc-cart-table td {
        padding: 10px 5px;
    }

    .woo-opc-cart-item-image img {
        width: 50px;
        height: 50px;
    }

    .woo-opc-upsell-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .woo-opc-upsell-image img {
        width: 60px;
        height: 60px;
    }

    .woo-opc-upsell-actions {
        flex-wrap: wrap;
    }

    .woo-opc-variation-select {
        font-size: 0.8em;
        padding: 5px 8px;
    }

    .woo-opc-sidebar {
        position: static;
    }
}

@media (max-width: 480px) {
    .woo-opc-cart-table thead {
        display: none;
    }

    .woo-opc-cart-table,
    .woo-opc-cart-table tbody,
    .woo-opc-cart-table tr,
    .woo-opc-cart-table td {
        display: block;
    }

    .woo-opc-cart-table tr {
        padding: 15px 0;
        border-bottom: 1px solid rgba(128, 128, 128, 0.2);
        position: relative;
    }

    .woo-opc-cart-table td {
        padding: 5px 0;
        border: none;
        text-align: left;
    }

    .woo-opc-cart-item-image {
        float: left;
        margin-right: 15px;
        width: auto;
    }

    .woo-opc-cart-item-remove {
        position: absolute;
        top: 15px;
        right: 0;
        width: auto;
    }

    .woo-opc-cart-item-subtotal {
        font-weight: 600;
        margin-top: 10px;
    }

    .woo-opc-cart-item-subtotal::before {
        content: '小計: ';
        opacity: 0.7;
    }

    .woo-opc-coupon-form.active {
        flex-direction: column;
    }

    .woo-opc-upsell-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   WooCommerce 覆寫 - 確保相容性
   ========================================================================== */

.woo-opc-checkout .woocommerce-form-coupon-toggle,
.woo-opc-checkout .woocommerce-info {
    background: rgba(128, 128, 128, 0.1);
    border: none;
    color: inherit;
}

.woo-opc-checkout .woocommerce-info::before {
    color: inherit;
}

/* 確保 WooCommerce 表單欄位可見 */
.woo-opc-checkout .woocommerce-billing-fields__field-wrapper,
.woo-opc-checkout .woocommerce-shipping-fields__field-wrapper,
.woo-opc-checkout .woocommerce-additional-fields__field-wrapper {
    display: block;
}

.woo-opc-checkout .woocommerce-billing-fields__field-wrapper .form-row,
.woo-opc-checkout .woocommerce-shipping-fields__field-wrapper .form-row,
.woo-opc-checkout .woocommerce-additional-fields__field-wrapper .form-row {
    margin-bottom: 10px;
}

/* Terms checkbox */
.woo-opc-checkout .woocommerce-terms-and-conditions-wrapper {
    margin-bottom: 15px;
}

.woo-opc-checkout .woocommerce-privacy-policy-text {
    font-size: 0.85em;
    opacity: 0.8;
}

/* 訂單明細區域修正 - 確保所有子元素寬度正確 */
.woo-opc-order-review-wrapper,
.woo-opc-order-summary .woo-opc-order-review-wrapper,
.woo-opc-order-summary #order_review {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    display: block !important;
    padding: 0 !important;
    border: none !important;
    float: none !important;
}

.woo-opc-order-review-wrapper #order_review_heading,
.woo-opc-order-summary #order_review_heading,
#order_review #order_review_heading {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    float: none !important;
    border: none !important;
}

/* 確保訂單摘要內的表格寬度正確 */
.woo-opc-order-summary .shop_table,
.woo-opc-order-summary .woocommerce-checkout-review-order-table,
#order_review_heading .shop_table,
#order_review_heading .woocommerce-checkout-review-order-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
}

/* 修正 WooCommerce 付款方式列表 - 確保水平顯示 */
.woo-opc-order-summary .woocommerce-checkout-payment,
.woo-opc-order-summary #payment {
    display: block !important;
    width: 100% !important;
}

.woo-opc-order-summary .woocommerce-checkout-payment .wc_payment_methods,
.woo-opc-order-summary #payment .wc_payment_methods {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    display: block !important;
    width: 100% !important;
}

.woo-opc-order-summary .woocommerce-checkout-payment .wc_payment_method,
.woo-opc-order-summary #payment .wc_payment_method {
    padding: 10px 0 !important;
    border-bottom: 1px solid rgba(128, 128, 128, 0.1) !important;
    display: block !important;
    width: 100% !important;
}

.woo-opc-order-summary .woocommerce-checkout-payment .wc_payment_method:last-child,
.woo-opc-order-summary #payment .wc_payment_method:last-child {
    border-bottom: none !important;
}

.woo-opc-order-summary .woocommerce-checkout-payment .wc_payment_method > label,
.woo-opc-order-summary #payment .wc_payment_method > label {
    display: inline !important;
    cursor: pointer !important;
    font-weight: normal !important;
    white-space: nowrap !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

.woo-opc-order-summary .woocommerce-checkout-payment .payment_box,
.woo-opc-order-summary #payment .payment_box {
    padding: 10px !important;
    margin-top: 8px !important;
    background: rgba(128, 128, 128, 0.1) !important;
    border-radius: 4px !important;
    font-size: 0.85em !important;
    writing-mode: horizontal-tb !important;
}

/* 結帳按鈕 */
.woo-opc-order-summary .place-order {
    margin-top: 15px;
}

.woo-opc-order-summary #place_order {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: var(--wc-primary, #7f54b3);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.woo-opc-order-summary #place_order:hover {
    opacity: 0.9;
}

/* ==========================================================================
   強制訂單摘要區域水平文字顯示（修復垂直文字問題）
   ========================================================================== */

.woo-opc-order-summary,
.woo-opc-order-summary * {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

/* 確保所有表格元素使用正確的顯示模式 */
.woo-opc-order-summary table {
    display: block !important;
    width: 100% !important;
    table-layout: auto !important;
}

.woo-opc-order-summary table tfoot {
    display: block !important;
    width: 100% !important;
}

.woo-opc-order-summary table tfoot tr {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15) !important;
}

.woo-opc-order-summary table tfoot tr:last-child {
    border-bottom: none !important;
}

.woo-opc-order-summary table tfoot th,
.woo-opc-order-summary table tfoot td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    min-width: auto !important;
}

.woo-opc-order-summary table tfoot th {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    width: auto !important;
}

.woo-opc-order-summary table tfoot td {
    white-space: normal !important;
    text-align: right !important;
    flex-grow: 1 !important;
    margin-left: 10px !important;
}

/* 確保所有 label 和文字內容水平顯示 */
.woo-opc-order-summary label,
.woo-opc-order-summary span,
.woo-opc-order-summary p,
.woo-opc-order-summary th,
.woo-opc-order-summary td {
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    white-space: normal !important;
}

/* 運送方式列表 */
.woo-opc-order-summary #shipping_method,
.woo-opc-order-summary .woocommerce-shipping-methods {
    display: block !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.woo-opc-order-summary #shipping_method li,
.woo-opc-order-summary .woocommerce-shipping-methods li {
    display: block !important;
    padding: 5px 0 !important;
}

.woo-opc-order-summary #shipping_method li label,
.woo-opc-order-summary .woocommerce-shipping-methods li label {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 5px !important;
    white-space: normal !important;
    line-height: 1.4 !important;
}

/* 運送方式表格行 - 特殊處理 */
.woo-opc-order-summary table tfoot tr.woocommerce-shipping-totals,
.woo-opc-order-summary table tfoot tr.shipping {
    display: block !important;
    width: 100% !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15) !important;
}

.woo-opc-order-summary table tfoot tr.woocommerce-shipping-totals th,
.woo-opc-order-summary table tfoot tr.shipping th {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
    font-weight: normal !important;
    margin-bottom: 8px !important;
}

.woo-opc-order-summary table tfoot tr.woocommerce-shipping-totals td,
.woo-opc-order-summary table tfoot tr.shipping td {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
}

.woo-opc-order-summary table tfoot tr.woocommerce-shipping-totals #shipping_method,
.woo-opc-order-summary table tfoot tr.shipping #shipping_method {
    width: 100% !important;
}

.woo-opc-order-summary table tfoot tr.woocommerce-shipping-totals #shipping_method li,
.woo-opc-order-summary table tfoot tr.shipping #shipping_method li {
    width: 100% !important;
}

.woo-opc-order-summary table tfoot tr.woocommerce-shipping-totals #shipping_method li label,
.woo-opc-order-summary table tfoot tr.shipping #shipping_method li label {
    width: auto !important;
    white-space: normal !important;
}

ul#shipping_method li:not(.elementor-widget-woocommerce-cart #shipping_method li) {
    text-indent: 0 !important;
}

/* ==========================================================================
   Elementor 主題的「立即下單」連結
   ========================================================================== */

/*
 * 不再隱藏 Elementor 的立即下單按鈕
 * 我們的 JS 會攔截其點擊事件，使用 AJAX 功能
 */
