/* kudikiuprekes.lt cart v2 + add-to-cart mini drawer. Page additions only (tokens/base in home.css). 2026-09-23 */
@font-face { font-family: "Nunito Fallback"; src: local("Arial"), local("Liberation Sans"), local("Helvetica"), local("Roboto"); size-adjust: 86%; ascent-override: 117.5%; descent-override: 41%; line-gap-override: 0%; }
body.cartv2-page { --font: "Nunito", "Nunito Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }

.cartv2 { padding: 20px 0 40px; }
.cv-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.cv-head h1 { font-size: 28px; font-weight: 800; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.cv-head h1:focus { outline: none; }
.cv-count { font-size: 16px; font-weight: 700; color: var(--ink-soft); }
.cv-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 700; }

/* flash / errors */
.v2-flash-list { display: grid; gap: 8px; margin-bottom: 16px; }
.v2-flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--r-sm); background: var(--mint); color: #145c33; font-weight: 600; margin-bottom: 12px; }
.v2-flash-list .v2-flash { margin-bottom: 0; }
.v2-flash svg { flex: none; margin-top: 2px; }
.v2-flash.is-error { background: var(--blush); color: #8f2419; }

/* layout */
.cv-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.cv-items { min-width: 0; }
.v2 ul.cv-list { display: grid; gap: 12px; }
#cartv2-root.is-busy .cv-items, #cartv2-root.is-busy .cv-summary { opacity: .6; pointer-events: none; transition: opacity .15s; }

/* line card */
.cv-line {
    display: grid; grid-template-columns: 80px minmax(0, 1fr); grid-template-areas: "thumb info" "act act" "max max";
    gap: 12px 14px; padding: 14px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-sm);
}
.cv-line.is-gift { background: var(--butter); }
.cv-thumb { grid-area: thumb; position: relative; display: block; width: 80px; height: 80px; border-radius: var(--r-sm); background: #fff; border: 1px solid var(--line); overflow: hidden; }
.cv-thumb img { width: 100%; height: 100%; object-fit: contain; }
.cv-vol { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: var(--pill); background: var(--sky); color: var(--primary); font-size: 11px; font-weight: 800; }
.cv-info { grid-area: info; min-width: 0; }
.cv-brand { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.v2 .cv-title { font-size: 16px; font-weight: 700; line-height: 1.35; margin: 2px 0 4px; overflow-wrap: anywhere; }
.cv-title a { color: var(--ink); }
.cv-gift { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--pill); background: var(--accent); color: var(--ink); font-size: 11px; font-weight: 800; vertical-align: middle; }
.cv-variant { font-size: 14px; color: var(--ink-soft); }
.cv-ship { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok); font-weight: 600; margin-top: 4px; }
.cv-unit { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 6px; font-size: 14px; }
.cv-unit-now { font-weight: 800; color: var(--ink); }
.cv-unit-now.is-sale { color: var(--danger); }
.cv-unit-old { color: var(--muted); }
.cv-unit-lbl { color: var(--muted); }

.cv-actions { grid-area: act; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cv-qty { display: inline-flex; align-items: center; height: 48px; border: 2px solid var(--line); border-radius: var(--pill); background: #fff; }
.cv-qty-btn { width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; font-weight: 700; color: var(--ink); cursor: pointer; border-radius: var(--pill); }
.cv-qty-btn:hover:not([disabled]) { background: var(--sky); }
.cv-qty-btn[disabled] { color: #b9c2c9; cursor: not-allowed; }
.cv-qty input { width: 44px; height: 44px; border: 0; text-align: center; font: 800 16px var(--font); color: var(--ink); background: transparent; -moz-appearance: textfield; appearance: textfield; }
.cv-qty input::-webkit-outer-spin-button, .cv-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cv-total { margin-left: auto; font-size: 18px; font-weight: 800; white-space: nowrap; }
.cv-remove { color: var(--ink-soft) !important; }
.cv-remove:hover { background: var(--blush); color: var(--danger) !important; }
.cv-max { grid-area: max; margin: -4px 0 0; font-size: 13px; color: var(--ink-soft); }

/* summary */
.cv-sum-box { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; }
.v2 .cv-sum-box h2 { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.cv-rows { margin: 0; }
.cv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.cv-row dt { color: var(--ink-soft); }
.cv-row dd { margin: 0; font-weight: 700; text-align: right; }
.cv-row.is-disc dd { color: var(--ok); }
.cv-code { display: inline-block; margin-left: 4px; padding: 0 8px; border-radius: var(--pill); background: var(--mint); color: #145c33; font-size: 13px; font-weight: 700; }
.cv-muted { color: var(--muted); font-weight: 600; font-size: 14px; }
.cv-grand { border-bottom: 0; padding-top: 12px; font-size: 18px; }
.cv-grand dt { color: var(--ink); font-weight: 800; }
.cv-grand dd { font-size: 22px; font-weight: 800; }

.cv-coupon { margin: 8px 0 16px; border: 2px dashed var(--line); border-radius: var(--r-sm); padding: 0 14px; }
.cv-coupon > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--link); list-style: none; }
.cv-coupon > summary::-webkit-details-marker { display: none; }
.cv-coupon > summary::after { content: "+"; margin-left: auto; font-size: 20px; color: var(--ink-soft); }
.cv-coupon[open] > summary::after { content: "−"; }
.cv-coupon-form { padding-bottom: 14px; }
.cv-coupon-form label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.cv-coupon-row { display: flex; gap: 8px; }
.cv-coupon-row input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 14px; border: 2px solid var(--line); border-radius: var(--pill); font: 700 16px var(--font); color: var(--ink); background: #fff; text-transform: uppercase; }
.cv-coupon-row input::placeholder { text-transform: none; font-weight: 400; color: #6b7c88; }
.cv-coupon-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 119, 168, .25); }
.cv-coupon.is-on { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 8px 14px; border-style: solid; border-color: var(--mint); background: var(--mint); }
.cv-coupon-on { display: inline-flex; align-items: center; gap: 6px; color: #145c33; }
.cv-coupon-del { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--danger) !important; }

.cv-pay-total { display: none; }
.cv-checkout { width: 100%; font-weight: 800; font-size: 17px; }
.v2 ul.cv-trust { display: grid; gap: 10px; margin-top: 16px; font-size: 14px; color: var(--ink-soft); }
.cv-trust li { display: flex; align-items: center; gap: 10px; }
.cv-trust svg { flex: none; color: var(--primary); }

/* empty cart */
.cv-empty { text-align: center; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 32px 16px; }
.cv-empty-ico { width: 88px; height: 88px; margin: 0 auto 12px; border-radius: 50%; background: var(--sky); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.v2 .cv-empty h2 { font-size: 22px; font-weight: 800; }
.cv-empty p { color: var(--ink-soft); margin: 8px auto 18px; max-width: 460px; }
.cv-search { display: flex; gap: 8px; max-width: 520px; margin: 0 auto 18px; }
.cv-search input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 18px; border: 2px solid var(--line); border-radius: var(--pill); background: var(--sky); font: 600 16px var(--font); color: var(--ink); -webkit-appearance: none; appearance: none; }
.cv-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 119, 168, .25); background: #fff; }
.v2 ul.cv-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* confirm dialog */
.cv-dialog { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.cv-dialog-back { position: absolute; inset: 0; background: rgba(20, 28, 36, .5); }
.cv-dialog-box { position: relative; width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 22px; }
.cv-dialog-t { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.cv-dialog-name { margin: 0 0 18px; color: var(--ink-soft); }
.cv-dialog-act { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.cv-dialog-act .btn { flex: 1 1 140px; }

/* ---------- add-to-cart mini drawer ---------- */
.cvd { position: fixed; inset: 0; z-index: 85; }
.cvd-back { position: absolute; inset: 0; background: rgba(20, 28, 36, .45); }
.cvd-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); box-shadow: var(--shadow-lg); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; animation: cvdIn .2s ease-out; }
@keyframes cvdIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.cvd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v2 .cvd-head h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; color: var(--ok); }
.cvd-item { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--mint); min-height: 64px; }
.cvd-item img { width: 64px; height: 64px; object-fit: contain; border-radius: var(--r-sm); background: #fff; flex: none; }
.cvd-item p { margin: 0; }
.cvd-name { font-weight: 700; }
.cvd-opt { font-size: 14px; color: var(--ink-soft); }
.cvd-price { font-weight: 800; }
.cvd-act { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v2 .cvd-more h3 { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.v2 ul.cvd-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cvd-card { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink) !important; }
.cvd-card:hover { text-decoration: none !important; box-shadow: var(--shadow-sm); }
.cvd-card img { width: 90px; height: 90px; object-fit: contain; margin: 0 auto; }
.cvd-card-name { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cvd-card-price { font-weight: 800; font-size: 14px; }
.cvd-card-old { color: var(--muted); font-weight: 600; font-size: 12px; }
body.cvd-open { overflow: hidden; }

/* ---------- mobile: total + button as sticky bottom bar ---------- */
@media (max-width: 959px) {
    body.cartv2-page { padding-bottom: 84px; }
    .cv-pay {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        display: flex; align-items: center; gap: 12px;
        padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
        background: var(--surface); box-shadow: 0 -4px 18px rgba(20, 60, 90, .12);
    }
    .cv-pay-total { display: flex; flex-direction: column; line-height: 1.15; flex: none; }
    .cv-pay-total span { font-size: 13px; color: var(--ink-soft); }
    .cv-pay-total strong { font-size: 20px; font-weight: 800; }
    .cv-checkout { flex: 1; min-width: 0; min-height: 52px; padding: 10px 14px; font-size: 16px; }
    body.cartv2-page .toast { bottom: 92px; }
}
@media (max-width: 380px) {
    .cv-checkout svg { display: none; }
}
@media (min-width: 640px) {
    .cv-line { grid-template-columns: 96px minmax(0, 1fr) auto; grid-template-areas: "thumb info act" "thumb max max"; padding: 16px; }
    .cv-thumb { width: 96px; height: 96px; }
    .cv-actions { flex-direction: column; align-items: flex-end; justify-content: flex-start; gap: 8px; }
    .cv-total { margin-left: 0; order: -1; }
    .cv-actions .cv-remove { position: static; }
    .cv-empty { padding: 48px 24px; }
}
@media (min-width: 640px) {
    .cv-actions { display: grid; grid-template-columns: auto auto; grid-template-areas: "tot rm" "qty qty"; justify-items: end; align-items: center; }
    .cv-actions .cv-total { grid-area: tot; }
    .cv-actions .cv-remove { grid-area: rm; }
    .cv-actions .cv-qty { grid-area: qty; }
}
@media (min-width: 960px) {
    .cartv2 { padding-top: 28px; }
    .cv-head h1 { font-size: 34px; }
    .cv-layout { grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; }
    .cv-summary { position: sticky; top: 96px; }
}
.v2 ul.cv-chips .chip { min-height: 44px; display: inline-flex; align-items: center; }
