/* Model lista de cumparaturi: culorile temei Dark din calculator (aceleasi nume de variabile, ca piesele sa se poata
   muta intre aplicatii), masurile pentru telefon (aerisit, pentru deget) si pentru PC (strans, ca in Word).
   Toate miscarile: 0,15-0,35 s; fara ele la "mai putine animatii". */
@font-face {
  font-family: 'Noto Sans';
  src: url('../fonts/NotoSans-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #0f222b;               /* fundalul */
  --panel: #16323d;            /* ferestrele, bara de jos */
  --key: #1b3946;              /* butoanele mici (chips) */
  --card: #1d3f4c;             /* randurile listei, cardurile */
  --sunken: #132b35;           /* campurile, desenul traseului */
  --btn: #2a5f70;              /* butoanele secundare */
  --btn-down: #377588;         /* butonul secundar apasat */
  --line: #27444f;             /* liniile (decor) */
  --field-border: #5890a2;     /* chenarul campurilor */
  --text: #e3edf1;             /* textul */
  --text-strong: #ffffff;      /* titlurile */
  --text-2: #b9d3dc;           /* textul secundar deschis */
  --muted: #8babb6;            /* textul estompat */
  --icon: #86aebe;             /* iconitele */
  --faint: #3a5f6c;            /* liniile ajutatoare */
  --accent: #f5c542;           /* galbenul temei: bifa, butonul principal */
  --on-accent: #0f222b;        /* textul de pe galben */
  --accent-soft: #cead44;      /* galbenul stins */
  --accent-tint: rgba(245, 197, 66, .16);
  --result: #6ab8ff;           /* albastrul: traseul, "am luat altceva" */
  --clear: #ff7d72;            /* rosul: sterge, "nu era" */
  --ok: #7bd389;               /* verdele: inceputul traseului, precizie buna */
  --divider: rgba(227, 237, 241, .09); /* linia subtire dintre produse */

  /* masurile: telefonul (aerisit) */
  --gut: 16px;                 /* marginea din stanga si dreapta */
  --row-h: 52px;               /* inaltimea unui produs */
  --pad: 12px;                 /* marginea din interiorul randului */
  --gap: 10px;
  --fs: 16px;
  --fs-small: 13px;
  --fs-h1: 20px;
  --ico: 24px;
  --btn-h: 44px;               /* butoanele: cel putin 44 px pentru deget */
  --radius: 12px;
  --chk: 26px;                 /* cercul bifei */
  --top-h: 56px;
}
/* PC (mouse): strans, ca in Word */
@media (min-width: 900px) and (pointer: fine) {
  :root {
    --gut: 12px;
    --row-h: 28px;
    --pad: 8px;
    --gap: 6px;
    --fs: 14px;
    --fs-small: 12px;
    --fs-h1: 16px;
    --ico: 18px;
    --btn-h: 28px;
    --radius: 6px;
    --chk: 16px;
    --top-h: 40px;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs)/1.4 'Noto Sans', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
p { margin: 0 0 6px; }
p:last-child { margin-bottom: 0; }
ul { margin: 4px 0 8px; padding-left: 20px; }
.small { font-size: var(--fs-small); }
.muted { color: var(--muted); }
.warn { color: var(--clear); }

.ico { width: var(--ico); height: var(--ico); flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.ico-more { stroke-width: 3; }
.ico-play { fill: currentColor; stroke-width: 1.5; }

/* ---- pagina ---- */
.view {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gut) calc(110px + env(safe-area-inset-bottom));
  animation: viewIn .22s ease-out;
}
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: var(--top-h);
  margin: 0 calc(-1 * var(--gut)) 8px;
  padding: 0 var(--gut);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-h1);
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top h1.editable { cursor: text; }
.top-acts { display: flex; gap: 2px; }

/* butoanele */
.ib {
  width: var(--btn-h);
  height: var(--btn-h);
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--icon);
  cursor: pointer;
  transition: background .15s;
}
.ib:hover { background: var(--key); }
.btn {
  min-height: var(--btn-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--btn);
  color: var(--text-strong);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, filter .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--btn-down); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn.danger { background: transparent; border-color: var(--clear); color: var(--clear); }
.btn.plain { background: transparent; color: var(--text-2); }
.btn.small { min-height: calc(var(--btn-h) - 8px); padding: 0 10px; font-size: var(--fs-small); }
button.pressing { filter: brightness(1.3); }

/* notele */
.note {
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sunken);
  color: var(--text-2);
}
.note.guest { border-color: var(--result); }
.note.warn { border-color: var(--clear); color: var(--text); }
.foot { margin: 24px 0 0; text-align: center; color: var(--muted); font-size: var(--fs-small); }
.empty { margin: 12px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; color: var(--muted); }

/* cardurile (listele, cursele) */
.cards { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 8px 0; }
@media (min-width: 600px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) and (pointer: fine) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
}
.card {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.card:hover { border-color: var(--field-border); }
.card h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 4px; font-size: calc(var(--fs) + 1px);
  font-weight: 600; color: var(--text-strong); }
.card .meta { display: flex; flex-direction: column; gap: 1px; color: var(--muted); font-size: var(--fs-small); }
.card.new { display: flex; align-items: center; gap: 8px; border: 1px dashed var(--field-border); background: transparent;
  color: var(--accent); font-weight: 600; min-height: 64px; }
@media (min-width: 900px) and (pointer: fine) { .card { padding: 8px 10px; } .card.new { min-height: 40px; } }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 999px; background: var(--accent-tint);
  color: var(--accent); font-size: var(--fs-small); font-weight: 400; width: fit-content; }
.tag .ico { width: 14px; height: 14px; }
.tag.sim { background: var(--key); color: var(--text-2); }
.tag.on { background: rgba(123, 211, 137, .16); color: var(--ok); }

.sec-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 16px 0 6px;
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.sec-title .n { font-weight: 400; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* ---- lista: doua coloane pe ecran lat ---- */
.layout { display: block; }
.side { display: none; }
@media (min-width: 760px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
  .side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: calc(var(--top-h) + 10px); }
  .acts-row { display: none !important; }
}
@media (min-width: 900px) and (pointer: fine) {
  .layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; }
  .side { gap: 6px; }
}
.panel { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sunken); }
.panel h3 { margin: 0 0 4px; font-size: var(--fs); color: var(--text-strong); }
.panel .btn { margin-top: 8px; width: 100%; }
@media (min-width: 900px) and (pointer: fine) { .panel { padding: 8px; } }
.link-row { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 0; border: 0;
  border-top: 1px solid var(--line); background: none; cursor: pointer; text-align: left; font-size: var(--fs-small); }
.link-row:hover { color: var(--accent); }

.acts-row { display: flex; gap: 8px; margin: 4px 0 6px; }
.acts-row .btn { flex: 1; }
.acts-row:empty { display: none; }

/* randurile listei */
.rows { position: relative; }
/* produsele unui grup stau lipite, intr-un singur bloc, cu o linie subtire intre ele (cerinta lui Razvan, 16.11.2026:
   fara golurile prin care se vedea fundalul). Linia incepe dupa cercul bifei; ultimul produs din grup nu are linie. */
.row {
  display: flex;
  align-items: center;
  gap: var(--gap);
  min-height: var(--row-h);
  margin: 0;
  padding: 4px 4px 4px var(--pad);
  border-radius: 0;
  background-color: transparent; /* culoarea fundalului paginii (cerinta lui Razvan, 16.11.2026) */
  background-image: linear-gradient(var(--divider), var(--divider));
  background-size: calc(100% - var(--pad) - var(--chk) - var(--gap)) 1px;
  background-position: right bottom;
  background-repeat: no-repeat;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  overflow: hidden;
  transition: background-color .2s;
}
.sec-title + .row { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.row:last-child, .row:has(+ :not(.row)) { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
  background-image: none; }
@media (min-width: 900px) and (pointer: fine) { .row { padding: 1px 2px 1px var(--pad); } .row:hover { background-color: rgba(227, 237, 241, .04); } }
.sync-line { margin: 4px 0; color: var(--clear); font-size: var(--fs-small); }
.row .chk {
  width: var(--chk);
  height: var(--chk);
  flex: none;
  display: grid;
  place-items: center;
  border: 2px solid var(--field-border);
  border-radius: 50%;
  color: var(--on-accent);
  transition: background .2s, border-color .2s;
}
.row .chk .ico { width: calc(var(--chk) - 6px); height: calc(var(--chk) - 6px); stroke-width: 3; }
.row .chk .ico path { stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .25s ease-out; }
.row.taken .chk { background: var(--accent); border-color: var(--accent); }
.row.other .chk { background: var(--result); border-color: var(--result); }
.row.missing .chk { border-color: var(--clear); color: var(--clear); }
.row.taken .chk .ico path, .row.other .chk .ico path, .row.missing .chk .ico path { stroke-dashoffset: 0; }
.row .name { flex: 1; min-width: 0; padding: 2px 0; }
.row .nm { overflow-wrap: anywhere; }
.row .qty { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; background: var(--accent-tint);
  color: var(--accent); font-size: var(--fs-small); vertical-align: 1px; }
.row .sub { color: var(--muted); font-size: var(--fs-small); }
.row.taken .nm > span:first-child, .row.other .nm > span:first-child { color: var(--muted); text-decoration: line-through;
  text-decoration-color: var(--faint); }
.row.taken, .row.other { background-color: transparent; }
.row.missing .nm > span:first-child { color: var(--text-2); }
.row .more { width: 40px; height: 40px; color: var(--muted); }
@media (min-width: 900px) and (pointer: fine) { .row .more { width: 24px; height: 24px; } }
.dot { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; color: #0f222b;
  font-size: 11px; font-weight: 700; }
@media (min-width: 900px) and (pointer: fine) { .dot { width: 18px; height: 18px; font-size: 10px; } }
.empty-row { padding: 10px var(--pad); color: var(--muted); font-size: var(--fs-small); }

/* campul de adaugat: jos pe telefon (la indemana degetului mare), in coloana pe ecran lat */
.addbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 10px var(--gut) calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.addbar .in { display: flex; align-items: flex-end; gap: 8px; max-width: 1200px; margin: 0 auto; }
.addbar textarea {
  flex: 1;
  min-width: 0;
  min-height: var(--btn-h);
  max-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--sunken);
  resize: none;
  overflow-y: hidden;
  line-height: 1.35;
}
.addbar textarea::placeholder { color: var(--muted); }
.addbar .add { padding: 0 14px; }
@media (max-width: 420px) { .addbar .add .lbl { display: none; } .addbar .add { width: var(--btn-h); padding: 0; } }
@media (min-width: 760px) {
  .addbar { position: sticky; bottom: 0; margin: 10px 0 0; padding: 8px 0 10px; border: 0; background: var(--bg); }
}
@media (min-width: 900px) and (pointer: fine) { .addbar textarea { padding: 4px 8px; } }

/* bara cursei pornite */
.trip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius);
  background: var(--accent-tint);
  animation: viewIn .25s ease-out;
}
.trip .live { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--ok); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.trip .t-main { flex: 1; min-width: 0; }
.trip .t-title { font-weight: 600; color: var(--text-strong); }
.trip .t-sub { color: var(--text-2); font-size: var(--fs-small); }

/* ---- fereastra: de jos pe telefon, in mijloc pe ecran lat ---- */
.sheet-back { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .22s; }
.sheet-back.in { opacity: 1; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  max-height: 88vh;
  overflow: auto;
  padding: 16px var(--gut) calc(16px + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--panel);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .35);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.sheet.in { transform: none; }
.sheet h2 { margin: 0 0 10px; font-size: calc(var(--fs) + 2px); color: var(--text-strong); overflow-wrap: anywhere; }
.sheet .acts { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.sheet .acts .btn { width: 100%; justify-content: flex-start; }
.sheet .acts .btn.primary { justify-content: center; }
@media (min-width: 760px) {
  .sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(460px, 92vw);
    border-radius: 12px;
    opacity: 0;
    transform: translate(-50%, -46%) scale(.98);
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), opacity .2s;
  }
  .sheet.in { opacity: 1; transform: translate(-50%, -50%); }
}
@media (min-width: 900px) and (pointer: fine) {
  .sheet { padding: 12px 14px; width: min(400px, 92vw); }
  .sheet .acts { gap: 4px; margin-top: 10px; }
}
.field { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.field > span { color: var(--text-2); font-size: var(--fs-small); }
.field input, .linkbox {
  width: 100%;
  min-height: var(--btn-h);
  padding: 8px 12px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--sunken);
}
.linkbox { margin: 8px 0; color: var(--text-2); font-size: var(--fs-small); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--key);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (min-width: 900px) and (pointer: fine) { .chip { min-height: 24px; padding: 0 8px; font-size: var(--fs-small); } }
.near { margin: 6px 0; }

/* ---- bara de jos: Undo si mesajele scurte ---- */
.bar {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 6px 8px 6px 14px;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  background: var(--key);
  color: var(--accent);
  font-size: var(--fs-small);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .22s, transform .22s, color .3s, border-color .3s;
}
.bar.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.bar.fresh { font-weight: 700; }
.bar.faded { opacity: .6; color: var(--text-2); border-color: var(--line); }
.bar button { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 8px; border: 0;
  border-radius: 999px; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; }
.bar button .ico { width: 16px; height: 16px; }
@media (min-width: 760px) { .bar { bottom: 20px; } }

/* ---- datele unei curse ---- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 900px) and (pointer: fine) { .stats { gap: 4px; } }
.stat { padding: 8px 12px; border-radius: var(--radius); background: var(--card); }
@media (min-width: 900px) and (pointer: fine) { .stat { padding: 4px 8px; } }
.stat .k { color: var(--muted); font-size: var(--fs-small); }
.stat .v { margin-top: 2px; color: var(--text-strong); font-size: calc(var(--fs) + 1px); font-weight: 600; }
.stat .v.good { color: var(--ok); }
.stat .v.warn { color: var(--clear); }
.trip-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 900px) { .trip-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; } }
.trace-wrap { padding: 6px; border-radius: var(--radius); background: var(--sunken); }
.trace-wrap svg { display: block; width: 100%; height: auto; max-height: 72vh; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 0; padding: 0; list-style: none; color: var(--muted);
  font-size: var(--fs-small); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 50%; vertical-align: -1px; }
.lg-track { background: var(--result); border-radius: 2px !important; height: 3px !important; width: 14px !important; vertical-align: 2px !important; }
.lg-start { background: var(--ok); }
.lg-end { background: var(--clear); }
.lg-mark { background: var(--accent); }
.lg-burst { background: var(--muted); }
.lg-store { border: 1.5px solid var(--text-2); border-radius: 1px !important; }
.events { display: flex; flex-direction: column; }
.ev { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ev-n { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent);
  color: var(--on-accent); font-size: 12px; font-weight: 700; }
.ev-n.none { background: var(--key); color: var(--muted); }
.ev.burst .ev-n { background: var(--muted); }
.ev.undone { opacity: .6; }
.ev-main { flex: 1; min-width: 0; }
.ev-name { display: flex; justify-content: space-between; gap: 8px; }
.ev-state { color: var(--muted); font-size: var(--fs-small); white-space: nowrap; }
.ev-sub { color: var(--muted); font-size: var(--fs-small); }
@media (min-width: 900px) and (pointer: fine) { .ev { padding: 3px 0; } .ev-n { width: 20px; height: 20px; font-size: 11px; } }

/* "mai putine animatii" cerut in telefon */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
