/* Suhkruvatt — pink pixie theme.
   Shared stylesheet for every page (storefront, /return, /banks, /view, admin,
   privacy). Class contract kept from the õppevara-pood base so the pages and
   lib/admin.mjs markup keep working; palette + mood fully pink. */

:root {
  --bg: #fff0f6;
  --panel: #ffffff;
  --panel2: #ffe3f0;
  --ink: #4a2040;
  --muted: #b06a9e;
  --accent: #ff4fa3;
  --accent-soft: #ff87c0;
  --accent2: #3aa76d;
  --line: #ffc9e0;
  --warn: #f59e0b;
  --err: #e64980;
  --bg-glow: #ffb6d5;
  --header-bg: rgba(255,240,246,.85);
  --line-hover: #ff9ecb;
  --thumb-grad1: #ffd6ea;
  --thumb-grad2: #ffb6d5;
  --grad: linear-gradient(135deg, #ff4fa3, #ff8ec7);
  --font-display: "Comic Sans MS", "Segoe Print", "Marker Felt", ui-rounded, "Hiragino Maru Gothic ProN", -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 420px at 85% -8%, var(--bg-glow) 0%, transparent 62%),
    radial-gradient(700px 380px at -10% 108%, #ffd9ec 0%, transparent 58%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

/* ---- pixie dust (sparkles layer, injected by index.html JS) ---- */
#pixie { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
#pixie span { position: absolute; color: #ff9ecb; text-shadow: 0 0 6px rgba(255,158,203,.9);
  animation: twinkle var(--dur,3s) ease-in-out var(--delay,0s) infinite; will-change: opacity, transform; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(25deg); }
}

/* ---- header ---- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; border-bottom: 1px solid var(--line);
  background: var(--header-bg); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.2px;
  text-decoration: none; color: inherit; cursor: pointer; font-size: 17px;
  flex: 1 1 auto; min-width: 0; font-family: var(--font-display); }
.brand .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--grad);
  box-shadow: 0 0 10px rgba(255,79,163,.7); flex-shrink: 0; }
.brand .btext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.brand small { color: var(--muted); font-weight: 500; }
.topbar { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cart-btn { position: relative; cursor: pointer; border: 1px solid var(--line); background: var(--panel2);
  color: var(--ink); padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.cart-btn:hover { border-color: var(--accent); color: var(--accent); }
.cart-btn .count { position: absolute; top: -8px; right: -8px; background: var(--accent); color: #fff;
  border-radius: 999px; font-size: 12px; padding: 1px 7px; font-weight: 800; }
.seller-head { display: flex; align-items: center; gap: 8px; margin-left: 4px;
  padding-left: 14px; border-left: 1px solid var(--line); }
.seller-head a { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; color: var(--muted); text-decoration: none;
  background: var(--panel2); border: 1px solid var(--line); transition: color .12s, border-color .12s; }
.seller-head a:hover { color: var(--accent); border-color: var(--accent); }
.seller-head a svg { width: 18px; height: 18px; display: block; }

main { padding: 22px 26px 64px; position: relative; z-index: 2; }

/* ---- hero ---- */
.hero { text-align: center; padding: 30px 10px 10px; }
.hero h1 { font-family: var(--font-display); font-size: clamp(26px, 5vw, 40px); margin: 0 0 6px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin: 0; font-size: 15px; }
.hero .yarn { font-size: 26px; letter-spacing: .3em; }

/* ---- controls (search + sort) ---- */
.controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin: 18px auto 22px; max-width: 640px; }
.controls input[type=search] { flex: 1 1 220px; background: var(--panel); border: 1px solid var(--line);
  color: var(--ink); border-radius: 999px; padding: 10px 18px; font-size: 14px; }
.controls input[type=search]:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,79,163,.15); }
.controls select { background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 10px 14px; font-size: 14px; font-weight: 700; cursor: pointer; }
.controls select:focus { outline: none; border-color: var(--accent); }
.search-info { color: var(--muted); font-size: 14px; font-weight: 700; margin: 0 0 12px; text-align: center; }

/* ---- product grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--line-hover);
  box-shadow: 0 10px 24px rgba(255,79,163,.16); }
.card .thumb { aspect-ratio: 4 / 5; display: grid; place-items: center; font-size: 46px;
  background: linear-gradient(135deg, var(--thumb-grad1), var(--thumb-grad2)); position: relative; overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; background: var(--panel2); }
.thumb .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; background: var(--panel2); }
.card .body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 15.5px; color: var(--ink); }
.card .price { font-weight: 800; font-size: 18px; color: var(--accent); }
.card .add { margin-top: auto; background: var(--grad); border: none; color: #fff;
  padding: 10px; border-radius: 999px; cursor: pointer; font-weight: 800; font-size: 14px;
  box-shadow: 0 4px 12px rgba(255,79,163,.35); }
.card .add:hover { filter: brightness(1.07); }
.card .add.in { background: var(--panel2); border: 1px solid var(--line); color: var(--ink); box-shadow: none; }
.card .add.sold { background: var(--panel2); border: 1px dashed var(--line); color: var(--muted);
  cursor: not-allowed; box-shadow: none; }
.sold-tag { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.sold-badge { position: absolute; top: 10px; left: 10px; background: rgba(74,32,64,.75); color: #ffd6ea;
  font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; letter-spacing: .04em; }
.loadmore-wrap { display: flex; justify-content: center; padding: 24px 0 4px; }
.loadmore { background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  padding: 11px 26px; border-radius: 999px; font-weight: 800; font-size: 14px; cursor: pointer; }
.loadmore:hover { border-color: var(--accent); color: var(--accent); }

/* ---- basket drawer ---- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(74,32,64,.35); opacity: 0; pointer-events: none;
  transition: opacity .15s ease; z-index: 50; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: 390px; max-width: 94vw; background: var(--panel);
  border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .18s ease; z-index: 60;
  display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer h2 { margin: 0; padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex;
  justify-content: space-between; align-items: center; font-size: 17px; font-family: var(--font-display); }
.drawer h2 button { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.drawer .items { overflow-y: auto; padding: 12px 20px; flex: 1; }
.basket-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.basket-row .info { flex: 1; }
.basket-row .info .n { font-weight: 700; }
.basket-row .info .p { color: var(--muted); font-size: 13px; }
.basket-row .remove { color: var(--muted); cursor: pointer; background: none; border: none; font-size: 16px; }
.basket-row .remove:hover { color: var(--err); }
/* qty stepper (multi-stock items): [−] N [+] */
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel2); color: var(--ink); font-weight: 800; cursor: pointer; font-size: 15px; line-height: 1; }
.qty button:hover { border-color: var(--accent); color: var(--accent); }
.qty b { min-width: 22px; text-align: center; font-size: 15px; }
.drawer .foot { padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.drawer .total { display: flex; justify-content: space-between; font-size: 15px; font-weight: 600;
  margin: 7px 0; color: var(--ink); }
.drawer .total.grand { font-size: 19px; font-weight: 800; margin-bottom: 12px; }
.drawer .total .val { font-weight: 800; }
.drawer .total .val.free { color: var(--accent2); }
.drawer .total .val.fee { color: var(--muted); }
.pay { width: 100%; padding: 14px; border-radius: 999px; border: none; font-size: 16px; font-weight: 800;
  cursor: pointer; background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(255,79,163,.4); }
.pay:disabled { opacity: .5; cursor: not-allowed; }
.pay .lhv { display: inline-block; width: 30px; height: 18px; vertical-align: middle; margin-right: 8px;
  background: #0a3a8c; color: #fff; border-radius: 3px; font-size: 10px; line-height: 18px;
  text-align: center; font-weight: 800; }
.f-in { width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--ink); margin-bottom: 9px; font-size: 14px; }
.f-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,79,163,.13); }
.f-in::placeholder { color: #cf8fb8; }
.coupon-row { display: flex; gap: 8px; margin-top: 4px; }
.coupon-in { flex: 1 1 0; min-width: 0; background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  padding: 10px 12px; border-radius: 11px; font-size: 14px; text-transform: uppercase; letter-spacing: .03em; }
.coupon-in:focus { outline: none; border-color: var(--accent); }
.coupon-apply { flex-shrink: 0; white-space: nowrap; background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  padding: 0 16px; border-radius: 11px; font-weight: 800; cursor: pointer; font-size: 14px; }
.coupon-apply:hover { border-color: var(--accent); color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.coupon-chip { display: none; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 12px;
  background: rgba(58,167,109,.1); border: 1px solid rgba(58,167,109,.3); border-radius: 11px; font-size: 13px; }
.coupon-chip.show { display: flex; }
.coupon-chip.err { background: rgba(230,73,128,.1); border-color: rgba(230,73,128,.3); color: var(--err); }
.coupon-chip .x { margin-left: auto; background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; }
.total .subtotal { text-decoration: line-through; color: var(--muted); font-size: 13px; margin-right: 8px; }
.total .discount { color: var(--accent2); font-size: 13px; margin-right: 8px; font-weight: 700; }

/* ---- sticky mobile pay bar ---- */
.paybar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line);
  padding: 12px 16px; display: none; justify-content: space-between; align-items: center; z-index: 40;
  box-shadow: 0 -6px 20px rgba(255,79,163,.15); }
.paybar.show { display: flex; }
.paybar .pt { font-size: 13px; color: var(--muted); }
.paybar .pa { font-weight: 800; font-size: 18px; }
.paybar button { background: var(--grad); color: #fff; border: none; padding: 12px 22px;
  border-radius: 999px; font-weight: 800; cursor: pointer; }
@media (min-width: 720px) { .paybar { display: none !important; } }
@media (max-width: 719px) { main { padding-bottom: 84px; } }

/* ---- product modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(74,32,64,.55); display: none; align-items: center;
  justify-content: center; z-index: 60; padding: 18px; }
.modal-bg.open { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; max-width: 560px;
  width: 100%; max-height: 92vh; overflow: auto; display: flex; flex-direction: column; position: relative; }
.modal .x { position: absolute; top: 12px; right: 12px; z-index: 10; background: rgba(74,32,64,.6); color: #fff;
  border: none; width: 34px; height: 34px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.modal .mhead img { width: 100%; display: block; background: var(--panel2); }
.modal .mhead .ph { display: flex; align-items: center; justify-content: center; font-size: 64px;
  min-height: 240px; background: var(--panel2); }
.modal .mbody { padding: 18px 20px 22px; }
.modal .mbody h2 { margin: 0 0 4px; font-size: 21px; }
.modal .mbody .desc { color: var(--ink); line-height: 1.55; margin: 8px 0 14px; white-space: pre-wrap; font-size: 14.5px; }
.modal .mbody .price { font-weight: 800; font-size: 22px; margin-bottom: 14px; color: var(--accent); }
.modal .mbody .add { width: 100%; padding: 13px; border-radius: 999px; background: var(--grad); color: #fff;
  border: none; font-weight: 800; font-size: 15px; cursor: pointer; }
.modal .mbody .add.in { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); }
.modal .mbody .add.sold { background: var(--panel2); color: var(--muted); border: 1px dashed var(--line); cursor: not-allowed; }
.modal .btnrow { display: flex; gap: 10px; }
.modal .btnrow .add { flex: 1 1 auto; width: auto; }
.sharebtn { flex: 0 0 auto; width: 52px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line);
  color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sharebtn:hover { border-color: var(--accent); color: var(--accent); }
.sharebtn svg { width: 20px; height: 20px; }
.drawer h2 button.hbtn { font-size: 0; width: 44px; height: 44px; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 50%; vertical-align: middle; background: none; border: none; cursor: pointer; }
.drawer h2 button.hbtn:hover { color: var(--accent); background: var(--panel2); }
.drawer h2 button.hbtn svg { width: 19px; height: 19px; }

.cart-btn .cart-icon { display: none; width: 20px; height: 20px; vertical-align: -4px; }
@media (max-width: 560px) {
  header { padding: 12px 16px; } .brand { font-size: 15px; gap: 8px; } main { padding: 16px 16px 84px; }
  .cart-btn { padding: 8px 11px; } .cart-btn .cart-label { display: none; } .cart-btn .cart-icon { display: inline-block; }
}

/* ---- misc ---- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel);
  border: 1px solid var(--line); padding: 12px 18px; border-radius: 999px; z-index: 70; opacity: 0;
  transition: opacity .2s; pointer-events: none; box-shadow: 0 8px 22px rgba(255,79,163,.25); font-weight: 700; }
.toast.show { opacity: 1; }
.toast.err { border-color: var(--err); color: var(--err); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,79,163,.3);
  border-top-color: var(--accent); border-radius: 50%; animation: rot .7s linear infinite; vertical-align: middle; }
@keyframes rot { to { transform: rotate(360deg); } }
footer.site { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 10px 26px; position: relative; z-index: 2; }
footer.site a { color: var(--muted); }
