/* ==========================================================
   CHAKA PLANTS - CART STYLES
========================================================== */

/* ---------- Shop card button ---------- */
.add-to-cart-btn {
    border-radius: 8px;
    font-size: 12px;
    font-weight: 750;
    padding: 8px 10px;
}

/* ---------- Navbar badge ---------- */
.js-cart-count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #198754;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    display: inline-block;
}

/* ---------- Quantity stepper ---------- */
.cp-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #dce5df;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
}

.cp-qty button {
    width: 34px;
    height: 38px;
    border: 0;
    background: #f3f7f4;
    color: #198754;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.cp-qty button:hover { background: #e3f2e9; }

.cp-qty input {
    width: 52px;
    height: 38px;
    border: 0;
    text-align: center;
    font-weight: 700;
    -moz-appearance: textfield;
}

.cp-qty input::-webkit-outer-spin-button,
.cp-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cp-qty input:focus { outline: none; }

/* ---------- Modal ---------- */
body.cp-modal-open { overflow: hidden; }

.cp-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 30, 20, .55);
    backdrop-filter: blur(2px);
}

.cp-modal {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 22px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    animation: cpPop .18s ease-out;
}

@keyframes cpPop {
    from { transform: translateY(12px) scale(.97); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.cp-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f1f4f2;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.cp-loading { padding: 40px 0; text-align: center; color: #7b857f; }

.cp-product { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; padding-right: 30px; }
.cp-product img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: #edf2ee; }
.cp-product h5 { margin: 0 0 3px; color: #183c2a; font-weight: 800; font-size: 17px; }
.cp-sci { color: #7c8780; font-size: 12px; font-style: italic; }

.cp-label {
    margin: 14px 0 7px;
    color: #59645d;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.cp-sizes { display: grid; gap: 8px; }
.cp-size { margin: 0; cursor: pointer; }
.cp-size input { position: absolute; opacity: 0; pointer-events: none; }

.cp-size-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 10px;
    padding: 10px 12px;
    border: 1.5px solid #dce5df;
    border-radius: 10px;
    transition: border-color .15s, background .15s;
}

.cp-size-name { font-weight: 800; color: #183c2a; text-transform: capitalize; }
.cp-size-price { font-weight: 800; color: #198754; text-align: right; }
.cp-size-stock { grid-column: 1 / -1; font-size: 11px; color: #89928c; }

.cp-size input:checked + .cp-size-box { border-color: #198754; background: #f0faf4; }
.cp-size input:focus-visible + .cp-size-box { outline: 2px solid #198754; outline-offset: 2px; }

.cp-submit { margin-top: 20px; height: 44px; font-weight: 750; }

/* ---------- Toast ---------- */
#cpToastWrap {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 32px);
}

.cp-toast {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 16px;
    border-radius: 11px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    animation: cpPop .2s ease-out;
    transition: opacity .4s;
}

.cp-toast a { color: #fff; text-decoration: underline; margin-left: 6px; white-space: nowrap; }
.cp-toast-ok { background: #198754; }
.cp-toast-error { background: #b02a37; }
.cp-toast-hide { opacity: 0; }

/* ---------- Cart / checkout pages ---------- */
.cart-page { background: #f6f8f6; padding: 40px 0 70px; min-height: 70vh; }
.cart-page .container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.cart-title { color: #183c2a; font-size: 28px; font-weight: 800; margin-bottom: 24px; }

.cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 26px;
    align-items: start;
}

.cart-items, .checkout-form, .cart-summary {
    background: #fff;
    border: 1px solid #e5ebe7;
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .045);
}

.cart-items { padding: 8px 18px 18px; }
.checkout-form { padding: 22px; }
.checkout-form h5, .cart-summary h5 { color: #183c2a; font-weight: 800; margin-bottom: 16px; }
.cart-summary { padding: 20px; position: sticky; top: 20px; }

.cart-line {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) auto 110px 34px;
    gap: 14px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #edf1ee;
}

.cart-line.is-unavailable { opacity: .65; background: #fff8f8; }
.cart-line-img { width: 80px; height: 80px; object-fit: cover; border-radius: 12px; background: #edf2ee; }
.cart-line-name { display: block; color: #183c2a; font-weight: 800; text-decoration: none; }
.cart-line-name:hover { color: #198754; }
.cart-line-sci { color: #7c8780; font-size: 11px; font-style: italic; }
.cart-line-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

.cart-size-pill {
    padding: 3px 9px;
    border-radius: 20px;
    background: #e8f6ee;
    color: #157347;
    font-size: 11px;
    font-weight: 750;
    text-transform: capitalize;
}

.cart-line-warning { margin-top: 6px; color: #b02a37; font-size: 12px; font-weight: 600; }
.cart-line-total { text-align: right; font-weight: 800; color: #198754; }

.cart-remove {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #b02a37;
    cursor: pointer;
}

.cart-remove:hover { background: #fdeaea; }
.cart-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

.cart-summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; }
.cart-summary-total { margin-top: 6px; padding-top: 14px; border-top: 1px solid #edf1ee; font-size: 17px; font-weight: 800; color: #183c2a; }

.cart-empty {
    max-width: 520px;
    margin: 30px auto;
    padding: 60px 25px;
    text-align: center;
    background: #fff;
    border: 1px solid #e5ebe7;
    border-radius: 16px;
}

.cart-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eaf6ef;
    color: #198754;
    font-size: 30px;
}

.cart-empty h4 { color: #183c2a; font-weight: 800; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .cart-layout { grid-template-columns: 1fr; }
    .cart-summary { position: static; }
}

@media (max-width: 600px) {
    .cart-line {
        grid-template-columns: 64px minmax(0, 1fr) 34px;
        grid-template-areas:
            "img info remove"
            "qty qty total";
        gap: 10px 12px;
    }
    .cart-line-img { width: 64px; height: 64px; grid-area: img; }
    .cart-line-info { grid-area: info; }
    .cart-remove { grid-area: remove; }
    .cart-line .cp-qty { grid-area: qty; justify-self: start; }
    .cart-line-total { grid-area: total; align-self: center; }
    .cart-title { font-size: 23px; }
}