/* ==========================================================================
   Cart page (loaded only on /cart)
   ========================================================================== */

.cartx {
    --cartx-brand: #026941;
    --cartx-brand-soft: #e8f3ee;
    --cartx-text: #1c1f1d;
    --cartx-muted: #6b7280;
    --cartx-line: #e7ebe9;
    --cartx-bg: #f6f8f7;
    --cartx-radius: 14px;
    color: var(--cartx-text);
    margin-top: 10px;
    /* .section-box uses overflow:hidden, which breaks the sticky sidebar; clip doesn't */
    overflow: clip;
}

/* ---------- Header ---------- */
.cartx-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 8px 0 22px;
}

.cartx-head__title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    color: var(--cartx-text);
}

.cartx-head__count {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cartx-brand);
    background: var(--cartx-brand-soft);
    border-radius: 999px;
}

.cartx-head__back {
    font-size: 14px;
    font-weight: 500;
    color: var(--cartx-brand);
    text-decoration: none;
}

.cartx-head__back:hover {
    text-decoration: underline;
}

.cartx-head__back i {
    font-size: 12px;
    margin-right: 4px;
}

/* ---------- Items card ---------- */
/* Bordered table: Product | Quantity | Total */
.cartx {
    --cartx-border: #dbe3df;
    --cartx-col-qty: 160px;
    --cartx-col-total: 150px;
}

.cartx-card {
    background: #fff;
    border: 1px solid var(--cartx-border);
    border-radius: var(--cartx-radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.cartx-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--cartx-col-qty) var(--cartx-col-total);
    background: var(--cartx-brand-soft);
    border-bottom: 1px solid var(--cartx-border);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cartx-brand);
}

.cartx-cols span {
    padding: 14px 20px;
}

.cartx-cols span + span {
    border-left: 1px solid var(--cartx-border);
}

.cartx-cols span:nth-child(2) {
    text-align: center;
}

.cartx-cols span:nth-child(3) {
    text-align: right;
}

/* One cart line: image | info | qty | total */
.cartx-line {
    display: grid;
    /* first two columns line up with the "Product" header cell */
    grid-template-columns: 124px minmax(0, 1fr) var(--cartx-col-qty) var(--cartx-col-total);
    grid-template-areas: "img info qty total";
    align-items: stretch;
    border-bottom: 1px solid var(--cartx-border);
    transition: background-color .15s ease;
}

.cartx-line:hover {
    background: #fbfcfb;
}

.cartx-line:last-child {
    border-bottom: 0;
}

.cartx-line__img {
    grid-area: img;
    align-self: center;
    display: block;
    width: 104px;
    margin: 18px 0 18px 20px;
    border: 1px solid var(--cartx-line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

/* Square box, any image ratio fits without stretching or cropping */
.cartx-line__img img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    padding: 6px;
    transition: transform .25s ease;
}

.cartx-line__img:hover img {
    transform: scale(1.04);
}

.cartx-line__info {
    grid-area: info;
    align-self: center;
    min-width: 0;
    padding: 18px 20px;
}

.cartx-line__name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--cartx-text);
    text-decoration: none;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.cartx-line__name:hover {
    color: var(--cartx-brand);
}

.cartx-line__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.cartx-line__chips span {
    font-size: 12px;
    line-height: 1;
    padding: 5px 9px;
    color: #4b5563;
    background: var(--cartx-bg);
    border: 1px solid var(--cartx-line);
    border-radius: 999px;
}

.cartx-line__unit {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
}

.cartx-line__unit-label {
    color: var(--cartx-muted);
}

.cartx-line__unit-price {
    font-weight: 600;
    color: var(--cartx-text);
}

.cartx-line__unit-old {
    color: #9ca3af;
}

.cartx-line__offer {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 500;
    color: #92400e;
    background: #fef3c7;
    border-radius: 6px;
}

/* Quantity stepper */
.cartx-line__qty {
    grid-area: qty;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 12px;
    border-left: 1px solid var(--cartx-border);
}

.cartx .cartx-stepper {
    display: inline-flex;
    align-items: center;
    height: 40px;
    border: 1px solid #d5dcd8;
    border-radius: 999px;
    background: #fff;
    overflow: hidden;
}

.cartx .cartx-stepper .qty-btn {
    width: 40px;
    height: 100%;
    border: 0;
    background: transparent !important;
    color: var(--cartx-text);
    font-size: 12px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.cartx .cartx-stepper .qty-btn:hover {
    background: var(--cartx-brand-soft) !important;
    color: var(--cartx-brand);
}

.cartx .cartx-stepper .qty-input {
    width: 42px;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--cartx-text);
    background: transparent;
    outline: none;
    cursor: default;
}

/* Line total + remove */
.cartx-line__total {
    grid-area: total;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    padding: 18px 20px;
    text-align: right;
    border-left: 1px solid var(--cartx-border);
}

.cartx-line__total strong {
    font-size: 17px;
    font-weight: 700;
    color: var(--cartx-text);
    white-space: nowrap;
}

.cartx-remove {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border: 0;
    background: none;
    font-size: 13px;
    color: var(--cartx-muted);
    cursor: pointer;
    transition: color .15s ease;
}

.cartx-remove:hover {
    color: #dc2626;
}

.cartx-remove i {
    font-size: 12px;
}

/* ---------- Sidebar ---------- */
/* Both columns stick; the shorter one stays in view while the taller one scrolls.
   --cartx-sticky-top is set per column in index.blade.php so tall columns stay reachable. */
@media (min-width: 992px) {
    .cartx-sticky {
        position: sticky;
        top: var(--cartx-sticky-top, 128px);
        align-self: flex-start;
    }
}

.cartx-panel {
    background: #fff;
    border: 1px solid var(--cartx-line);
    border-radius: var(--cartx-radius);
    padding: 20px;
    margin-bottom: 16px;
}

.cartx-panel h5:not(.modal *) {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px !important;
    color: var(--cartx-text);
}

.cartx-panel h5:not(.modal *) small {
    font-size: 12px;
    font-weight: 400;
    color: var(--cartx-muted);
}

.cartx-panel .form-control:not(.modal *) {
    height: 44px;
    font-size: 14px;
    border: 1px solid #d5dcd8;
    border-radius: 10px;
    box-shadow: none;
}

.cartx-panel .form-control:not(.modal *):focus {
    border-color: var(--cartx-brand);
    box-shadow: 0 0 0 3px rgba(2, 105, 65, .12);
}

.cartx-panel .input-group:not(.modal *) {
    margin-bottom: 0 !important;
}

.cartx-panel .input-group:not(.modal *) .form-control {
    border-radius: 10px 0 0 10px;
}

.cartx-panel .input-group:not(.modal *) .btn-buy {
    width: auto;
    min-width: 96px;
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 0 10px 10px 0;
}

/* Available vouchers as selectable cards */
.cartx-panel #couponList {
    margin-top: 4px;
}

.cartx-panel #couponList label {
    position: relative;
    display: block;
    padding: 12px 14px 12px 40px !important;
    margin-bottom: 8px !important;
    border: 1px dashed #b7c9c0 !important;
    border-radius: 10px !important;
    background: var(--cartx-bg);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.cartx-panel #couponList label:hover,
.cartx-panel #couponList label:has(input:checked) {
    border-color: var(--cartx-brand) !important;
    background: var(--cartx-brand-soft);
}

.cartx-panel #couponList input[type="radio"] {
    position: absolute;
    left: 14px;
    top: 15px;
    accent-color: var(--cartx-brand);
}

.cartx-panel #couponList strong {
    font-size: 14px;
    letter-spacing: .04em;
    color: var(--cartx-brand);
}

.cartx-panel #couponList p {
    margin: 2px 0 0 !important;
    font-size: 13px;
    color: var(--cartx-muted);
}

.cartx-panel > .fw-semibold {
    font-size: 13px;
    color: var(--cartx-muted);
    margin-top: 14px;
}

.cartx-panel > small.text-muted {
    margin-bottom: 0 !important;
    margin-top: 6px;
    font-size: 12px;
}

/* Points / wallet */
.cartx-panel--wallet .card {
    border: 0 !important;
    margin: 0 !important;
}

.cartx-panel--wallet .card-header {
    padding: 0 0 14px;
    background: transparent !important;
    border: 0;
    color: var(--cartx-text) !important;
}

.cartx-panel--wallet .card-header .badge {
    color: var(--cartx-brand) !important;
    background: var(--cartx-brand-soft) !important;
    font-weight: 500;
}

.cartx-panel--wallet .card-body {
    padding: 0;
}

/* Order summary */
.cartx-summary {
    background: var(--cartx-bg);
}

.cartx-summary .d-flex {
    font-size: 14px;
    color: #374151;
}

.cartx-summary .d-flex strong {
    font-weight: 600;
    color: var(--cartx-text);
}

.cartx-summary hr {
    margin: 14px 0;
    border-color: #cfd8d3;
    opacity: 1;
}

.cartx-summary hr + .d-flex span {
    font-size: 16px;
    font-weight: 600;
    color: var(--cartx-text);
}

.cartx-summary hr + .d-flex h5 {
    margin: 0 !important;
    font-size: 22px;
    font-weight: 700;
    color: var(--cartx-brand);
}

.cartx .cartx-checkout {
    display: block;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    background-color: var(--cartx-brand);
    box-shadow: 0 6px 16px rgba(2, 105, 65, .22);
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
}

.cartx .cartx-checkout:hover,
.cartx .cartx-checkout:focus-visible {
    color: #fff;
    background-color: #014d30;
    border-color: #014d30;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(2, 105, 65, .26);
}

/* ---------- Empty cart ---------- */
.cartx .cartempty .card-body {
    padding: 48px 16px;
}

/* ---------- Mobile ---------- */
@media (max-width: 767.98px) {
    .cartx-head {
        margin-bottom: 16px;
    }

    .cartx-head__title {
        font-size: 22px;
    }

    .cartx-card {
        padding: 0 14px;
    }

    .cartx-line:hover {
        background: transparent;
    }

    .cartx-line__img,
    .cartx-line__info,
    .cartx-line__qty,
    .cartx-line__total {
        margin: 0;
        padding: 0;
        border-left: 0;
    }

    .cartx-cols {
        display: none;
    }

    /* Image + info on top, stepper and total underneath */
    .cartx-line {
        grid-template-columns: 84px minmax(0, 1fr) auto;
        grid-template-areas:
            "img info info"
            "qty qty total";
        gap: 12px 14px;
        align-items: start;
        padding: 16px 0;
    }

    .cartx-line:last-child {
        border-bottom: 0;
    }

    .cartx-line__img {
        width: 84px;
    }

    .cartx-line__name {
        font-size: 15px;
        margin-bottom: 6px;
    }

    .cartx-line__qty {
        justify-content: flex-start;
        align-self: center;
    }

    .cartx-line__total {
        flex-direction: row-reverse;
        align-items: center;
        gap: 14px;
        align-self: center;
    }

    .cartx-remove span {
        display: none;
    }

    .cartx-remove {
        width: 36px;
        height: 36px;
        justify-content: center;
        border-radius: 50%;
        background: #fef2f2;
        color: #dc2626;
    }

    .cartx-panel {
        padding: 16px;
    }
}
