/* ==========================================================================
   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;
    height: auto;
    border-radius: 0px;
    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 ---------- */
.cart-empty {
    display: flex;
    flex-direction: column;
    gap: 36px;
    margin: 8px 0 12px;
}

/* Hero */
.cart-empty__hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: center;
    gap: 24px;
    padding: 48px 56px;
    border-radius: 24px;
    background:
        radial-gradient(120% 140% at 100% 0%, #d7ece2 0%, transparent 55%),
        linear-gradient(135deg, var(--cartx-brand-soft) 0%, #f7fbf9 60%, #fff 100%);
    border: 1px solid var(--cartx-line);
    overflow: hidden;
}

.cart-empty__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cartx-brand);
    background: #fff;
    border: 1px solid #cfe5da;
    border-radius: 999px;
}

.cart-empty__title {
    margin: 18px 0 12px;
    font-size: 38px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.01em;
    color: var(--cartx-text);
    text-wrap: balance;
}

.cart-empty__text {
    max-width: 480px;
    margin: 0 0 28px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--cartx-muted);
}

.cart-empty__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.cart-empty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 26px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
}

.cart-empty__btn--primary {
    color: #fff;
    background: var(--cartx-brand);
    box-shadow: 0 8px 20px rgba(2, 105, 65, .22);
}

.cart-empty__btn--primary:hover,
.cart-empty__btn--primary:focus-visible {
    color: #fff;
    background: #014d30;
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(2, 105, 65, .3);
}

.cart-empty__btn--primary i {
    transition: transform .15s ease;
}

.cart-empty__btn--primary:hover i {
    transform: translateX(3px);
}

.cart-empty__btn--ghost {
    color: var(--cartx-brand);
    background: #fff;
    border: 1px solid #cfe5da;
}

.cart-empty__btn--ghost:hover,
.cart-empty__btn--ghost:focus-visible {
    color: var(--cartx-brand);
    border-color: var(--cartx-brand);
}

.cart-empty__wishlist {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--cartx-text);
    background: rgba(255, 255, 255, .8);
    border: 1px dashed #e9b8c4;
    border-radius: 12px;
    text-decoration: none;
}

.cart-empty__wishlist>i {
    color: #d63a5f;
}

.cart-empty__wishlist-cta {
    font-weight: 600;
    color: var(--cartx-brand);
    white-space: nowrap;
}

.cart-empty__wishlist:hover {
    color: var(--cartx-text);
    border-style: solid;
}

/* Illustration */
.cart-empty__art {
    display: flex;
    justify-content: center;
}

.cart-empty__art svg {
    width: 100%;
    max-width: 360px;
    height: auto;
}

.cart-empty__art .ce-halo {
    fill: #fff;
    opacity: .7;
}

.cart-empty__art .ce-halo--inner {
    fill: #e3f1ea;
    opacity: 1;
}

.cart-empty__art .ce-line,
.cart-empty__art .ce-basket,
.cart-empty__art .ce-grid,
.cart-empty__art .ce-wheel,
.cart-empty__art .ce-stem {
    fill: none;
    stroke: var(--cartx-brand);
    stroke-width: 7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cart-empty__art .ce-basket {
    fill: #fff;
}

.cart-empty__art .ce-grid {
    stroke-width: 3;
    opacity: .35;
}

.cart-empty__art .ce-wheel {
    fill: #fff;
}

.cart-empty__art .ce-stem {
    stroke: #2f8a5c;
    stroke-width: 5;
}

.cart-empty__art .ce-leaf {
    fill: #3fa16f;
}

.cart-empty__art .ce-leaf--light {
    fill: #7cc79c;
}

.cart-empty__art .ce-spark {
    fill: #f2b84b;
}

.cart-empty__art .ce-dot {
    fill: #7cc79c;
}

.cart-empty__art .ce-sprout {
    transform-origin: 170px 128px;
    animation: ce-sway 4s ease-in-out infinite;
}

.cart-empty__art .ce-spark {
    transform-box: fill-box;
    transform-origin: center;
    animation: ce-twinkle 2.6s ease-in-out infinite;
}

.cart-empty__art .ce-spark--2 {
    animation-delay: 1.3s;
}

@keyframes ce-sway {

    0%,
    100% {
        transform: rotate(-3deg);
    }

    50% {
        transform: rotate(3deg);
    }
}

@keyframes ce-twinkle {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(.6);
        opacity: .5;
    }
}

@media (prefers-reduced-motion: reduce) {

    .cart-empty__art .ce-sprout,
    .cart-empty__art .ce-spark {
        animation: none;
    }
}

/* Section blocks */
.cart-empty__block-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.cart-empty__block-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--cartx-text);
}

.cart-empty__more {
    font-size: 14px;
    font-weight: 600;
    color: var(--cartx-brand);
    text-decoration: none;
    white-space: nowrap;
}

.cart-empty__more:hover {
    text-decoration: underline;
}

/* Category tiles */
.cart-empty__cats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.cart-empty__cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px 16px;
    text-align: center;
    color: var(--cartx-text);
    background: #fff;
    border: 1px solid var(--cartx-line);
    border-radius: var(--cartx-radius);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.cart-empty__cat:hover,
.cart-empty__cat:focus-visible {
    color: var(--cartx-brand);
    border-color: #cfe5da;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(16, 24, 20, .07);
}

.cart-empty__cat-img {
    width: 84px;
    height: 84px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: var(--cartx-bg);
    border-radius: 50%;
}

.cart-empty__cat-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-empty__cat-initial {
    font-size: 30px;
    font-weight: 700;
    color: var(--cartx-brand);
}

.cart-empty__cat-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

@media (max-width: 991.98px) {
    .cart-empty__hero {
        grid-template-columns: 1fr;
        padding: 36px 28px;
        text-align: center;
    }

    .cart-empty__text {
        margin-left: auto;
        margin-right: auto;
    }

    .cart-empty__actions {
        justify-content: center;
    }

    .cart-empty__art {
        order: -1;
    }

    .cart-empty__art svg {
        max-width: 240px;
    }
}

@media (max-width: 575.98px) {
    .cart-empty {
        gap: 28px;
    }

    .cart-empty__hero {
        padding: 28px 18px;
        border-radius: 18px;
    }

    .cart-empty__title {
        font-size: 28px;
    }

    .cart-empty__text {
        font-size: 15px;
    }

    .cart-empty__btn {
        width: 100%;
    }

    .cart-empty__cats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .cart-empty__cat {
        padding: 12px 6px;
    }

    .cart-empty__cat-img {
        width: 60px;
        height: 60px;
    }

    .cart-empty__cat-name {
        font-size: 12px;
    }

    .cart-empty__block-title {
        font-size: 19px;
    }
}

/* ---------- 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;
    }
}

/* Instant feedback while a cart change is saved (cart-lines.blade.php).
   The cart HTML is re-rendered from the server right after, which clears these states. */
.cartx-line.is-updating {
    opacity: .55;
    pointer-events: none;
    transition: opacity .15s ease;
}

.cartx-line.is-removing {
    pointer-events: none;
    animation: cartx-line-out .28s ease forwards;
}

@keyframes cartx-line-out {
    to { opacity: 0; transform: translateX(-12px); }
}

.cartx-line.is-removing.is-gone { display: none; }
