/* ==========================================================================
   DostavaApp — dizajn sistem

   Teme: svijetla je podrazumijevana, tamna se aktivira preko `data-theme="dark"`
   na <html>. Atribut postavlja inline skripta u <head> (pre prvog iscrtavanja),
   iz localStorage-a ili iz sistemske postavke. Zato postoji samo JEDAN tamni
   blok — nema duplirane palete koja može da se raziđe.

   Sve boje su izmjerene: svaki par tekst/pozadina prelazi 4.5:1 u obje teme
   (tests/ui-test.js to provjerava automatski).
   ========================================================================== */

:root {
  color-scheme: light;

  --bg:            #F1EFEC;   /* pozadina je sada osetno tamnija od kartica */
  --surface:       #FFFFFF;
  --surface-2:     #E7E3DE;
  --border:        #D8D3CC;
  --border-strong: #B5AEA5;

  --text:          #1C1917;   /* 17.5:1 na kartici */
  --text-muted:    #57534E;   /*  7.6:1 */
  --text-soft:     #6B635C;   /*  5.9:1 — brojači, placeholderi */

  --accent:        #AE3C0B;   /*  6.1:1 na kartici, 4.8:1 na surface-2 */
  --accent-hover:  #8C2F08;
  --on-accent:     #FFFFFF;   /*  6.1:1 na akcentu */
  --focus-ring:    rgba(174, 60, 11, .22);

  --success:       #15803D;
  --success-soft:  #E9FAEE;
  --warning:       #9A4A08;
  /* Sumnjiva narudžba — izmjereno: 6.5:1 na kartici, 5.1:1 na `--surface-2`. */
  --danger:        #B91C1C;

  /* Stepper ima svoje tokene jer stoji i na bijelom redu i na redu u korpi */
  --stepper-bg:    #FFFFFF;
  --stepper-btn:   #E7E3DE;
  /* Red u korpi. Odnos prema kartici je 1.20× — blaže od `--surface-2` (1.28×),
     ali dovoljno da se vidi: raniji #F6F3F0 je davao 1.10× i red se stapao sa
     podlogom, pa je akcentna traka lijevo bila jedini trag da je jelo u korpi. */
  --row-active:    #EFE9E3;
  /* Izdvojeno jelo: **blaže od reda u korpi** (1.10× prema kartici naspram
     1.20×). Korpa je stanje koje gost mijenja i mora da se vidi jače; izdvojeno
     je vlasnikov naglasak i samo prati zvjezdicu uz naziv. */
  --row-featured:  #F6F3F0;
  --field-bg:      #F4F1ED;   /* polja forme — da se vide na bijelom panelu */
  --toast-ok:      #4ADE80;   /* toast je invertovan: podloga mu je --text */
  --toast-warn:    #FBBF24;

  --overlay:       rgba(28, 25, 23, .45);
  --badge-bg:      rgba(28, 25, 23, .84);
  --badge-fg:      #FFFFFF;

  /* Placeholder „fotografije" — hue dolazi iz `--ph` na redu */
  --ph-s1: 55%; --ph-l1: 93%;
  --ph-s2: 48%; --ph-l2: 84%;

  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .07);
  --shadow:    0 2px 8px rgba(28, 25, 23, .07), 0 8px 24px rgba(28, 25, 23, .06);
  --shadow-lg: 0 16px 48px rgba(28, 25, 23, .20);

  /* Spacing */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-full: 999px;

  --header-h: 64px;
  --nav-h: 52px;

  --ease: cubic-bezier(.2, .8, .3, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #100E0C;   /* dublja pozadina da kartice „iskoče" */
  --surface:       #1E1B18;
  --surface-2:     #2C2723;
  --border:        #3B3531;
  --border-strong: #5A534C;

  --text:          #F6F3F0;   /* 15.5:1 na kartici */
  --text-muted:    #BCB3AB;   /*  8.3:1 */
  --text-soft:     #9A918A;   /*  5.5:1 */

  --accent:        #FF7A45;   /*  6.6:1 na kartici, 5.7:1 na surface-2 */
  --accent-hover:  #FF9268;
  --on-accent:     #2A1206;   /*  6.8:1 na akcentu — na svijetlom akcentu ide taman tekst */
  --focus-ring:    rgba(255, 122, 69, .28);

  --success:       #4ADE80;
  --success-soft:  #14291C;
  --warning:       #FBBF24;
  --danger:        #F87171;   /* 6.2:1 na kartici, 5.3:1 na `--surface-2` */

  /* Svjetlije od obje podloge reda — inače se pilula gubi u mraku */
  --stepper-bg:    #3A342F;
  --stepper-btn:   #1E1B18;
  /* Tamna tema stiska sve odnose: ovdje je i sam `--surface-2` samo 1.16×
     prema kartici, pa red u korpi ne može da bude 1.20× kao u svijetloj a da
     ostane blaži od čipa. 1.13× je isti udio te razlike (oko 80%). */
  --row-active:    #2A2523;
  --row-featured:  #262220;   /* 1.09× prema kartici — isti udio kao u svijetloj */
  --field-bg:      #272320;
  --toast-ok:      #15803D;
  --toast-warn:    #9A4A08;

  --overlay:       rgba(0, 0, 0, .68);
  --badge-bg:      rgba(0, 0, 0, .72);
  --badge-fg:      #F6F3F0;

  --ph-s1: 28%; --ph-l1: 21%;
  --ph-s2: 24%; --ph-l2: 14%;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow:    0 2px 8px rgba(0, 0, 0, .45), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .65);
}

/* ==========================================================================
   Font — lokalni Inter, podskup sa tačno onim znakovima koje aplikacija koristi
   (38 KB umjesto 132 KB za pune latin + latin-ext podskupove).
   Bez `unicode-range`: znak koji nedostaje pada na sistemski font iz stack-a.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter.woff2') format('woff2');
}

/* ==========================================================================
   Osnova
   ========================================================================== */

* { box-sizing: border-box; }

/* PRIVREMENO: Netlify ubacuje svoj badge preko sadržaja dok traje testiranje. */
#nl-badge-frame { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  touch-action: manipulation;   /* dvostruki tap ne zumira */
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}

h1, h2, h3, p, figure { margin: 0; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.price { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: var(--s4); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* ==========================================================================
   Dugmad
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5);
  border: 1px solid transparent; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text);
  font-size: 15px; font-weight: 600; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: background .18s var(--ease), transform .12s var(--ease), border-color .18s var(--ease);
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(.98); }

.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }

.btn--ghost { background: transparent; border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); }

.btn--block { width: 100%; }
.btn--lg { min-height: 52px; font-size: 16px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; flex: none;
  border: none; border-radius: var(--r-full);
  background: transparent; cursor: pointer;
  transition: background .18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }

/* Zatvaranje modala je najčešća radnja — dugme je veće i ima podlogu. */
.icon-btn--close {
  width: 52px; height: 52px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
}
.icon-btn--close:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ==========================================================================
   Header
   ========================================================================== */

.header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header__inner { height: 100%; display: flex; align-items: center; gap: var(--s3); min-width: 0; }

.brand { display: flex; align-items: center; min-height: 44px; gap: var(--s3); min-width: 0; text-decoration: none; color: inherit; }
.brand > span { min-width: 0; }
.brand__mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 18px;
}
.brand__name { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }

.header__spacer { flex: 1; }

.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--success); }
.status-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 0 3px var(--success-soft);
}

.cart-btn { position: relative; padding-inline: var(--s4); }
.cart-btn__count {
  position: absolute; top: -2px; right: -2px;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: none; place-items: center; border-radius: var(--r-full);
  background: var(--accent); color: var(--on-accent);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.cart-btn[data-count]:not([data-count="0"]) .cart-btn__count { display: grid; }

/* Prekidač teme: ikonica pokazuje temu na koju se prebacuje, ne trenutnu.
   U svijetloj temi stoji mjesec (klik → tamna), u tamnoj sunce (klik → svijetla). */
.theme-btn svg { display: block; }
.theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero { padding-block: var(--s5) var(--s4); }

.facts { display: flex; flex-wrap: wrap; gap: var(--s2); }
.fact {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px var(--s3);
  border: 1px solid var(--border); border-radius: var(--r-full);
  background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}
.fact strong { color: var(--text); font-weight: 600; }

/* Radno vrijeme: u headeru na desktopu, a među činjenicama na telefonu —
   uvijek tačno jedan primjerak na ekranu. */
.fact--status { display: none; }

.fact--prize { border-color: var(--accent); color: var(--accent); }
.fact--prize strong { color: var(--accent); }

.search { position: relative; margin-top: var(--s4); max-width: 420px; }
.search input {
  width: 100%; height: 48px; padding: 0 var(--s4) 0 44px;
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  background: var(--surface); color: var(--text); font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.search input::placeholder { color: var(--text-soft); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus-ring); }
.search__icon { position: absolute; left: var(--s4); top: 50%; transform: translateY(-50%); color: var(--text-soft); pointer-events: none; }

/* ==========================================================================
   Kategorije (sticky)
   ========================================================================== */

.catnav {
  position: sticky; top: var(--header-h); z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* Fade na krajevima govori da traka kategorija ima još sadržaja u stranu.
   Klase .is-start / .is-end postavlja JS prema poziciji skrola. */
.catnav::before,
.catnav::after {
  content: ""; position: absolute; top: 0; bottom: 1px; width: 40px;
  pointer-events: none; z-index: 2;
  opacity: 1; transition: opacity .2s var(--ease);
}
.catnav::before { left: 0;  background: linear-gradient(to right, var(--bg) 25%, transparent); }
.catnav::after  { right: 0; background: linear-gradient(to left,  var(--bg) 25%, transparent); }
.catnav.is-start::before { opacity: 0; }
.catnav.is-end::after    { opacity: 0; }
.catnav__scroll {
  display: flex; gap: var(--s2); min-height: var(--nav-h); align-items: center;
  /* Bez bočnog paddinga da traka i fade idu do same ivice; razmak od ivice
     nose prvi i posljednji čip, jer se container padding gubi pri skrolovanju. */
  padding-block: var(--s1); padding-inline: 0;
  overflow-x: auto; scrollbar-width: none;
  scroll-padding-inline: var(--s4);
}
.catnav__scroll::-webkit-scrollbar { display: none; }

.chip {
  position: relative; flex: none;
  padding: 7px var(--s4);
  border: 1px solid var(--border); border-radius: var(--r-full);
  background: var(--surface); color: var(--text-muted);
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
/* Vizuelno niži čip, ali pogodna površina ostaje 45px (WCAG 2.5.5).
   `inset` se mjeri od padding-boxa (bez 1px ivice), pa je -5px potrebno za 45px. */
.chip::after { content: ""; position: absolute; inset: -5px 0; }
.chip:first-child { margin-left: var(--s4); }
.chip:last-child { margin-right: var(--s4); }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ==========================================================================
   Meni — vertikalna lista horizontalnih redova
   ========================================================================== */

.layout { padding-block: var(--s6) var(--s8); display: grid; gap: var(--s6); align-items: start; }
.menu { min-width: 0; }

/* Korpa u koloni pored menija — vidljiva samo kad ima mjesta (≥1000px). */
.sidecart { display: none; }

@media (min-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; }

  .sidecart {
    display: flex; flex-direction: column;
    position: sticky; top: calc(var(--header-h) + var(--nav-h) + var(--s5));
    max-height: calc(100vh - var(--header-h) - var(--nav-h) - var(--s6));
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
}

.sidecart__head {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s4); border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 700;
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .3);
}
.sidecart__count {
  min-width: 24px; height: 24px; padding: 0 7px;
  display: grid; place-items: center; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-muted);
  font-size: 12px; font-weight: 700;
}
.sidecart__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s4); }
.sidecart__foot {
  position: relative; z-index: 1;
  padding: var(--s4); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px -6px rgba(0, 0, 0, .3);
}


.section { scroll-margin-top: calc(var(--header-h) + var(--nav-h) + 16px); }
.section + .section { margin-top: var(--s6); }

.section__head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s3); }
.section__title { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
/* Samo broj — „4 jela" ne valja za kategorije koje nisu jela (piće, prilozi). */
.section__count {
  min-width: 24px; height: 24px; padding: 0 7px;
  display: inline-grid; place-items: center; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-muted);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

.list {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ==========================================================================
   Red jela — tri varijante: sa fotografijom, sa ikonicom, bez slike
   ========================================================================== */

.row {
  position: relative;
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s4);
  transition: background .15s var(--ease);
}
/* Pretraga skriva redove, pa se ivica veže za prvog VIDLJIVOG prethodnika —
   sa `.row + .row` bi red iza skrivenog dobio ivicu bez ičega iznad sebe. */
.row:not([hidden]) ~ .row:not([hidden]) { border-top: 1px solid var(--border); }
/* Izdvojeno stoji PRIJE reda u korpi: kad jelo bude i jedno i drugo, korpa
   pobjeđuje podlogu (specifičnost `.row.is-in-cart` je viša), a zvjezdica
   ostaje — dva različita podatka, dva različita znaka. */
.row--izdvojeno { background: var(--row-featured); }
.row__zvijezda {
  color: var(--accent);
  font-size: 13px; line-height: 1;
  margin-right: 5px;
  /* Zvjezdica ne smije da pomjeri naziv sa osnovne linije. */
  vertical-align: 1px;
}

.row.is-in-cart { background: var(--row-active); box-shadow: inset 3px 0 0 var(--accent); }

/* --- varijanta: fotografija ---------------------------------------------- */
.row__media {
  width: 104px; aspect-ratio: 4 / 3; flex: none;
  display: grid; place-items: center; overflow: hidden;
  border-radius: var(--r); font-size: 34px;
  background: linear-gradient(150deg,
    hsl(var(--ph, 25) var(--ph-s1) var(--ph-l1)),
    hsl(var(--ph, 25) var(--ph-s2) var(--ph-l2)));
}
.row__media img { width: 100%; height: 100%; object-fit: contain; }

/* Slika se vidi cijela (`contain`), visoka je 60px i stoji na prozirnoj podlozi.
   Okvir ostaje fiksan 80×60 iako slika ne ispuni svaki piksel: da mu širina
   prati oblik slike, jela sa različitim proporcijama bi imala različito uvučen
   tekst i lijeva ivica liste bi se lomila iz reda u red. */
.row__media--photo {
  width: 80px; height: 60px; aspect-ratio: auto;
  background: none;
}
/* Mjere u pikselima, ne `height: 100%`: pločica je grid sa `place-items: center`,
   pa slika ne rasteže ćeliju i procenat se razrješava u `auto` — slika je onda
   zadržavala prirodnu visinu i bila odsječena po vrhu i dnu. */
.row__media--photo img { width: 80px; height: 60px; }

/* --- varijanta: ikonica --------------------------------------------------- */
.row--icon .row__media {
  width: 52px; aspect-ratio: 1; font-size: 26px;
  border-radius: 14px; background: var(--surface-2);
}
/* Slika u kategoriji sa ikonicama stoji u istom malom kvadratu — 80×60 pored
   ikonica od 52px bi lomilo lijevu ivicu teksta unutar iste kategorije. */
.row--icon .row__media--photo,
.row--icon .row__media--photo img { width: 52px; height: 52px; }

/* --- varijanta: bez slike ------------------------------------------------- */
/* nema .row__media — tekst počinje od ivice liste */

.row__body { flex: 1; min-width: 0; }
.row__title { font-size: 17px; font-weight: 650; line-height: 1.15; letter-spacing: -.01em; }

/* Naslov je dugme čija se pogodna površina rasteže preko cijelog reda — tastatura
   dobija pravu metu, miš može da klikne bilo gdje po redu. */
.row__open {
  all: unset;
  cursor: pointer;
  font: inherit; color: inherit;
}
.row__open::after { content: ""; position: absolute; inset: 0; }
.row__open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-sm); }

/* Kontrola mora da bude iznad rastegnutog dugmeta da bi „+" bio klikabilan. */
.row__ctrl { position: relative; z-index: 1; }
.row__desc {
  margin-top: 3px;
  font-size: 14px; color: var(--text-muted); line-height: 1.1;
  min-width: 0; overflow-wrap: anywhere;   /* opis se prikazuje cio, bez skraćivanja */
}

.row__meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); margin-top: 6px; }
.row__price { font-size: 15px; font-weight: 700; color: var(--accent); }
.row__price small { font-size: 12px; font-weight: 600; color: var(--text-soft); margin-right: 3px; }

.row__ctrl { flex: none; display: flex; align-items: center; gap: var(--s2); }
.row:has(.row__open:hover) { background: var(--surface-2); }

.tag { padding: 3px 8px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-muted); font-size: 11px; font-weight: 600; }
.row:hover .tag { background: var(--border); }

.tag--veg {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--success-soft); color: var(--success);
}

.tag--badge {
  background: transparent; color: var(--accent);
  border: 1px solid currentColor;
  letter-spacing: .04em; text-transform: uppercase;
}
.row:hover .tag--badge { background: transparent; }

/* Nagoveštaj da jelo ima opcije */
.row__opts { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-soft); }
.row__opts-short { display: none; }

/* Dugme + / stepper */
.add-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; flex: none;
  border: none; border-radius: var(--r-full);
  background: var(--text); color: var(--bg); cursor: pointer;
  transition: background .18s var(--ease), transform .12s var(--ease);
}
.add-btn:hover { background: var(--accent); color: var(--on-accent); }
.add-btn:active { transform: scale(.9); }

/* Stepper ima svoje tokene: u svijetloj temi pilula je bijela sa sivim dugmadima,
   u tamnoj je svjetlija od obje podloge reda — inače se gubi u mraku. */
.stepper {
  display: inline-flex; align-items: center; gap: 2px; flex: none;
  padding: 3px; border-radius: var(--r-full);
  background: var(--stepper-bg); border: 1px solid var(--border-strong);
}
.stepper button {
  position: relative;
  width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center;
  border: none; border-radius: var(--r-full);
  background: var(--stepper-btn); color: var(--accent);
  cursor: pointer;
  transition: transform .12s var(--ease), background .15s var(--ease);
}
/* Dugme je vizuelno 36px, ali pogodna površina ostaje 44px (WCAG 2.5.5).
   Širi se za 4px na sve strane — između dugmadi stoji brojač, pa se mete ne preklapaju. */
.stepper button::after { content: ""; position: absolute; inset: -4px; }
.stepper button:hover { background: var(--border); }
.stepper button:active { transform: scale(.9); }
.stepper__qty { min-width: 28px; text-align: center; font-size: 15px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* Koliko je u korpi stoji kao oznaka u ćošku dugmeta „+", a ne kao zasebna
   pilula koja jede širinu reda. */
.in-cart-chip {
  position: absolute; top: -5px; right: -5px; z-index: 1;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-full);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent);
  border: 2px solid var(--surface);
  font-size: 11px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
}
.row.is-in-cart .in-cart-chip { border-color: var(--row-active); }

.empty-search { padding: var(--s7) var(--s4); text-align: center; color: var(--text-muted); }

/* ==========================================================================
   Modalni slojevi (korpa i konfigurator jela)
   ========================================================================== */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: var(--overlay);
  opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.overlay--sheet { z-index: 65; }

/* --- korpa / checkout ----------------------------------------------------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(430px, 100%);
  display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .3s var(--ease);
}
.drawer.is-open { transform: none; }

/* Zatvoreni modal je i dalje u DOM-u. Na desktopu konfigurator stoji na sredini
   ekrana sa `opacity: 0` i bez ovoga bi hvatao klikove namenjene sadržaju ispod. */
.drawer:not(.is-open),
.sheet:not(.is-open) { pointer-events: none; }

.drawer__head {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s4); border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .3);
}
.drawer__title { font-size: 17px; font-weight: 700; flex: 1; }
.drawer__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: var(--s4); }
.drawer__foot {
  position: relative; z-index: 1;
  padding: var(--s4); border-top: 1px solid var(--border); background: var(--surface);
  box-shadow: 0 -4px 12px -6px rgba(0, 0, 0, .3);
}

/* --- konfigurator jela ---------------------------------------------------- */
.sheet {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: 0;
  max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(101%); transition: transform .3s var(--ease);
}
.sheet.is-open { transform: none; }

.sheet__head {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .3);
}
.sheet__title { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; }
.sheet__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.sheet__foot {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4); padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px -6px rgba(0, 0, 0, .3);
}
.sheet__foot .btn { flex: 1; }

.sheet__intro { padding: var(--s4); }
.sheet__desc { color: var(--text-muted); font-size: 14px; }

.group { padding: var(--s4); border-top: 1px solid var(--border); }
.group__head { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s3); }
.group__name { font-size: 15px; font-weight: 700; }
.group__hint { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.group__req { padding: 2px 8px; border-radius: var(--r-full); border: 1px solid currentColor; color: var(--accent); font-size: 11px; font-weight: 700; }

.opt { position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: var(--s2) 0; cursor: pointer; }
.opt + .opt { border-top: 1px solid var(--border); }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt__box {
  width: 24px; height: 24px; flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.opt--single .opt__box { border-radius: 50%; }
.opt--multi .opt__box { border-radius: 7px; }

.opt__box::after { content: ""; opacity: 0; transition: opacity .15s var(--ease); }
.opt--single .opt__box::after {
  width: 10px; height: 10px; border-radius: 50%; background: var(--on-accent);
}
/* Kvačica: rotacija ide POSLE pomeranja, inače se pomera po zarotiranim osama i beži iz kvadrata. */
.opt--multi .opt__box::after {
  width: 11px; height: 6px;
  border-left: 2px solid var(--on-accent);
  border-bottom: 2px solid var(--on-accent);
  transform: translateY(-1.5px) rotate(-45deg);
}
.opt input:checked + .opt__box { border-color: var(--accent); background: var(--accent); }
.opt input:checked + .opt__box::after { opacity: 1; }
.opt input:focus-visible + .opt__box { outline: 2px solid var(--accent); outline-offset: 3px; }
.opt input:disabled ~ .opt__name { color: var(--text-soft); }
.opt:has(input:disabled) { cursor: not-allowed; }

.opt__name { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.opt__price { font-size: 14px; font-weight: 700; color: var(--text-muted); }
.opt__free { padding: 3px 9px; border-radius: var(--r-full); background: var(--success-soft); color: var(--success); font-size: 12px; font-weight: 700; }

/* Poseban zahtjev uz jelo — nije grupa opcija, pa ima svoju klasu */
.note { padding: var(--s4); border-top: 1px solid var(--border); }
.note__ask { font-size: 14px; color: var(--text-muted); }
.note__open {
  padding: 4px 0; border: 0; background: none;
  color: var(--accent); font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}
.note__open:hover { color: var(--accent-hover); }
.note__input {
  width: 100%; padding: 12px var(--s4);
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  background: var(--field-bg); color: var(--text);
  font-family: inherit; font-size: 15px;
}
.note__input::placeholder { color: var(--text-soft); }
.note__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus-ring); }

/* ==========================================================================
   Grebalica — nagradna kartica poslije veće narudžbe
   ========================================================================== */

.overlay--scratch { z-index: 85; }

.scratch {
  position: fixed; z-index: 90; left: 50%; top: 50%;
  width: min(360px, calc(100vw - 32px));
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  /* Bez `scale` u tranziciji: skaliranje bi pomjerilo koordinate grebanja. */
  transform: translate(-50%, calc(-50% + 10px)); opacity: 0;
  pointer-events: none;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.scratch.is-open { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }

.scratch__head { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); }
.scratch__title { flex: 1; font-size: 17px; font-weight: 700; }

.scratch__card {
  position: relative; margin: 0 var(--s4);
  aspect-ratio: 320 / 200; border-radius: var(--r); overflow: hidden;
  background: var(--surface-2);
}
.scratch__prize { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Srebrni sloj preko nagrade — `touch-action: none` da grebanje ne skroluje stranicu. */
.scratch__cover {
  position: absolute; inset: 0; width: 100%; height: 100%;
  touch-action: none; cursor: grab;
  transition: opacity .35s var(--ease);
}
.scratch__cover:active { cursor: grabbing; }
.scratch__cover.is-gone { opacity: 0; pointer-events: none; }

.scratch__result { padding: var(--s4) var(--s4) 0; text-align: center; min-height: 74px; }
.scratch__won { font-size: 17px; }
.scratch__hint { margin-top: var(--s2); font-size: 13px; color: var(--text-muted); }
.scratch__foot { padding: var(--s4); }

/* Nagrada na ekranu potvrde */
.done__prize {
  display: flex; align-items: center; gap: var(--s3);
  margin-top: var(--s5); padding: var(--s3);
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface-2); text-align: left;
}
.done__prize img { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.done__prize strong { display: block; font-size: 14px; }
.done__prize span { font-size: 12px; color: var(--text-muted); }

/* ==========================================================================
   Stavke u korpi
   ========================================================================== */

.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; }
.line + .line { border-top: 1px solid var(--border); }
.line__name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.line__opts { margin-top: 2px; font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.line__note { margin-top: 2px; font-size: 12px; color: var(--accent); line-height: 1.35; }
.line__price { margin-top: 4px; display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.line__total { font-size: 15px; font-weight: 700; }
.line__unit { font-size: 12px; color: var(--text-soft); }
.line__ctrl { display: flex; align-items: center; gap: var(--s3); }

/* Dostava stoji kao posljednja stavka u korpi, bez kontrola za količinu. */
.line--delivery { color: var(--text-muted); }
.line--delivery .line__name { font-weight: 600; }
.line--delivery .line__total { font-weight: 600; }

.cart-empty { text-align: center; padding: var(--s8) var(--s4); color: var(--text-muted); }
.cart-empty__icon { font-size: 44px; margin-bottom: var(--s3); opacity: .55; }

.sum { display: grid; gap: var(--s2); margin-bottom: var(--s4); font-size: 14px; }
.sum__row { display: flex; justify-content: space-between; color: var(--text-muted); }
.sum__row--total { color: var(--text); font-size: 18px; font-weight: 700; }
.sum__row + .sum__row--total { padding-top: var(--s3); border-top: 1px solid var(--border); }
.sum__note { padding: var(--s3); border-radius: var(--r); background: var(--surface-2); border-left: 3px solid var(--warning); color: var(--warning); font-size: 13px; font-weight: 600; }

/* ==========================================================================
   Checkout forma
   ========================================================================== */

.field { margin-bottom: var(--s4); }
.field__label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field select {
  width: 100%; padding: 12px var(--s4);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--field-bg); color: var(--text);
  font-family: inherit; font-size: 15px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus-ring); }

.field input, .field textarea {
  width: 100%; padding: 12px var(--s4);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--field-bg); color: var(--text);
  font-family: inherit; font-size: 15px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field textarea { min-height: 76px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-soft); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus-ring); }

.segments { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.segment { position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segment span {
  display: flex; flex-direction: column; gap: 2px; min-height: 44px; justify-content: center;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}
.segment input:checked + span { border-color: var(--accent); background: var(--surface-2); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.segment input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Potvrda
   ========================================================================== */

.done { text-align: center; padding: var(--s7) var(--s4); }
.done__icon { width: 64px; height: 64px; margin: 0 auto var(--s4); display: grid; place-items: center; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 30px; }
.done__title { font-size: 20px; font-weight: 700; }
.done__text { margin-top: var(--s2); color: var(--text-muted); font-size: 14px; }
.done__code { display: inline-block; margin: var(--s5) 0; padding: var(--s3) var(--s5); border-radius: var(--r); background: var(--surface-2); font-size: 24px; font-weight: 700; letter-spacing: .06em; }

/* ==========================================================================
   Mobilna traka korpe / toast / footer
   ========================================================================== */

.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
  transform: translateY(120%); transition: transform .28s var(--ease);
}
.cartbar.is-visible { transform: none; }
.cartbar .btn { justify-content: space-between; padding-inline: var(--s5); }
.cartbar__label { display: inline-flex; align-items: center; gap: var(--s2); }
.cartbar__count {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-grid; place-items: center; border-radius: var(--r-full);
  background: color-mix(in srgb, var(--on-accent) 22%, transparent); color: var(--on-accent);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

.toast {
  position: fixed; left: 50%; bottom: 96px; z-index: 80;
  width: max-content; max-width: calc(100% - 2 * var(--s4));
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: var(--s3) var(--s5); border-radius: var(--r-full);
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transform: translate(-50%, 20px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast svg { flex: none; }
.toast--ok svg { color: var(--toast-ok); }
.toast--warn svg { color: var(--toast-warn); }

.footer { padding-block: var(--s6) calc(var(--s8) + 60px); border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px; }
.footer__inner { display: flex; justify-content: center; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
  body { overflow-x: hidden; }
  .status-dot { display: none; }
  .fact--status { display: inline-flex; }
  .fact--status .status-dot { display: inline-flex; }
  .hero { padding-block: var(--s4); }
  .row { gap: var(--s3); padding: var(--s3); align-items: flex-start; }
  .row__media { width: 76px; }
  .row--icon .row__media { width: 46px; }
  .row__media--photo { width: 80px; }   /* slika ostaje 80×60 i na telefonu */
  .row__desc { font-size: 13px; }
  .row__ctrl { align-self: center; }
  /* Na uskom ekranu meta mora da stane u jedan-dva reda: bez opisnih tagova, kratak nagoveštaj opcija. */
  .row__meta .tag:not(.tag--veg):not(.tag--badge) { display: none; }
  .row__opts-full { display: none; }
  .row__opts-short { display: inline; }
  /* Tekst „Korpa" se skriva vizuelno, ali NE iz stabla pristupačnosti —
     sa `display: none` dugme ostaje bez imena za čitače ekrana. */
  .header .cart-btn span:not(.cart-btn__count) {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .sheet { max-height: 88vh; }
}

@media (min-width: 641px) {
  .cartbar { display: none; }
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    width: min(520px, 92vw); max-height: 86vh;
    border-radius: var(--r-lg);
    transform: translate(-50%, -46%) scale(.97); opacity: 0;
    transition: transform .25s var(--ease), opacity .25s var(--ease);
  }
  .sheet.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Kad je logo postavljen, znak u zaglavlju ne dobija akcentnu podlogu — logo
   nosi svoju boju, a narandžasti kvadrat ispod njega bi je gušio. */
.brand__mark--logo { background: transparent; padding: 0; overflow: hidden; }
.brand__mark--logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
