/* =============================================================
   WC Smart Coupon — Front CSS (v2.1)
   ============================================================= */

/* ── Cart item unit price column ────────────────────────────── */
.wcsc-orig-price {
    display: block;
    color: #9ca3af;
    text-decoration: line-through;
    font-size: .9em;
    margin-bottom: 1px;
}
.wcsc-sale-price {
    display: block;
    color: #111827;
    font-weight: 600;
    text-decoration: none;
}

/**
 * Save-per-unit label shown below the discounted unit price.
 * Renders as:  (-RM5.00 / 件)
 * Appears inline in the cart item price cell — no separate breakdown needed.
 */
.wcsc-save-inline {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: #b91c1c;
    font-weight: 500;
}

/* ── Compact coupon badge row ───────────────────────────────── */
/**
 * Replaces the old per-product breakdown list.
 * One compact row below totals: code badge + "共节省 RM…" + remove button.
 */
.wcsc-coupon-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 6px;
    font-size: 13px;
}
.wcsc-coupon-badge__left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
code.wcsc-code-badge {
    background: #ede9ff;
    color: #5b21b6;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 12px;
    font-family: monospace;
}
.wcsc-coupon-badge__saving {
    color: #b91c1c;
    font-weight: 600;
    font-size: 13px;
}
.wcsc-remove-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.wcsc-remove-btn:hover {
    border-color: #b91c1c;
    color: #b91c1c;
    background: #fef2f2;
}

/* =============================================================
   RESPONSIVE — Front / Customer (cart + checkout)
   ============================================================= */

/* ── Tablet ≤ 768px ──────────────────────────────────────────── */
@media screen and (max-width: 768px) {

    /* Coupon badge: allow wrapping */
    .wcsc-coupon-badge {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }
    .wcsc-coupon-badge__left { gap: 6px; }
    .wcsc-coupon-badge__saving { font-size: 12px; }

    /* Remove button: full width when wrapped */
    .wcsc-remove-btn {
        width: 100%;
        text-align: center;
        padding: 7px 12px;
    }

    /* Save-inline: slightly smaller */
    .wcsc-save-inline { font-size: 10px; }
}

/* ── Mobile ≤ 480px ──────────────────────────────────────────── */
@media screen and (max-width: 480px) {

    /* Coupon badge: full-width stacked layout */
    .wcsc-coupon-badge {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 10px;
        border-radius: 6px;
    }

    /* Left portion: code + saving on separate lines */
    .wcsc-coupon-badge__left {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        width: 100%;
    }

    code.wcsc-code-badge {
        font-size: 11px;
        padding: 2px 6px;
    }

    .wcsc-coupon-badge__saving {
        font-size: 13px;  /* keep saving amount legible */
    }

    /* Remove button: full width */
    .wcsc-remove-btn {
        width: 100%;
        padding: 8px;
        font-size: 13px;
        text-align: center;
    }

    /* Unit price cells: tighter */
    .wcsc-orig-price { font-size: .85em; }
    .wcsc-save-inline { font-size: 10px; }

    /* WooCommerce cart table adjustments when our styles are active */
    /* On mobile WC already hides the product image column.
       Make sure our price block doesn't overflow. */
    .woocommerce-cart-form .wcsc-orig-price,
    .woocommerce-cart-form .wcsc-sale-price {
        display: inline;
        margin-right: 4px;
    }
    .woocommerce-cart-form .wcsc-save-inline {
        display: block;
        margin-top: 2px;
    }
}
