/* @rozgor-part 3/10 — YANGI RO'YXAT FORMASI + MAHSULOT QATORI (katak, nom, miqdor, narx)
   BO'LINDI (5d-blok): ilgari bitta `style.css` (3058 qator) edi. TARTIB MUHIM —
   keyingi qoida oldingisini bosadi, shuning uchun public/index.html dagi <link>
   teglari AYNAN shu raqamlar tartibida turishi SHART. */
/* Yangi ro'yxat formasi: oy select + yil qadamchi + nom input + Yarat.
   Tor ekranda o'ralishi (wrap) uchun — nom + Yarat keyingi qatorga tushadi. */
.new-list-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* font-size 16px — iOS zumlashiga qarshi (yuqoridagi .search-input izohi). Forma
   `flex-wrap: wrap` bo'lgani uchun bir oz kengayish qatorni buzmaydi (kerak bo'lsa
   o'zi keyingi qatorga o'tadi); to'ldirma esa balandlik o'sib ketmasin deb bir oz
   qisqartirildi. */
.new-list-month {
  flex: none;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

/* Yil qadam-tanlagichi (− yil +) — auto to'ldiriladi, o'zgartirsa bo'ladi */
.new-list-year {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border-radius: var(--radius);
  background: var(--tg-secondary-bg);
  padding: 2px;
}

/* Ko'rinadigan o'lcham o'zgarmadi (30x34), lekin BOSILADIGAN maydon 44x44 —
   ko'rinmas ::before qatlami (item-check naqshi). */
.year-step {
  position: relative;
  width: 30px;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--tg-link);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.year-step::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
}

/* O'chiq tugmaning kengaytirilgan maydoni ham bosilmasin */
.year-step:disabled::before {
  display: none;
}

.year-step:active {
  background: rgba(128, 128, 128, 0.18);
}

.year-step:disabled {
  color: var(--tg-hint);
  opacity: 0.5;
  cursor: default;
}

.year-val {
  min-width: 46px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--tg-text);
}

.new-list-year.disabled {
  opacity: 0.55;
}

/* font-size 16px — iOS zumlashiga qarshi. */
.new-list-name {
  flex: 1 1 130px;
  min-width: 0;
  border: none;
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

.new-list-name::placeholder {
  color: var(--tg-hint);
}

.new-list-create {
  flex: none;
  border: none;
  border-radius: var(--radius);
  padding: 9px 14px;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.new-list-create:disabled {
  opacity: 0.5;
}

/* "Bekor" — yangi ro'yxat formasini yopadi (asosiy ekranga qaytaradi). */
.new-list-cancel {
  flex: none;
  border: none;
  border-radius: var(--radius);
  padding: 9px 12px;
  background: transparent;
  color: var(--tg-hint);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.new-list-cancel:active {
  background: rgba(128, 128, 128, 0.15);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Mahsulot qatori (2-bosqich — SODDALASHTIRILGAN). Qatorda FAQAT 4 element:
   [katak] nom(+qisqa yozuv) ... miqdor  ›
   Ilgari bu yerda 11 ta element bor edi (raqam, kategoriya tabletkasi, narx, sana,
   kim qo'shgani, uzun holat satri, progress, "×") — hammasi mahsulot varag'iga
   ko'chdi. To'ldirma kichik: katak va "›" tugmalari o'zi 44px maydon beradi. */
.item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 2px;
  min-height: 52px;
  background: var(--tg-secondary-bg);
  border-radius: var(--radius);
  user-select: none;
  transition: opacity 0.15s ease, background 0.15s ease;
}

/* Katak (checkbox) — mahsulotni "olindi" deb belgilaydigan YAGONA element (0010).
   Qatorning o'zi bosilmaydi. BOSILADIGAN maydon 44x44 (barmoq uchun eng kichik
   tavsiya etilgan o'lcham), KO'RINADIGAN kvadrat esa 24px (::before) — shakl
   o'zgarmadi, faqat tegish maydoni kattalashdi. */
.item-check {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  position: relative;
  -webkit-appearance: none;
  appearance: none;
}

/* Ko'rinadigan katak (24px kvadrat) — tugma markazida. */
.item-check::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  box-sizing: border-box;
  border: 2px solid var(--tg-hint);
  border-radius: 7px;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.item-check::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: var(--tg-button-text);
  opacity: 0;
}

.item-check:active::before {
  transform: scale(0.9);
}

.item.bought .item-check::before {
  background: var(--done);
  border-color: var(--done);
}

.item.bought .item-check::after {
  opacity: 1;
}

.item-body {
  flex: 1;
  min-width: 0;
}

/* Qatorning YUQORI satri: nom (chapda) + miqdor (o'ngda). */
.item-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.item-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px;
  font-weight: 500;
  word-break: break-word;
}

/* Qatorning PAST satri: kilo narxi (chapda) + jami (o'ngda). Miqdordan (13px)
   ATAYLAB kichik (10px) va xira — asosiy o'qish yo'nalishi nom + miqdor bo'lib
   qolsin, narx esa qo'shimcha ma'lumot bo'lsin. */
.item-price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.item-unit,
.item-total {
  color: var(--tg-hint);
  white-space: nowrap;
}

/* O'ng chekka: "narxi 18 000 so'm" + (kerak bo'lsa) qizil "⚠". */
.item-price-right {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

/* Mantiqsiz katta summa ogohlantirishi — QIZIL (emoji rangi emas, o'z rangimiz).
   Bloklamaydi: faqat "tekshiring" deb turadi. */
.item-price-warn {
  color: var(--danger);
  font-weight: 700;
  line-height: 1;
}

/* Narxsiz mahsulot — o'ng chetda ko'k "+ narx" ishorasi (tahrir varaqda). */
.item-price-add {
  color: var(--tg-link);
  font-weight: 600;
  white-space: nowrap;
}

