/* ═══════════════════════════════════════════════
   JASA V2 — Cart Page (cart.css)
   ═══════════════════════════════════════════════ */

/* ── Page head ── */
.cart-page-head {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 14px 10px;
    font-size: 1.4rem; color: var(--primary);
}
.cart-page-title {
    font-size: 1.1rem; font-weight: 800; color: var(--txt1);
    margin: 0 0 2px;
}
.cart-page-sub {
    font-size: .72rem; font-weight: 600; color: var(--txt3); margin: 0;
}

/* ── Empty state ── */
.cart-empty {
    text-align: center; padding: 48px 20px;
}
.cart-empty-icon {
    font-size: 3.5rem; color: var(--border2); margin-bottom: 16px;
}
.cart-empty h3 {
    font-size: 1rem; font-weight: 800; color: var(--txt1); margin-bottom: 6px;
}
.cart-empty p {
    font-size: .8rem; font-weight: 600; color: var(--txt3); margin-bottom: 18px;
}
.cart-empty-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 24px;
    background: var(--primary); color: #fff;
    border-radius: 50px; font-size: .82rem; font-weight: 800;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(45,140,240,.3);
    transition: background var(--ease);
}
.cart-empty-btn:hover { background: var(--primary-dark); color: #fff; }

/* ── Cart items grid ── */
.cart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 14px;
    margin-bottom: 12px;
}
@media (min-width: 480px) { .cart-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 700px) { .cart-grid { grid-template-columns: repeat(4, 1fr); } }

/* ── Cart item card ── */
.cart-item-card {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    display: flex; flex-direction: column;
    position: relative;
    transition: border-color var(--ease), box-shadow var(--ease);
}
.cart-item-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45,140,240,.12);
}

/* selection check */
.cart-check-wrap {
    position: absolute; top: 8px; left: 8px; z-index: 2;
}
.cart-check {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--border2);
    background: var(--bg-white);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: .6rem; color: transparent;
    transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.cart-item-card.selected .cart-check {
    background: var(--primary); border-color: var(--primary); color: #fff;
}

/* remove button */
.cart-remove-btn {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(239,68,68,.1); border: none;
    color: #ef4444; font-size: .65rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background var(--ease), color var(--ease);
}
.cart-remove-btn:hover { background: #ef4444; color: #fff; }

/* image */
.cart-item-img {
    height: 110px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); padding: 10px;
    border-bottom: 1px solid var(--border);
}
.cart-item-img img {
    max-width: 100%; max-height: 100%; object-fit: contain;
}
.cart-item-img .cart-no-img {
    font-size: 2.2rem; color: var(--border2);
}

/* body */
.cart-item-body {
    padding: 8px 8px 6px; flex: 1; display: flex; flex-direction: column;
}
.cart-item-name {
    font-size: .76rem; font-weight: 800; color: var(--txt1);
    text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.3; margin-bottom: 4px;
}
.cart-item-name:hover { color: var(--primary); }
.cart-item-price {
    font-size: .86rem; font-weight: 800; color: var(--primary);
    margin-bottom: 8px;
}
.cart-item-original {
    font-size: .62rem; font-weight: 600; color: var(--txt3);
    text-decoration: line-through; margin-left: 4px;
}

/* qty control */
.cart-qty {
    display: flex; align-items: center;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 50px; padding: 2px;
    width: fit-content; margin-bottom: 8px;
}
.cart-qty-btn {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--bg-white); border: none;
    color: var(--txt1); font-size: .62rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: var(--sh-sm);
    transition: background var(--ease), color var(--ease);
}
.cart-qty-btn:hover { background: var(--primary); color: #fff; }
.cart-qty-num {
    padding: 0 8px; font-size: .78rem; font-weight: 800;
    color: var(--txt1); min-width: 24px; text-align: center;
}

/* item subtotal */
.cart-item-sub {
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid var(--border); padding-top: 6px; margin-top: auto;
}
.cart-item-sub-label {
    font-size: .6rem; font-weight: 700; color: var(--txt3);
    text-transform: uppercase; letter-spacing: .3px;
}
.cart-item-sub-val {
    font-size: .8rem; font-weight: 800; color: var(--txt1);
}

/* ── Order summary card ── */
.cart-summary-card {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    margin: 0 14px 80px;
    padding: 16px;
}
.cart-sum-title {
    font-size: 1rem; font-weight: 800; color: var(--txt1);
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.cart-sum-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border);
    gap: 8px;
}
.cart-sum-row:last-of-type { border-bottom: none; }
.cart-sum-total-row {
    border-top: 2px solid var(--border2);
    border-bottom: none; margin-top: 4px; padding-top: 12px;
}
.cart-sum-label {
    font-size: .78rem; font-weight: 600; color: var(--txt3);
}
.cart-sum-val { font-size: .88rem; font-weight: 800; color: var(--txt1); }
.cart-sum-delivery { color: var(--txt3); font-weight: 600; font-size: .82rem; }
.cart-sum-total   { font-size: 1rem; color: var(--primary); }

/* itemized rows */
.sum-item-row {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 6px; padding: 5px 0; border-bottom: 1px dashed var(--border);
    font-size: .72rem;
}
.sum-item-row:last-child { border-bottom: none; margin-bottom: 4px; }
.sum-item-name {
    flex: 1; font-weight: 700; color: var(--txt2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sum-item-amt { font-weight: 800; color: var(--txt1); flex-shrink: 0; }

/* free delivery nudge */
.cart-nudge {
    background: var(--primary-faint);
    border: 1px solid var(--primary-light);
    border-radius: var(--r-sm); padding: 9px 12px;
    font-size: .74rem; font-weight: 700; color: var(--primary);
    display: flex; align-items: center; gap: 7px; margin-top: 10px;
}
.cart-nudge.success { background: #f0fdf4; border-color: #bbf7d0; color: #16a34a; }

/* shop selectors */
.shop-selector-wrap {
    margin-top: 14px; padding-top: 14px;
    border-top: 1px solid var(--border);
}
.shop-selector-head {
    font-size: .72rem; font-weight: 800;
    color: var(--txt3); text-transform: uppercase;
    letter-spacing: .5px; margin-bottom: 10px;
}
.shop-selector-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer; margin-bottom: 8px;
    transition: border-color var(--ease), background var(--ease);
}
.shop-selector-row:hover { border-color: var(--primary); }
.shop-selector-row.selected { border-color: var(--primary); background: var(--primary-faint); }
.shop-selector-cat {
    display: flex; align-items: center; gap: 8px;
    font-size: .78rem; font-weight: 700; color: var(--txt2);
}
.shop-selector-name {
    font-size: .72rem; font-weight: 600; color: var(--txt3);
}

/* checkout button */
.cart-checkout-btn {
    width: 100%; height: 48px;
    background: var(--primary); color: #fff;
    border: none; border-radius: var(--r-sm);
    font-size: .92rem; font-weight: 800;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 14px;
    box-shadow: 0 4px 16px rgba(45,140,240,.35);
    transition: background var(--ease), transform var(--ease);
}
.cart-checkout-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.cart-checkout-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

/* ════════════════════════════════
   BOTTOM SHEETS (shared with categories.css patterns)
   ════════════════════════════════ */
.sheet-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
    z-index: 1600; opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
.sheet-backdrop.show { opacity: 1; pointer-events: all; }

.bottom-sheet {
    position: fixed; bottom: 0; left: 0; right: 0;
    max-height: 85vh;
    background: var(--bg-white);
    border-radius: 22px 22px 0 0;
    border-top: 1.5px solid var(--border);
    z-index: 1700;
    display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 -8px 32px rgba(0,0,0,.18);
}
.bottom-sheet.open { transform: translateY(0); }
.checkout-sheet { max-height: 92vh; }

.sheet-handle {
    width: 40px; height: 4px; border-radius: 4px;
    background: var(--border2); margin: 10px auto 0; flex-shrink: 0;
}
.sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px 10px;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sheet-title { font-size: 1rem; font-weight: 800; color: var(--txt1); }
.sheet-body  { flex: 1; overflow-y: auto; scrollbar-width: thin;
               scrollbar-color: var(--border) transparent; }

/* ── Shop list in sheet ── */
.shop-sheet-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--ease);
}
.shop-sheet-item:last-child { border-bottom: none; }
.shop-sheet-item:hover { background: var(--bg); }
.shop-sheet-item.selected { background: var(--primary-faint); }

.shop-sheet-icon {
    width: 38px; height: 38px; border-radius: var(--r-sm); flex-shrink: 0;
    background: var(--primary-faint); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: .9rem;
}
.shop-sheet-info { flex: 1; min-width: 0; }
.shop-sheet-name { font-size: .88rem; font-weight: 800; color: var(--txt1); margin-bottom: 2px; }
.shop-sheet-addr { font-size: .72rem; font-weight: 600; color: var(--txt3); }
.shop-sheet-free { font-size: .66rem; font-weight: 700; color: #16a34a; margin-top: 3px; }

.shop-sheet-radio {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--border2); flex-shrink: 0; margin-top: 2px;
    display: flex; align-items: center; justify-content: center;
    transition: border-color var(--ease);
}
.shop-sheet-item.selected .shop-sheet-radio { border-color: var(--primary); }
.shop-sheet-radio-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); transform: scale(0);
    transition: transform .2s cubic-bezier(.175,.885,.32,1.275);
}
.shop-sheet-item.selected .shop-sheet-radio-dot { transform: scale(1); }

/* ── Checkout sheet ── */
.co-summary {
    margin: 14px 18px;
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--r-sm); padding: 12px 14px;
}
.co-summary-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0; font-size: .8rem; font-weight: 600; color: var(--txt2);
}
.co-total-row {
    border-top: 1.5px solid var(--border); margin-top: 6px; padding-top: 10px;
    font-size: .92rem; font-weight: 800; color: var(--txt1);
}
.co-primary { color: var(--primary); font-weight: 800; }
.co-shop-line {
    font-size: .68rem; font-weight: 700; color: var(--primary);
    padding-top: 8px; margin-top: 6px;
    border-top: 1px dashed var(--border);
}

.co-section {
    padding: 14px 18px 0;
}
.co-section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
    font-size: .88rem; font-weight: 800; color: var(--txt1);
}
.co-section-head i { color: var(--primary); margin-right: 6px; }
.co-add-btn {
    background: none; border: 1.5px solid var(--border2);
    border-radius: 50px; padding: 4px 12px;
    font-size: .72rem; font-weight: 700; color: var(--txt2);
    cursor: pointer; font-family: inherit;
    transition: border-color var(--ease), color var(--ease);
}
.co-add-btn:hover { border-color: var(--primary); color: var(--primary); }

.co-field-group { display: flex; flex-direction: column; gap: 4px; }
.co-label {
    font-size: .66rem; font-weight: 700; color: var(--txt3);
    text-transform: uppercase; letter-spacing: .3px;
}
.co-select, .co-input {
    width: 100%; height: 42px; padding: 0 12px;
    border: 1.5px solid var(--border2); border-radius: var(--r-sm);
    font-size: .84rem; font-weight: 600; color: var(--txt1);
    background: var(--bg); outline: none; font-family: inherit;
    transition: border-color var(--ease);
}
.co-input { margin-bottom: 8px; }
.co-select:focus, .co-input:focus {
    border-color: var(--primary); background: var(--bg-white);
}

.co-new-form {
    background: var(--bg); border: 1.5px dashed var(--border2);
    border-radius: var(--r-sm); padding: 12px; margin-top: 8px;
}
.co-form-actions {
    display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px;
}
.co-cancel-btn {
    background: none; border: none; font-family: inherit;
    font-size: .76rem; font-weight: 700; color: var(--txt3); cursor: pointer;
}
.co-save-btn {
    background: var(--primary); color: #fff; border: none;
    border-radius: 50px; padding: 6px 16px;
    font-size: .76rem; font-weight: 800; cursor: pointer; font-family: inherit;
}

/* address cards */
.co-addr-card {
    border: 1.5px solid var(--border); border-radius: var(--r-sm);
    padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    transition: border-color var(--ease), background var(--ease);
}
.co-addr-card.selected { border-color: var(--primary); background: var(--primary-faint); }
.co-addr-card input[type="radio"] { accent-color: var(--primary); flex-shrink: 0; }
.co-addr-label { font-size: .82rem; font-weight: 800; color: var(--txt1); margin-bottom: 2px; }
.co-addr-text  { font-size: .72rem; font-weight: 600; color: var(--txt3); }

.co-place-btn {
    width: calc(100% - 36px); margin: 16px 18px 0;
    height: 50px;
    background: var(--primary); color: #fff; border: none;
    border-radius: var(--r-sm); font-size: .92rem; font-weight: 800;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 4px 16px rgba(45,140,240,.35);
    transition: background var(--ease);
}
.co-place-btn:hover { background: var(--primary-dark); }
.co-place-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.co-secure-note {
    text-align: center; font-size: .7rem; font-weight: 600; color: var(--txt3);
    padding: 10px 0 20px; margin: 0;
    display: flex; align-items: center; justify-content: center; gap: 5px;
}

/* reuse pf-overlay/dialog from profile.css — define here too */
.pf-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5); backdrop-filter: blur(6px);
    z-index: 1800; display: flex; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; pointer-events: none;
    transition: opacity var(--ease);
}
.pf-overlay.active { opacity: 1; pointer-events: all; }
.pf-dialog {
    background: var(--bg-white); border: 1.5px solid var(--border);
    border-radius: 24px; padding: 28px 24px;
    width: 100%; max-width: 340px; text-align: center;
    transform: scale(.94); transition: transform var(--ease);
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.pf-overlay.active .pf-dialog { transform: scale(1); }
.pf-dialog-icon { width: 52px; height: 52px; border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; margin: 0 auto 14px; }
.pf-dialog-icon.danger { background: #fee2e2; color: #dc2626; }
.pf-dialog-title { font-size: 1.05rem; font-weight: 800; color: var(--txt1); margin-bottom: 5px; }
.pf-dialog-msg   { font-size: .8rem; font-weight: 600; color: var(--txt2); margin-bottom: 20px; }
.pf-dialog-actions { display: flex; gap: 8px; }
.pf-btn-cancel {
    flex: 1; height: 44px; background: var(--bg); color: var(--txt2);
    border: 1.5px solid var(--border2); border-radius: var(--r-sm);
    font-size: .88rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.pf-btn-save {
    flex: 1; height: 44px; background: var(--primary); color: #fff;
    border: none; border-radius: var(--r-sm);
    font-size: .88rem; font-weight: 800; cursor: pointer; font-family: inherit;
    box-shadow: 0 4px 14px rgba(45,140,240,.3);
}

/* spin helper */
.cart-spin {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
    border-radius: 50%; animation: cartSpinKf .6s linear infinite; flex-shrink: 0;
}
@keyframes cartSpinKf { to { transform: rotate(360deg); } }

@media (min-width: 600px) {
    .cart-grid          { padding: 0; }
    .cart-summary-card  { margin: 0 0 80px; }
    .cart-page-head     { padding: 18px 0 10px; }
}
