/* Бебешки списък: спокоен, светъл, мобилен първо. Цветовете са от точка 7 на плана. */

/* Nunito (лиценз SIL OFL 1.1, виж fonts/OFL-LICENSE.txt), локално копие от
   @fontsource-variable/nunito 5.1.0. Един файл покрива дебелини 200–1000. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("fonts/nunito-cyrillic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("fonts/nunito-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #F7F5F0;
  --card: #FFFFFF;
  --line: #E6E2D9;
  --field-line: #D9D4C8;
  --ink: #26302B;
  --ink-2: #3A453F;
  --muted: #5F6B64;
  --accent: #3F6F5C;
  --accent-ink: #FFFFFF;
  --accent-soft: #E4EEE9;
  --accent-dark: #2F5848;
  --track: #E9E5DB;
  --track-soft: #C9DCD2;
  --fill2: #A9C9BA;
  --panel: #EFEBE2;

  --reserved-bg: #FBF4E4;
  --reserved-line: #EBDDB8;
  --reserved-ink: #6B4A0A;
  --reserved-thumb: #F3E5BF;
  --bought-bg: #EEF3F0;
  --bought-line: #CFE0D7;
  --bought-ink: #2F5848;
  --bought-thumb: #D6E7DE;
  --needed-bg: #FBEFD9;
  --needed-ink: #7A4E0B;
  --danger: #A63D2F;
  --danger-soft: #F8E5E1;

  --r-card: 16px;
  --r-ctl: 12px;
  --focus: #8FB8A5;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a { color: var(--accent); font-weight: 700; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1 { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.15; }
h2 { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.25; }

.icon { flex: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* Без JavaScript тези елементи не се показват (app.js добавя клас js на <html>). */
.js-only { display: none !important; }
.js .js-only { display: inline-flex !important; }

/* --- Горна лента ------------------------------------------------------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  max-width: 680px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav { display: flex; align-items: center; gap: 14px; }
.nav a { font-size: 14px; text-decoration: none; min-height: 44px; display: flex; align-items: center; }

.nav-btn {
  background: none;
  border: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 4px;
  min-height: 44px;
  cursor: pointer;
  text-align: right;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 4px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Заглавия на страници --------------------------------------------- */

.page-head { display: flex; flex-direction: column; gap: 6px; }
.sub { margin: 0; font-size: 15px; color: var(--muted); }

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  align-self: flex-start;
  font-size: 15px;
  text-decoration: none;
}

/* --- Карти и панели ---------------------------------------------------- */

.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-wrap: anywhere;
}
.panel { background: var(--panel); border-color: transparent; }
.card.narrow { width: 100%; max-width: 420px; margin: 16px auto 0; }

/* Лента за прогрес (SVG) */
.bar { display: block; width: 100%; height: 8px; border-radius: 8px; overflow: hidden; }
.bar-bg { fill: var(--track); }
.bar-fill { fill: var(--accent); }
.bar-fill2 { fill: var(--fill2); }

.progress-text { font-size: 14px; font-weight: 700; color: var(--accent); }

/* Начална страница */
.overview {
  background: var(--accent-soft);
  border-radius: var(--r-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.overview .bar-bg { fill: var(--track-soft); }
.overview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.overview-count { font-size: 15px; font-weight: 800; color: var(--accent-dark); }
.activity {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--track-soft);
  padding-top: 10px;
}
.activity-title { font-size: 14px; font-weight: 700; color: var(--accent-dark); }

.list-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px;
  color: inherit;
  text-decoration: none;
  font-weight: 400;
}
.list-card:hover { border-color: var(--accent); }
.list-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); }
.list-card-title { font-size: 18px; font-weight: 800; color: var(--ink); }

/* --- Табове на списъка --------------------------------------------------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--field-line); }
.tabs a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  margin-bottom: -1px;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 800; border-bottom-color: var(--accent); }
.tabs .count {
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #ECEAE4;
  color: #4A544E;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.guest-status { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.guest-status .status { display: inline-flex; align-items: center; gap: 6px; }
.wrap-row { flex-wrap: wrap; gap: 4px 20px; }

/* --- Търсене и филтри ---------------------------------------------------- */

.filters { display: flex; flex-direction: column; gap: 12px; }

.search {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field-line);
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--muted);
}
.search:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.search input {
  flex: 1;
  min-width: 0;
  height: auto;
  min-height: 0;
  border: 0;
  outline: none;
  background: none;
  padding: 0;
}
.search input:focus-visible { outline: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  border: 1px solid var(--field-line);
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  text-decoration: none;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.selects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.filter-actions { display: flex; align-items: center; gap: 16px; }
.js .filter-actions .btn { display: none; }

/* --- Нещо от списъка ------------------------------------------------------- */

.item {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px;
  overflow-wrap: anywhere;
}
.item.state-reserved { background: var(--reserved-bg); border-color: var(--reserved-line); }
.item.state-bought { background: var(--bought-bg); border-color: var(--bought-line); }

.item-top { display: flex; gap: 14px; align-items: center; }

.thumb {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: var(--r-ctl);
  object-fit: cover;
  background: var(--accent-soft);
}
.thumb.placeholder { display: flex; align-items: center; justify-content: center; color: var(--accent); }
.state-reserved .thumb.placeholder { background: var(--reserved-thumb); color: var(--reserved-ink); }
.state-bought .thumb.placeholder { background: var(--bought-thumb); color: var(--bought-ink); }

.item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.meta { font-size: 14px; color: var(--muted); }
.status { font-size: 14px; font-weight: 700; color: var(--accent); }
.state-reserved .status { color: var(--reserved-ink); font-weight: 800; }
.state-bought .status { color: var(--bought-ink); font-weight: 800; }
.status-mine { font-size: 14px; font-weight: 700; color: var(--ink-2); }

.item-actions { display: flex; align-items: center; gap: 6px; margin: 0; }
.item-actions .grow { flex: 1; display: flex; }

.more summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  list-style: none;
}
.more summary::-webkit-details-marker { display: none; }
.more[open] > summary .icon { transform: rotate(180deg); }

.more-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 4px; }
.desc { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink-2); white-space: pre-line; }
.ext { font-size: 15px; align-self: flex-start; min-height: 32px; }
.counts { font-size: 14px; font-weight: 700; color: var(--muted); }

.qty-form { display: flex; flex-direction: column; gap: 10px; }
.qty-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }
.qty-form input { width: 120px; }

.note-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--bought-line);
  border-radius: var(--r-ctl);
  padding: 12px 14px;
}
.note-box .label { font-size: 14px; font-weight: 700; color: var(--muted); }
.note-text { margin: 0; font-size: 16px; line-height: 1.4; white-space: pre-line; }
.note-edit summary { list-style: none; display: inline-flex; }
.note-edit summary::-webkit-details-marker { display: none; }
.note-edit[open] summary { margin-bottom: 8px; }

.who-list { list-style: none; padding: 0; margin: 0; border-top: 1px dashed var(--line); }
.who-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; }
.who-list li > form { flex: none; }

.admin-actions {
  display: flex;
  gap: 20px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.admin-actions a { min-height: 44px; display: inline-flex; align-items: center; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- Бутони ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--field-line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.wide { flex: 1; height: 48px; }
.btn.small { min-height: 44px; padding: 0 14px; }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }

.text-btn {
  min-height: 44px;
  padding: 0 10px;
  background: none;
  border: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.note-box .text-btn, .admin-actions .text-btn { padding: 0; }
.text-btn.danger, .danger { color: var(--danger); }

form.inline { display: inline; margin: 0; }
form { margin: 0; }

/* --- Форми ------------------------------------------------------------------- */

.stack { display: flex; flex-direction: column; gap: 12px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: var(--muted); }

input, textarea, select {
  font: inherit;
  font-size: 16px; /* за да не увеличава страницата в телефона */
  font-weight: 400;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field-line);
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--ink);
}
textarea { padding: 12px 14px; line-height: 1.4; resize: vertical; }
select { padding: 0 12px; }
input[type="number"] { max-width: 140px; }

.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { width: 90px; text-align: center; }
.step {
  width: 48px;
  height: 48px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--field-line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cancel { min-height: 44px; display: inline-flex; align-items: center; padding: 0 8px; }

.hint { font-size: 14px; font-weight: 400; color: var(--muted); }

/* --- Съобщения ---------------------------------------------------------------- */

.flash { margin: 0; padding: 12px 14px; border-radius: var(--r-ctl); font-weight: 700; }
.flash-ok { background: var(--bought-bg); color: var(--bought-ink); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

.errors {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--r-ctl);
  padding: 6px 14px;
  font-weight: 700;
}
.errors p { margin: 6px 0; }

.note { margin: 0; background: var(--accent-soft); border-radius: var(--r-ctl); padding: 10px 14px; }

.muted { color: var(--muted); }
.center { text-align: center; }
.empty { margin: 0; color: var(--muted); }

/* --- Админ --------------------------------------------------------------------- */

.code-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.12em;
  background: var(--bg);
  border: 1px dashed var(--accent);
  border-radius: var(--r-ctl);
  padding: 6px 14px;
  user-select: all;
}

.rows { list-style: none; padding: 0; margin: 0; }
.rows li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.rows li:last-child { border-bottom: 0; }
.rows li > form { flex: none; }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-text .muted { font-size: 14px; }

.danger-zone { border-color: var(--danger-soft); }

@media (max-width: 420px) {
  .brand { font-size: 16px; gap: 8px; }
  .nav { gap: 10px; }
}

@media (max-width: 360px) {
  .selects, .two-cols { grid-template-columns: 1fr; }
}
