/* Jaunpils Bites V3 - side basket (every page) and the basket pieces it shares with the basket page and the checkout.
   Built from the approved previews web/previews/checkout/co.css + cart.css (19.11), picked look only: Z2 green button.
   Self-contained: works on a page that loads neither checkout.css nor WooCommerce styles. Every selector starts with
   .sb, .cop or a .co-/.ct- class that exists only in our own markup. checkout.css loads after this file on the basket
   page and the checkout only. Markup: parts/co/sidecart.php + parts/co/parts.php. */

/* ---------- tokens: own names, literal fallbacks, only on our own boxes ---------- */
.sb,.cop{
  --co-honey:var(--honey,#FDC101);--co-ink:var(--ink,#3A1E05);--co-cream:var(--cream,#FFF6E3);--co-red:var(--red,#E4002B);--co-pine:var(--pine,#17503A);
  --co-display:var(--display,Pally,"DM Sans",system-ui,sans-serif);--co-body:var(--body,"DM Sans",system-ui,sans-serif);
  --co-line:#EADBB9;--co-line-d:#D9C392;--co-field:#A68B55;--co-soft:#FFF9EC;--co-ok:#17503A;--co-warn-bg:#FFE9B0;--co-r:18px;
  --co-new:#C8001F;--co-muted:#6B5234;--co-err-d:#A8001F;
  /* his pick 19.11: Z2 green pay button; hover goes darker, never lighter */
  --co-pay:#1B7A45;--co-pay-d:#0F4D2A;--co-pay-h:#166A3B;
}

/* ---------- the side basket keeps its own basics, so no page style can change it ---------- */
/* Old Elementor pages may style bare button, h2 and a through a body class (specificity 0,1,1). The resets below are
   kept weak (:where) so our own control rules win; every control rule starts with :is(.sb,.cop) or .sb (0,2,0 and up)
   and sets its own font, colour, border, background and padding. */
.sb,.sb *,.sb *::before,.sb *::after{box-sizing:border-box}
.sb{font:400 17px/1.5 var(--co-body);color:var(--co-ink);text-align:left;letter-spacing:normal;text-transform:none}
:where(.sb) :is(h2,h3,p,ul,dl,dd){margin:0}
:where(.sb) ul{padding:0;list-style:none}
.sb :is(h2,h3){font-family:var(--co-display);font-weight:700;line-height:1.2;color:var(--co-ink);text-transform:none;letter-spacing:normal}
:where(.sb) :is(img,svg){display:block;max-width:100%}
:where(.sb) img{height:auto}
:where(.sb) a{color:inherit}
:where(.sb) button{font:inherit;color:inherit;cursor:pointer;margin:0}
:is(.sb,.cop) :is(button,a.co-place){text-transform:none;letter-spacing:normal;text-shadow:none}
.sb [hidden],.cop [hidden]{display:none!important}
.sb .vh{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.sb :focus-visible{outline:3px solid var(--co-ink);outline-offset:3px}
.sb form{margin:0}

/* ---------- basket lines ---------- */
:is(.sb,.cop) .co-lines{display:grid;gap:10px;margin:0;padding:0;list-style:none}
:is(.sb,.cop) .co-lines li{display:grid;grid-template-columns:56px minmax(0,1fr) auto;grid-template-areas:"img name price" "img qty rm";gap:6px 12px;align-items:center;margin:0}
:is(.sb,.cop) .co-lines li+li{padding-top:10px;border-top:2px dashed rgba(58,30,5,.2)}
:is(.sb,.cop) .co-thumb{grid-area:img;align-self:start;display:block;width:56px;height:56px;border-radius:12px;background:#fff}
:is(.sb,.cop) .co-thumb img{display:block;width:56px;height:56px;object-fit:contain;border-radius:12px}   /* contain, never cover: the whole product must show (owner 20.11) */
:is(.sb,.cop) .co-lines__n{grid-area:name;min-width:0}
:is(.sb,.cop) .co-lines__n b{display:block;font:700 17px/1.2 var(--co-display);overflow-wrap:break-word;hyphens:auto}
:is(.sb,.cop) .co-lines__n small{font-size:15px}
/* the picture and the name lead to the product page (side basket and basket page, owner 20.11) */
:is(.sb,.cop) .co-lines__n a{color:inherit;text-decoration:none}
:is(.sb,.cop) .co-lines__n a:hover b{text-decoration:underline;text-underline-offset:3px}
:is(.sb,.cop) .co-lines__n a:focus-visible{outline:3px solid var(--co-ink);outline-offset:2px;border-radius:4px}
:is(.sb,.cop) .co-lines__p{grid-area:price;align-self:start;padding-top:2px;font:700 17px/1 var(--co-display);white-space:nowrap}
:is(.sb,.cop) .co-qty{grid-area:qty;display:inline-flex;align-items:center;width:fit-content;border:2px solid var(--co-ink);border-radius:12px;background:var(--co-cream)}
:is(.sb,.cop) .co-qty button{width:44px;height:42px;padding:0;border:0;border-radius:10px;background:none;color:var(--co-ink);font:700 22px/1 var(--co-display)}
:is(.sb,.cop) .co-qty button:hover{background:#fff}
:is(.sb,.cop) .co-qty button:disabled,:is(.sb,.cop) .co-qty button[aria-disabled=true]{opacity:.3}
:is(.sb,.cop) .co-qty button[aria-disabled=true]:hover{background:none}
:is(.sb,.cop) .co-qty output{min-width:26px;text-align:center;font:700 17px/1 var(--co-display)}
/* the typed amount (owner 20.11): the field shows only with scripts, the <output> without them. 17 px text: iOS Safari does
   not zoom the page on focus (16 px and up). Every property is set here, so no page or WooCommerce input style can reach it. */
:is(.sb,.cop) .co-qty input{display:none}
.js :is(.sb,.cop) .co-qty output{display:none}
.js :is(.sb,.cop) .co-qty input{display:block;box-sizing:border-box;flex:none;width:34px;min-width:0;max-width:none;height:42px;min-height:0;margin:0;padding:0;border:0;border-radius:6px;background:none;box-shadow:none;color:var(--co-ink);font:700 17px/1 var(--co-display);letter-spacing:normal;text-transform:none;text-align:center;appearance:none;-webkit-appearance:none;-moz-appearance:textfield}
.js :is(.sb,.cop) .co-qty input:focus{outline:3px solid var(--co-ink);outline-offset:-3px;background:#fff}
/* "Mums ir pieejami tikai N gab.": under the line, across its whole width (also in the narrow side basket grid) */
:is(.sb,.cop) .co-qty-max{grid-column:1/-1;margin:0;padding:0;font:500 15px/1.35 var(--co-body);color:var(--co-ink)}
:is(.sb,.cop) .co-rm{grid-area:rm;justify-self:end;border:0;background:none;color:var(--co-ink);min-height:44px;padding:0 2px;font:500 14px/1 var(--co-body);text-decoration:underline;text-underline-offset:3px}
:is(.sb,.cop) .co-linkbtn{border:0;background:none;color:var(--co-ink);padding:8px 0;min-height:44px;font:700 15px/1.2 var(--co-display);text-decoration:underline;text-underline-offset:4px;text-align:left}
:is(.sb,.cop) .co-linkbtn--s{min-height:32px;padding:6px 4px;margin-left:4px;font:500 14px/1.2 var(--co-body)}

/* undo row: a removed line can always be put back */
:is(.sb,.cop) .co-undo{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:10px 0 0;padding:8px 12px;border-radius:10px;background:var(--co-soft);border:2px dashed var(--co-field);font-size:15px}
:is(.sb,.cop) .co-undo[hidden]{display:none}
:is(.sb,.cop) .co-undo button{border:0;background:none;color:var(--co-ink);min-height:40px;padding:0 2px;font:700 15px/1.2 var(--co-display);text-decoration:underline;text-underline-offset:4px;white-space:nowrap}

/* ---------- sums ---------- */
:is(.sb,.cop) .co-totals{margin:8px 0 0;display:grid;gap:8px;border-top:2px dashed rgba(58,30,5,.25);padding-top:12px}
:is(.sb,.cop) .co-totals div{display:flex;justify-content:space-between;align-items:baseline;gap:12px}
:is(.sb,.cop) .co-totals div[hidden]{display:none}
:is(.sb,.cop) .co-totals dt{min-width:0;overflow-wrap:anywhere}
:is(.sb,.cop) .co-totals dd{margin:0;font-weight:500;white-space:nowrap}
:is(.sb,.cop) .co-totals__sum{font:700 24px/1.1 var(--co-display);padding-top:4px}
:is(.sb,.cop) .co-totals__sum dd{font-weight:700}

/* free delivery bar (text and width printed by the server) */
:is(.sb,.cop) .co-free{margin-top:14px;background:var(--co-cream);border-radius:12px;padding:10px 12px;font-size:15px}
:is(.sb,.cop) .co-free[hidden]{display:none}
:is(.sb,.cop) .co-free p{margin:0;padding:0}
:is(.sb,.cop) .co-free__bar{height:10px;border:2px solid var(--co-ink);border-radius:9px;background:#fff;overflow:hidden;margin-bottom:6px}
:is(.sb,.cop) .co-free__bar i{display:block;height:100%;background:var(--co-pine);transition:width .3s}

/* "eat more, pay less" line of the discount plugin */
:is(.sb,.cop) .ct-ladder{display:flex;gap:10px;align-items:center;margin-top:14px;padding:10px 12px;border-radius:12px;background:var(--co-honey);font-weight:500;font-size:15px;line-height:1.35}
:is(.sb,.cop) .ct-ladder b{font-weight:700}
:is(.sb,.cop) .ct-ladder svg{width:26px;height:26px;flex:none;fill:none;stroke:var(--co-ink);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ---------- the green button (Z2) ---------- */
:is(.sb,.cop) .co-place,:is(.sb,.cop) a.co-place{display:flex;align-items:center;justify-content:center;gap:.35em;width:100%;min-height:64px;margin-top:10px;padding:0 16px;border:0;border-radius:14px;background:var(--co-pay);color:#fff;font:700 clamp(14px,4.7vw,21px)/1.1 var(--co-display);white-space:nowrap;text-decoration:none;box-shadow:0 6px 0 var(--co-pay-d);cursor:pointer;transition:transform .12s,background .15s,box-shadow .12s}
:is(.sb,.cop) .co-place:hover{background:var(--co-pay-h);color:#fff}
:is(.sb,.cop) .co-place:active{transform:translateY(4px);box-shadow:0 2px 0 var(--co-pay-d)}
:is(.sb,.cop) .co-place:focus-visible{outline:3px solid var(--co-ink);outline-offset:3px}
:is(.sb,.cop) .co-place i{display:none}
:is(.sb,.cop) .co-place[aria-busy=true]{background:var(--co-pay-d);box-shadow:none;transform:translateY(4px);cursor:progress;color:#fff}
@media(max-width:350px){:is(.sb,.cop) .co-place{gap:6px;padding:0 8px}}

/* empty basket bee */
.ct-bee{height:auto}

/* ---------- the side basket window: slides in from the right ---------- */
/* his rule 19.11: never full screen. On phones a strip of the page stays visible on the left; a tap on it closes the basket */
.sb{width:min(440px,calc(100vw - 56px));max-width:calc(100vw - 56px);height:100dvh;max-height:100dvh;margin:0 0 0 auto;padding:0;border:0;border-radius:0;background:var(--co-cream);color:var(--co-ink);inset-block:0;overflow:hidden}
.sb[open]{display:flex;flex-direction:column}
.sb:modal{overscroll-behavior:contain}
.sb::backdrop{background:rgba(18,12,6,.55);overflow:hidden;overscroll-behavior:contain}
.sb__top{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;background:var(--co-honey)}
.sb .sb__top h2{font-size:24px}
.sb .sb__top h2 small{font:500 16px/1 var(--co-body)}
.sb .sb__x{display:grid;place-items:center;width:46px;height:46px;padding:0;border:0;border-radius:50%;background:var(--co-cream);color:var(--co-ink)}
.sb .sb__x svg{width:22px;height:22px;fill:none;stroke:var(--co-ink);stroke-width:2.8;stroke-linecap:round}
.sb__body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:14px 16px;display:grid;gap:12px;align-content:start}
/* the part the server redraws (#jbc-side-body) keeps the same spacing as the body around it */
.sb__in{display:grid;gap:12px;align-content:start;min-width:0}
/* while the first answer is on its way: a calm bar, no words */
.sb__in[aria-busy=true]:empty{min-height:120px;border-radius:14px;background:#fff linear-gradient(90deg,transparent 0,rgba(253,193,1,.25) 50%,transparent 100%) 0 0/200% 100% no-repeat}
@media(prefers-reduced-motion:no-preference){.sb__in[aria-busy=true]:empty{animation:sb-wait 1.2s linear infinite}@keyframes sb-wait{to{background-position:-200% 0}}}
.sb__body .co-free{margin:0;background:#fff}
.sb .co-lines{background:#fff;border-radius:14px;padding:12px}
.sb .co-lines li+li{border-top-color:var(--co-line)}
.sb .co-thumb{background:var(--co-soft)}
.sb .ct-ladder{margin:0}
.sb .co-undo{margin:0;background:#fff}
/* shop messages of a basket call (stock limits): filled by basket.js */
.sb .sb__notes:empty{display:none}
.sb .sb__notes{display:grid;gap:8px}
.sb .sb__notes .co-note,.sb .sb__notes p,.sb .sb__notes div{margin:0;padding:10px 12px;border-radius:12px;border:2px solid var(--co-ink);background:var(--co-warn-bg);font:500 15px/1.35 var(--co-body)}
.sb .sb__notes .co-note--err,.sb .sb__notes [data-type=error]{background:#FFE1E1;border-color:var(--co-red)}
.sb .sb__ups h3{font:700 17px/1.2 var(--co-display);margin-bottom:8px}
.sb__ups ul{display:grid;gap:8px}
.sb__ups li{display:grid;grid-template-columns:52px minmax(0,1fr) auto;gap:10px;align-items:center;padding:8px 10px;border-radius:12px;background:#fff}
.sb__ups img{width:52px;height:52px;object-fit:contain;border-radius:10px;background:var(--co-soft)}
.sb__ups b{display:block;font:700 16px/1.2 var(--co-display)}
.sb__ups small{font-size:14px}
.sb .sb__ups button{min-height:44px;padding:0 12px;border:2px solid var(--co-ink);border-radius:11px;background:#fff;color:var(--co-ink);font:700 15px/1 var(--co-display);white-space:nowrap}
.sb .sb__ups button:hover{background:var(--co-honey)}
.sb .sb__ups button[disabled],.sb .sb__ups button[aria-disabled=true]{border-color:var(--co-ok);color:var(--co-ok);background:#fff}
.sb__foot{padding:12px 16px calc(14px + env(safe-area-inset-bottom));background:#fff;border-top:3px solid var(--co-ink)}
.sb__foot[hidden]{display:none}
.sb__sum{display:flex;justify-content:space-between;align-items:baseline;gap:12px;font:700 22px/1.1 var(--co-display)}
.sb__sum small{display:block;font:400 13px/1.3 var(--co-body);margin-top:3px}
.sb__foot .co-place{margin-top:10px;min-height:58px}
.sb .sb__view{display:block;margin-top:4px;padding:11px 0 0;text-align:center;font:700 15px/1 var(--co-display);text-underline-offset:4px;color:var(--co-ink)}
/* side basket foot: discount rows (only when there is a discount) above the bold line */
.sb__rows{margin:0 0 10px;padding:0 0 10px;border-top:0;border-bottom:2px dashed rgba(58,30,5,.25);font-size:15px;line-height:1.3}
.sb__empty{display:grid;justify-items:center;gap:10px;padding:40px 10px;text-align:center}
.sb__empty[hidden]{display:none}
.sb__empty img.ct-bee{width:150px}
.sb .sb__empty h3{font:700 20px/1.2 var(--co-display)}
@media(prefers-reduced-motion:no-preference){
  .sb[open]{animation:sb-in .22s ease-out}
  @keyframes sb-in{from{transform:translateX(40px);opacity:.4}}
}
/* narrow phones: the quantity box starts under the picture, so it can never slide under "Izņemt" */
@media(max-width:400px){
  .sb__body{padding:12px}
  .sb .co-lines{padding:10px}
  .sb .co-lines li{grid-template-columns:48px minmax(0,1fr) auto;grid-template-areas:"img name price" "qty qty rm";gap:8px 10px}
  .sb .co-thumb,.sb .co-thumb img{width:48px;height:48px}
}
/* short phones (iPhone SE and the like): the foot is packed tighter so at least two basket lines stay in view */
@media(max-height:620px){
  .sb__top{padding:8px 16px}
  .sb .sb__x{width:42px;height:42px}
  .sb__foot{padding-top:8px}
  .sb__rows{gap:3px;margin-bottom:6px;padding-bottom:6px;font-size:14px;line-height:1.25}
  .sb__sum{font-size:20px}
  .sb__sum small{display:none}
  .sb .sb__foot a.co-place{min-height:50px;margin-top:8px}   /* .sb .sb__foot a: stronger than the base button rule :is(.sb,.cop) a.co-place */
  .sb .sb__view{margin-top:2px;padding-top:9px}
}
/* a phone held sideways: the foot becomes one row (sum left, button right), the delivery bar gives its place to the basket lines */
@media(max-height:460px) and (orientation:landscape){
  .sb__top{padding:6px 16px}
  .sb .sb__top h2{font-size:20px}
  .sb .sb__x{width:38px;height:38px}
  .sb__body{padding-top:10px}
  .sb__in>.co-free{display:none}
  .sb__foot{display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;padding:6px 16px calc(6px + env(safe-area-inset-bottom))}
  .sb__rows{flex:1 1 100%;margin:0;padding-bottom:4px}
  .sb__sum{flex:1 1 0;min-width:0;margin:0}
  .sb .sb__foot a.co-place{flex:0 0 auto;width:auto;min-height:44px;margin:0;padding:0 18px;font-size:17px;box-shadow:0 4px 0 var(--co-pay-d)}
  .sb .sb__view{flex:1 1 100%;margin:0;padding:6px 0 2px}
  .sb__rows>div:first-child{display:none}            /* the plain "Summa" row: the discount rows and "Kopā" stay */
}
/* phones with a notch held sideways: the side basket sits at the right edge, so its content keeps clear of the notch */
.sb__top,.sb__body,.sb__foot{padding-right:max(16px,env(safe-area-inset-right))}
@media(max-width:400px){.sb__body{padding-right:max(12px,env(safe-area-inset-right))}}
/* "Skatīt grozu" is a full 44 px tap target on upright phones */
@media(min-height:621px){.sb .sb__view{padding:15px 0 14px;margin:0 0 -12px}}

/* new texts in red for approval: only with ?red=1 (body class co-red) */
.co-red .sb .new{color:var(--co-new)}

/* ---------- Windows high contrast ---------- */
@media(forced-colors:active){
  .co-place{border:2px solid ButtonText}
}
@media(prefers-reduced-motion:reduce){
  .sb,.sb *,.co-place,.co-free__bar i{transition:none!important;animation:none!important}
}
