/* =====================================================
   YKB Clothing — Cart
   Design language: streetwear / Gen Z drop.
   Same tokens as wishlist.css & checkout.css, scoped only
   to cart-specific selectors — the shared header/nav in
   styles.css is left untouched.
   ----------------------------------------------------- */

:root{
    --teal:      #088178;
    --teal-dark: #066b63;
    --teal-tint: #e6f6f4;
    --ink:       #0e1414;
    --ink-70:    rgba(14,20,20,.68);
    --stone:     #9aa3a2;
    --line:      rgba(8,129,120,.22);
    --white:     #ffffff;
    --pop:       #ff5a4e;   /* street-style accent for alerts/badges only */
    --pop-dark:  #d6473d;

    --font-display: "Space Grotesk", sans-serif;
    --font-body: "Inter", sans-serif;
    --font-mono: "Space Mono", monospace;

    --radius-lg: 18px;
    --radius-sm: 10px;
    --shadow-card: 0 14px 30px rgba(8,129,120,.10);
}

/* CART HEADER — bold teal block with organic blob decoration
   (Previously there were two banner rules fighting each other:
   #page-header.cart-header { background-image: bn2.png }  <- ID selector, always won
   .cart-header { background-image: b19.jpg }               <- class selector, never showed
   Both are gone now — the header is a flat teal panel with CSS blobs instead
   of a photo, matching the hero pattern used on index.html.) */

#page-header.cart-header{
    background: var(--teal);
    width: 100%;
    min-height: 34vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    position: relative;
    overflow: hidden;
    padding: 40px 20px;
}

.cart-header::before{
    content: "";
    position: absolute;
    width: 340px;
    height: 340px;
    top: -140px;
    left: -100px;
    background: rgba(255,255,255,.10);
    border-radius: 62% 38% 55% 45% / 45% 60% 40% 55%;
    z-index: 1;
}

.cart-header::after{
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    bottom: -120px;
    right: -80px;
    background: var(--teal-tint);
    opacity: .16;
    border-radius: 40% 60% 55% 45% / 55% 45% 60% 40%;
    z-index: 1;
}

.cart-header__eyebrow{
    position: relative;
    z-index: 2;
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--teal-tint);
    background: rgba(255,255,255,.14);
    padding: 6px 14px;
    border-radius: 50px;
    margin-bottom: 14px;
}

.cart-header h2,
.cart-header p{
    color: #fff;
    z-index: 2;
    position: relative;
}

.cart-header h2{
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 42px;
    letter-spacing: -.5px;
    margin: 0 0 8px;
}

.cart-header p{
    font-family: var(--font-body);
    font-size: 14px;
    opacity: .92;
}

/* CART TABLE */

#cart{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    min-height: 80px;
}

#cart table{
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1.5px solid var(--line);
}

#cart table img{
    width: 66px;
    height: 66px;
    border-radius: 10px;
    object-fit: cover;
    border: 1.5px solid var(--line);
}

#cart table thead{
    background: var(--teal-tint);
}

#cart table thead td,
#cart table thead th{
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    font-size: 11px;
    padding: 18px 16px;
    color: var(--teal-dark);
}

#cart table tbody tr{
    border-bottom: 1px solid var(--line);
    transition: .3s;
}

#cart table tbody tr:hover{
    background: var(--teal-tint);
}

#cart table tbody tr.row-busy{
    opacity: .55;
}

#cart table tbody td{
    padding: 16px;
    font-size: 14px;
    color: var(--ink-70);
    text-align: center;
    vertical-align: middle;
}

#cart table tbody td:nth-child(3){
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--ink);
    text-align: left;
}

#cart table tbody td:nth-child(5),
#cart table tbody td:nth-child(7){
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink);
}

#cart button{
    border: none;
    background: var(--ink);
    color: #fff;
    padding: 8px 12px;
    border-radius: 50px;
    cursor: pointer;
    transition: .25s;
}

#cart button:hover:not(:disabled){
    background: var(--teal);
}

#cart button:disabled{
    background: var(--stone);
    cursor: not-allowed;
}

/* Loading state, shown while the initial cart fetch is in flight */
.cart-loading{
    display: none;
    text-align: center;
    padding: 40px;
    color: var(--ink-70);
    font-size: 14px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.cart-loading.show{
    display: block;
}

.cart-loading i{
    color: var(--teal);
    margin-right: 8px;
}

/* COUPON + TOTAL */

#cart-add{
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: stretch;
}

#coupon,
#subtotal,
#payment-method{
    flex: 1;
    min-width: 280px;
    background: #fff;
    padding: 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1.5px solid var(--line);
}

#coupon,
#subtotal{
    flex: 1 1 360px;
    padding: 28px;
}

#subtotal{
    max-width: 520px;
    margin-left: auto;
}

.cart-card-kicker{
    display: block;
    color: var(--teal);
    font: 700 10px/1.4 var(--font-mono);
    letter-spacing: 1.8px;
    margin-bottom: 8px;
}

.continue-shopping{
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 22px;
    color: var(--teal-dark);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.continue-shopping:hover{ color: var(--teal); }

.cart-steps{
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    color: rgba(255,255,255,.7);
    font: 600 11px/1 var(--font-body);
}

.cart-steps span{ display: inline-flex; align-items: center; gap: 7px; }
.cart-steps b{ color: rgba(255,255,255,.65); font: 700 10px var(--font-mono); }
.cart-steps .is-active{ color: #fff; }
.cart-steps .is-active b{ color: #9ff5e8; }
.cart-steps > i{ width: 24px; height: 1px; background: rgba(255,255,255,.3); }

#coupon h3,
#subtotal h3{
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    padding-bottom: 15px;
    margin: 0;
    color: var(--ink);
}

#coupon .coupon-unavailable{
    color:var(--stone);
    font-size:14px;
    line-height:1.6;
    margin:0;
}

#coupon input{
    padding: 12px 16px;
    width: 60%;
    margin-right: 10px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    font-family: var(--font-body);
    background: var(--teal-tint);
}

#coupon input:focus{
    outline: none;
    border-color: var(--teal);
    background: #fff;
}

#coupon button,
#subtotal button,
.checkout-btn{
    background: var(--ink);
    color: #fff;
    padding: 12px 18px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-body);
    transition: .25s;
}

#coupon button:hover,
#subtotal button:hover,
.checkout-btn:not(:disabled):hover{
    background: var(--teal);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(8,129,120,.28);
}

#subtotal table{
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 4px;
}

#subtotal table td{
    width: 50%;
    padding: 12px 4px;
    font-size: 14px;
    color: var(--ink-70);
    border-bottom: 1.5px dashed var(--line);
}

#subtotal table tr td:last-child{ text-align: right; font-weight: 700; }

#subtotal table tr:last-child td{
    border-bottom: none;
    border-top: 1.5px solid var(--line);
    padding-top: 16px;
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--ink);
}

#subtotal table tr:last-child td strong{
    font-weight: 700;
}

#subtotal h3{ font-size: 22px; }

/* CHECKOUT BUTTON */

.checkout-btn{
    width: 100%;
    font-size: 15px;
    padding: 16px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.checkout-btn:disabled{
    background: var(--teal-tint);
    color: var(--stone);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border: 1.5px solid var(--line);
}

#payment-method{
    margin-top: 0;
}

#payment-method h3{
    font-family: var(--font-display);
    font-weight: 700;
    margin: 0 0 4px;
    font-size: 18px;
    color: var(--ink);
}

#payment-method .payment-hint{
    font-size: 12px;
    color: var(--stone);
    margin: 0 0 16px;
}

#payment-method label{
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-70);
    cursor: pointer;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .2s ease, background .2s ease;
}

#payment-method label:has(input:checked){
    border-color: var(--teal);
    background: var(--teal-tint);
    color: var(--ink);
}

#payment-method input{
    accent-color: var(--teal);
    margin-right: 2px;
}

/* CART BADGE — sticker-style pop accent, distinct from primary teal */

#cart-count{
    position: absolute;
    top: -8px;
    right: -10px;

    background: var(--pop);
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    font-family: var(--font-mono);

    width: 18px;
    height: 18px;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 4px 10px rgba(255,90,78,.35);
}

/* TOAST STACK
   Mirrors the pattern used on wishlist.html / checkout.html so cart
   messages look and behave the same way across the site. */

.toast-stack{
    position: fixed;
    right: 20px;
    bottom: 24px;
    top: auto;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    z-index: 9999;
}

.toast{
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #fff;
    box-shadow: 0 14px 28px rgba(0,0,0,.22);
    animation: slideIn .3s ease;
    max-width: 300px;
}

.toast.toast--success{ background: var(--teal-dark); }
.toast.toast--error{ background: var(--pop-dark); }

.toast.is-leaving{
    animation: slideOut .25s ease forwards;
}

@keyframes slideIn{
    from{ transform: translateX(100%); opacity: 0; }
    to{ transform: translateX(0); opacity: 1; }
}

@keyframes slideOut{
    from{ transform: translateX(0); opacity: 1; }
    to{ transform: translateX(100%); opacity: 0; }
}

/* EMPTY / GUEST STATE */

#empty-cart-image{
    display: none;
    text-align: center;
    padding: 46px 20px;
    border: 1.5px dashed var(--line);
    border-radius: var(--radius-lg);
    background: var(--teal-tint);
    margin-bottom: 4px;
}

#empty-cart-image.show{
    display: block;
}

#empty-cart-image i{
    font-size: 44px;
    color: var(--teal);
    margin-bottom: 16px;
}

#empty-cart-image h3{
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--ink);
}

#empty-cart-image p{
    color: var(--ink-70);
    font-size: 13px;
    margin-bottom: 20px;
}

#empty-cart-image .normal{
    display: inline-block;
    background: var(--ink);
    color: #fff;
    padding: 11px 26px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    transition: transform .2s ease, background .2s ease;
}

#empty-cart-image .normal:hover{
    background: var(--teal);
    transform: translateY(-2px);
}

.qty-box{
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.qty-box button{
    width: 26px;
    height: 26px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.qty-box span{
    min-width: 20px;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink);
}

.qty-box button:disabled{
    background: var(--stone);
    cursor: not-allowed;
}

.remove-btn{
    background: transparent !important;
    color: var(--pop) !important;
    border: 1.5px solid var(--pop) !important;
}

.remove-btn:hover:not(:disabled){
    background: var(--pop) !important;
    color: #fff !important;
}

.remove-btn:disabled{
    color: var(--stone) !important;
    border-color: var(--line) !important;
    background: transparent !important;
}

/* MOBILE */

@media(max-width: 799px){

    #cart{ overflow-x: visible; }

    #cart table { min-width: 0; table-layout: fixed; }
    #cart table, #cart tbody, #cart tr, #cart td { display: block; width: 100%; }
    #cart table thead { display: none; }
    #cart table tbody { display: grid; gap: 14px; }
    #cart table tr {
        position: relative;
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 8px 14px;
        padding: 16px;
        background: #fff;
        border: 1.5px solid var(--line);
        border-radius: var(--radius-lg);
    }
    #cart table td { min-width: 0; padding: 0; text-align: left; border: 0; }
    #cart table td:nth-child(1) { position: absolute; top: 12px; right: 12px; width: auto; }
    #cart table td:nth-child(2) { grid-column: 1; grid-row: 1 / span 5; }
    #cart table td:nth-child(3) { grid-column: 2; padding-right: 40px; font-size: 15px; }
    #cart table td:nth-child(4), #cart table td:nth-child(5), #cart table td:nth-child(6), #cart table td:nth-child(7) { grid-column: 2; display: flex; align-items: center; gap: 8px; }
    #cart table td:nth-child(4)::before, #cart table td:nth-child(5)::before, #cart table td:nth-child(6)::before, #cart table td:nth-child(7)::before { content: attr(data-label); color: var(--stone); font-size: 12px; min-width: 54px; }
    #cart table td.size-cell.is-empty { display: none; }

    #cart table img{
        width: 72px;
        height: 72px;
    }

    #cart table td{
        padding: 12px;
        font-size: 13px;
    }

    .cart-header h2{
        font-size: 28px;
    }

    .cart-header::before,
    .cart-header::after{
        opacity: .12;
    }

    #cart-add{
        flex-direction: column;
    }

    #coupon,
    #subtotal{
        width: 100%;
        max-width: none;
        margin-left: 0;
    }

    #coupon input{
        width: 100%;
        margin-bottom: 10px;
    }

    #coupon button{
        width: 100%;
    }

    .toast-stack{
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast{
        max-width: none;
    }
}

/* Cart dark mode: preserve clear contrast across the full summary and table. */
.dark-mode #cart table,
.dark-mode #cart table tbody tr,
.dark-mode #coupon,
.dark-mode #subtotal,
.dark-mode #payment-method{
    background: #171f21;
    color: #f7fbfc;
    border-color: rgba(112, 226, 211, .2);
}

.dark-mode #cart table thead,
.dark-mode #cart table thead th,
.dark-mode #cart table thead td{
    background: #223033;
    color: #fff;
}

.dark-mode #cart table tbody tr:hover{ background: #202c2e; }
.dark-mode #cart table td::before{ color:#d5e1e2; }
.dark-mode #cart table tbody td,
.dark-mode #cart table tbody td:nth-child(3),
.dark-mode #cart table tbody td:nth-child(5),
.dark-mode #cart table tbody td:nth-child(7),
.dark-mode .qty-box span,
.dark-mode #subtotal h3,
.dark-mode #subtotal table td,
.dark-mode #subtotal table tr:last-child td,
.dark-mode #payment-method h3,
.dark-mode #payment-method label{ color: #fff; }

.dark-mode .qty-box button{
    background: #314144;
    color: #fff;
    border: 1px solid rgba(255,255,255,.22);
}

.dark-mode #subtotal table td{ border-color: rgba(255,255,255,.15); }
.dark-mode #subtotal table tr:last-child td{ border-top-color: rgba(255,255,255,.28); }
.dark-mode #coupon h3{ color:#f7fbfc; }
.dark-mode #coupon .cart-card-kicker{ color:#72e0d1; }
.dark-mode #coupon .coupon-unavailable,
.dark-mode .payment-hint{ color: #bdcacc; }
.dark-mode #coupon .continue-shopping{ color: #72e0d1; }
.dark-mode #coupon .continue-shopping:hover{ color:#a5f3e8; }
.dark-mode #empty-cart-image{ background: #202c2e; }
.dark-mode #empty-cart-image h3,
.dark-mode #empty-cart-image p{ color: #fff; }

@media(max-width: 480px){
    .cart-steps{ gap: 7px; font-size: 10px; }
    .cart-steps > i{ width: 12px; }
    #coupon, #subtotal{ padding: 22px; }
}
