/* ============================================================
   Keranjang — mobile (app bar + bottom nav) | desktop (grid)
   Breakpoint desktop: 992px
   ============================================================ */

:root {
    --cart-navy: #0f2744;
    --cart-orange: #f97316;
    --cart-orange-dark: #ea580c;
    --cart-yellow-bg: #fffbeb;
    --cart-yellow-border: #fdba74;
    --cart-text: #0f172a;
    --cart-muted: #64748b;
    --cart-border: #e2e8f0;
    --cart-radius: 12px;
    --cart-header-h: 56px;
    --cart-sticky-h: calc(168px + env(safe-area-inset-bottom, 0px));
    --cart-desk-top: 5.5rem;
    --font: "Plus Jakarta Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

/* ----- Mobile: sembunyikan navbar situs, pakai app bar keranjang ----- */
@media (max-width: 991px) {
    body.cart-page #navbar {
        display: none !important;
    }

    html {
        background: #eef2f7;
    }

    body.cart-page {
        margin: 0;
        font-family: var(--font);
        font-size: 15px;
        line-height: 1.45;
        color: var(--cart-text);
        background: #eef2f7;
        min-height: 100dvh;
        padding-bottom: var(--cart-sticky-h);
    }
}

/* ----- Desktop: navbar situs, tanpa app bar / bottom tab ----- */
@media (min-width: 992px) {
    body.cart-page {
        margin: 0;
        font-family: var(--font);
        font-size: 15px;
        line-height: 1.45;
        color: var(--cart-text);
        background: #f8f9fa;
        min-height: 100dvh;
        padding-bottom: 0;
    }

    html {
        background: #f8f9fa;
    }
}

/* ----- Mobile app bar ----- */
.cart-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--cart-navy);
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

@media (min-width: 992px) {
    .cart-header {
        display: none;
    }
}

.cart-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--cart-header-h);
    max-width: 680px;
    margin: 0 auto;
    padding: 0 14px;
}

.cart-header__back {
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: -8px;
    border-radius: 10px;
    text-decoration: none;
}

.cart-header__back:focus-visible {
    outline: 2px solid var(--cart-orange);
    outline-offset: 2px;
}

.cart-header__title {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    letter-spacing: 0.02em;
}

.cart-header__cart-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: -4px;
}

.cart-header__cart-icon {
    color: #fff;
}

.cart-header__badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: var(--cart-orange);
    border-radius: 999px;
}

/* ----- Main ----- */
.cart-main {
    padding-left: max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
}

@media (max-width: 991px) {
    .cart-main {
        padding-top: calc(var(--cart-header-h) + env(safe-area-inset-top, 0px));
    }

    .cart-main__container {
        background: #fff;
        border-radius: 0 0 16px 16px;
        padding-top: 16px;
        padding-bottom: 8px;
        box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
    }
}

@media (min-width: 992px) {
    .cart-main {
        padding-top: 1.25rem;
        padding-bottom: 2.5rem;
    }
}

/* Breadcrumb — desktop only */
.cart-breadcrumb {
    display: none;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

@media (min-width: 992px) {
    .cart-breadcrumb {
        display: flex;
    }
}

.cart-breadcrumb a {
    color: #6b7280;
    text-decoration: none;
}

.cart-breadcrumb a:hover {
    color: #e87722;
}

.cart-breadcrumb__sep {
    opacity: 0.55;
    user-select: none;
}

.cart-breadcrumb__current {
    color: #1a1a1a;
    font-weight: 600;
}

/* ----- Layout grid desktop ----- */
.cart-layout {
    display: block;
}

@media (min-width: 992px) {
    .cart-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) min(380px, 34%);
        gap: 2rem;
        align-items: start;
    }
}

.cart-layout__primary {
    min-width: 0;
}

.cart-layout__aside {
    min-width: 0;
}

@media (min-width: 992px) {
    .cart-layout__aside {
        position: sticky;
        top: var(--cart-desk-top);
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
}

/* Intro */
.cart-intro {
    margin-bottom: 16px;
}

@media (min-width: 992px) {
    .cart-intro {
        margin-bottom: 1.25rem;
    }

    .cart-intro__title {
        font-size: 1.75rem;
    }

    .cart-intro__sub {
        font-size: 0.9375rem;
    }
}

.cart-intro__title {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.cart-intro__sub {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--cart-muted);
}

/* ----- Product cards ----- */
.cart-items {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 992px) {
    .cart-items {
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
}

.cart-card {
    border: 1px solid var(--cart-border);
    border-radius: var(--cart-radius);
    padding: 12px;
    background: #fff;
}

@media (min-width: 992px) {
    .cart-card {
        padding: 1rem 1.25rem;
        border-radius: 14px;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
}

.cart-card__row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cart-card__row--qty {
    margin-top: 12px;
    align-items: center;
    justify-content: space-between;
}

@media (min-width: 992px) {
    .cart-card__row--qty {
        margin-top: 0;
        padding-top: 0.75rem;
        border-top: 1px solid #f1f5f9;
    }
}

.cart-card__img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: #f1f5f9;
}

@media (min-width: 480px) {
    .cart-card__img {
        width: 88px;
        height: 88px;
    }
}

@media (min-width: 992px) {
    .cart-card__img {
        width: 96px;
        height: 96px;
        border-radius: 12px;
    }
}

.cart-card__info {
    flex: 1;
    min-width: 0;
}

.cart-card__name {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 0.9375rem;
}

@media (min-width: 992px) {
    .cart-card__name {
        font-size: 1.05rem;
    }
}

.cart-card__unit {
    margin: 0;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--cart-orange);
}

.cart-qty {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--cart-border);
}

.cart-qty__btn {
    width: 40px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 1.125rem;
    color: var(--cart-muted);
    cursor: pointer;
    transition: background .15s;
}
.cart-qty__btn:hover { background: #e2e8f0; }
.cart-qty__btn:active { background: #cbd5e1; }

.cart-qty__val {
    min-width: 36px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9375rem;
}

.cart-card__line-total {
    font-weight: 600;
    color: var(--cart-muted);
    font-size: 0.9375rem;
}

.cart-card__remove-form {
    margin-left: auto;
    flex-shrink: 0;
}
.cart-card__remove {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.cart-card__remove:hover {
    background: #fef2f2;
    color: #dc2626;
}

.cart-qty-form { display: contents; }

@media (min-width: 992px) {
    .cart-card__line-total {
        font-size: 1rem;
        font-weight: 700;
    }
}

/* ----- Shipping banner ----- */
.cart-ship {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 14px 14px 12px;
    margin-bottom: 16px;
    background: var(--cart-yellow-bg);
    border: 1px solid var(--cart-yellow-border);
    border-radius: var(--cart-radius);
}

@media (min-width: 992px) {
    .cart-ship {
        margin-bottom: 0;
        border-radius: 14px;
    }
}

.cart-ship__icon {
    flex-shrink: 0;
    color: var(--cart-orange-dark);
    display: flex;
    margin-top: 2px;
}

.cart-ship__title {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--cart-orange-dark);
}

.cart-ship__text {
    margin: 0;
    font-size: 0.8125rem;
    color: #9a3412;
    line-height: 1.5;
}

/* ----- Summary (sidebar desktop) ----- */
.cart-summary {
    border: 1px solid var(--cart-border);
    border-radius: var(--cart-radius);
    padding: 16px;
    margin-bottom: 0;
    background: #fff;
}

@media (max-width: 991px) {
    .cart-summary {
        margin-bottom: 16px;
    }
}

@media (min-width: 992px) {
    .cart-summary {
        border-radius: 14px;
        padding: 1.25rem;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    }
}

.cart-summary__title {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 800;
}

.cart-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9375rem;
    color: var(--cart-muted);
}

.cart-summary__row span:first-child {
    color: var(--cart-text);
}

.cart-summary__rule {
    border: none;
    border-top: 1px solid var(--cart-border);
    margin: 14px 0;
}

.cart-summary__row--total {
    font-weight: 800;
    color: var(--cart-text);
}

.cart-summary__row--total span:last-child {
    color: var(--cart-orange);
    font-size: 1.05rem;
}

/* Desktop-only note under checkout */
.cart-desk-note {
    display: none;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--cart-muted);
    line-height: 1.45;
    text-align: center;
}

@media (min-width: 992px) {
    .cart-desk-note {
        display: block;
    }
}

/* ----- Checkout buttons ----- */
.cart-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--cart-orange);
    color: #fff;
    font-weight: 700;
    font-size: 0.9375rem;
    text-decoration: none;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
    box-sizing: border-box;
}

.cart-checkout:hover {
    background: var(--cart-orange-dark);
    color: #fff;
}

.cart-checkout:focus-visible {
    outline: 2px solid var(--cart-navy);
    outline-offset: 2px;
}

.cart-checkout--desktop {
    display: none;
    width: 100%;
}

@media (min-width: 992px) {
    .cart-checkout--desktop {
        display: flex;
    }
}

.cart-checkout--mobile {
    display: flex;
}

@media (min-width: 992px) {
    .cart-checkout--mobile {
        display: none;
    }
}

/* ----- Mini footer strip (mobile) ----- */
.cart-foot {
    background: var(--cart-navy);
    color: rgba(255, 255, 255, 0.92);
    border-radius: var(--cart-radius);
    padding: 18px 16px;
    text-align: center;
    margin-top: 8px;
}

@media (min-width: 992px) {
    .cart-foot {
        display: none;
    }
}

.cart-foot__brand {
    margin: 0 0 6px;
    font-weight: 800;
    font-size: 1rem;
}

.cart-foot__tag {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.75);
    max-width: 28ch;
    margin-inline: auto;
}

/* ----- Sticky mobile bottom ----- */
.cart-sticky {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-top: 8px;
    box-shadow: 0 -8px 28px rgba(15, 39, 68, 0.1);
    border-top: 1px solid var(--cart-border);
}

@media (min-width: 992px) {
    .cart-sticky {
        display: none;
    }
}

.cart-sticky .cart-checkout--mobile {
    margin: 0 16px 10px;
    max-width: 640px;
    width: calc(100% - 32px);
    align-self: center;
}

.cart-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    flex: 0 0 auto;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 8px 8px 10px;
    border-top: 1px solid var(--cart-border);
    background: #fff;
    min-height: 56px;
}

.cart-bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--cart-muted);
    text-decoration: none;
    border-radius: 10px;
    min-width: 0;
}

.cart-bottom-nav__item svg {
    flex-shrink: 0;
}

.cart-bottom-nav__item--active {
    color: var(--cart-orange);
}

.cart-bottom-nav__item--active svg {
    stroke: var(--cart-orange);
}

.cart-bottom-nav__item:focus-visible {
    outline: 2px solid var(--cart-orange);
    outline-offset: 2px;
}

/* ----- Navbar: highlight ikon keranjang (desktop) ----- */
@media (min-width: 992px) {
    body.cart-page .navbar__icon-btn.active {
        color: #e87722;
        background: #fff4ee;
    }
}
