/* PriceUA Mini App — тёмная тема по дизайн-макету */

:root {
  --bg: #171512;
  --bg-nav: #1D1A16;
  --bg-sheet: #1D1A16;
  --card: #211E1A;
  --border: #2C2721;
  --border-sheet: #322D26;
  --handle: #3A342C;
  --text: #F4EFE7;
  --muted: #9C9486;
  --dim: #8B8378;
  --accent: #FF5C00;
  --yellow: #FFD400;
  --green: #53C465;
  --red: #E5484D;
  --ink: #171512;
  --radius: 16px;
  --font-head: 'Unbounded', sans-serif;
  --font-body: 'Golos Text', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button { font-family: inherit; background: none; border: none; color: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ── шапка ── */
.app-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 8px;
}
.logo-badge {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 13px;
}
.logo-name { font-weight: 700; font-size: 15px; }
.logo-sub { color: var(--dim); font-size: 12px; }

/* ── контент ── */
.view {
  flex: 1;
  display: flex; flex-direction: column; gap: 16px;
  padding: 8px 16px calc(84px + env(safe-area-inset-bottom));
}

.page-title {
  font-family: var(--font-head); font-weight: 700; font-size: 22px;
}
.h1 { font-family: var(--font-head); font-weight: 700; font-size: 26px; }
.subtitle { color: var(--muted); font-size: 14px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.section-title { font-family: var(--font-head); font-weight: 600; font-size: 16px; }
.section-link { color: var(--accent); font-size: 13px; font-weight: 600; }
.section-note { color: var(--muted); font-size: 12px; }
.label-caps {
  color: var(--muted); font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}

.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 10px; }

/* ── карточки ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* маскот-баннер */
.mascot-banner {
  background: var(--accent); border-radius: 20px; padding: 16px;
  display: flex; align-items: center; gap: 14px;
}
.mascot-banner svg { flex-shrink: 0; }
.mascot-text { color: var(--ink); font-weight: 700; font-size: 16px; line-height: 1.3; }
.mascot-btn {
  align-self: flex-start; background: var(--ink); color: var(--yellow);
  font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 99px;
  margin-top: 8px;
}

/* статистика */
.stats-row { display: flex; gap: 10px; }
.stat-card {
  flex: 1; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-family: var(--font-head); font-weight: 600; font-size: 20px; }
.stat-value.yellow { color: var(--yellow); }
.stat-note { color: var(--muted); font-size: 11px; }
.progress { height: 5px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }

/* топ-знижки картки */
.deal-cards { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.deal-cards::-webkit-scrollbar { display: none; }
.deal-card {
  flex: 0 0 31%; min-width: 118px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.deal-img {
  position: relative; height: 72px; border-radius: 10px; overflow: hidden;
  background: repeating-linear-gradient(45deg, #2A2620 0 6px, #241F1B 6px 12px);
  display: flex; align-items: center; justify-content: center;
}
.deal-img img { width: 100%; height: 100%; object-fit: cover; }
.deal-img .noimg { font-family: ui-monospace, monospace; font-size: 9px; color: var(--dim); }
.badge-pct {
  position: absolute; top: 6px; left: 6px;
  background: var(--yellow); color: var(--ink);
  font-weight: 700; font-size: 11px; padding: 2px 7px; border-radius: 99px;
}
.deal-name { font-size: 12px; font-weight: 500; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deal-prices { display: flex; align-items: baseline; gap: 6px; }
.price-old { color: var(--dim); font-size: 11px; text-decoration: line-through; }
.price-new { color: var(--accent); font-weight: 700; font-size: 15px; }
.deal-store { color: var(--muted); font-size: 10px; }

/* строки товаров */
.item-row {
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.thumb {
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; overflow: hidden;
  background: repeating-linear-gradient(45deg, #2A2620 0 6px, #241F1B 6px 12px);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.lg { width: 44px; height: 44px; border-radius: 10px; }
.item-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-name { font-size: 13px; font-weight: 500; }
.item-sub { color: var(--muted); font-size: 11px; }
.item-sub b { color: var(--text); font-weight: 600; }
.chev { color: var(--dim); font-size: 16px; }
.chev.hot { color: var(--accent); }
.change-down { color: var(--green); font-weight: 700; font-size: 13px; }
.change-up { color: var(--red); font-weight: 700; font-size: 13px; }
.change-flat { color: var(--muted); font-weight: 600; font-size: 13px; }
.badge-yellow {
  background: var(--yellow); color: var(--ink);
  font-weight: 700; font-size: 11px; padding: 3px 8px; border-radius: 99px; white-space: nowrap;
}
.spark-col { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.spark-note-down { color: var(--green); font-size: 11px; font-weight: 700; }
.spark-note-up { color: var(--red); font-size: 11px; font-weight: 700; }

/* ── поиск ── */
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15px;
}
.search-box input::placeholder { color: var(--dim); }
.search-clear { color: var(--dim); font-size: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted); font-size: 12px; padding: 6px 12px; border-radius: 99px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.result-count { color: var(--muted); font-size: 13px; }
.empty-note { color: var(--dim); font-size: 13px; text-align: center; padding: 24px 0; }

/* ── знижки ── */
.toggle-card { padding: 13px 14px; display: flex; align-items: center; gap: 10px; }
.toggle-card .item-body { gap: 2px; }
.toggle-status-on { color: var(--green); font-size: 12px; }
.toggle-status-off { color: var(--muted); font-size: 12px; }
.switch {
  width: 46px; height: 27px; border-radius: 99px; background: var(--border);
  position: relative; flex-shrink: 0; transition: background .2s;
}
.switch.on { background: var(--accent); }
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 21px; height: 21px; border-radius: 99px; background: var(--text);
  transition: transform .2s;
}
.switch.on::after { transform: translateX(19px); }

.store-seg { display: flex; gap: 7px; }
.store-btn {
  flex: 1; font-size: 12px; font-weight: 600; text-align: center;
  padding: 9px 0; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
}
.store-btn.on { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 700; }

.pct-row { display: flex; align-items: center; gap: 10px; }
.pct-seg {
  flex: 1; display: flex; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; padding: 3px;
}
.pct-btn {
  flex: 1; text-align: center; color: var(--muted);
  font-size: 13px; font-weight: 600; padding: 8px 0; border-radius: 10px;
}
.pct-btn.on { background: var(--yellow); color: var(--ink); font-weight: 700; }
.uah-note { color: var(--muted); font-size: 12px; white-space: nowrap; }
.uah-note b { color: var(--text); font-weight: 700; }

/* ── список ── */
.count-pill {
  background: var(--card); border: 1px solid var(--border);
  font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 99px;
}
.legend { color: var(--muted); font-size: 12px; }

.swipe-wrap { position: relative; border-radius: var(--radius); overflow: hidden; }
.swipe-del {
  position: absolute; top: 0; right: 0; bottom: 0; width: 76px;
  background: var(--red); border-radius: 0 var(--radius) var(--radius) 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #fff; font-size: 10px; font-weight: 700;
}
.swipe-del span:first-child { font-size: 16px; }
.swipe-item { position: relative; transition: transform .2s; background: var(--card); border-radius: var(--radius); }
.swipe-item.open { transform: translateX(-76px); }

.premium-banner {
  background: var(--yellow); border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.premium-banner .star { font-size: 24px; }
.premium-banner .pb-title { color: var(--ink); font-weight: 700; font-size: 13px; }
.premium-banner .pb-sub { color: var(--ink); font-size: 11px; opacity: .75; }
.premium-banner .pb-btn {
  background: var(--ink); color: var(--yellow);
  font-weight: 700; font-size: 12px; padding: 8px 14px; border-radius: 99px;
}

/* ── профіль ── */
.profile-card { padding: 14px; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 44px; height: 44px; border-radius: 99px; background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-family: var(--font-head); font-weight: 700; font-size: 16px;
}
.profile-name { font-weight: 600; font-size: 14px; }
.profile-sub { color: var(--muted); font-size: 12px; }

.settings-list { overflow: hidden; display: flex; flex-direction: column; }
.settings-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  border-bottom: 1px solid var(--border); text-align: left; width: 100%;
}
.settings-row:last-child { border-bottom: none; }
.settings-icon { font-size: 16px; }
.settings-label { color: var(--text); font-size: 14px; flex: 1; }
.settings-value { color: var(--muted); font-size: 13px; }
.settings-sub { color: var(--muted); font-size: 11px; }
.settings-col { flex: 1; display: flex; flex-direction: column; gap: 1px; }

.premium-card {
  background: var(--yellow); border-radius: 20px; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden;
}
.premium-card .deco { position: absolute; right: -14px; top: -10px; opacity: .28; }
.premium-head { display: flex; align-items: center; gap: 8px; position: relative; }
.premium-title { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: var(--ink); }
.premium-feats { display: flex; flex-direction: column; gap: 7px; position: relative; }
.premium-feat { display: flex; gap: 8px; align-items: center; }
.premium-check {
  width: 18px; height: 18px; border-radius: 99px; flex-shrink: 0;
  background: var(--ink); color: var(--yellow); font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.premium-feat span { color: var(--ink); font-size: 13px; font-weight: 500; }
.premium-cta { display: flex; align-items: center; gap: 12px; position: relative; }
.premium-buy {
  background: var(--ink); color: var(--yellow);
  font-weight: 700; font-size: 14px; padding: 12px 22px; border-radius: 99px;
}
.premium-price { display: flex; flex-direction: column; }
.premium-price b { color: var(--ink); font-weight: 700; font-size: 15px; }
.premium-price span { color: var(--ink); font-size: 11px; opacity: .7; }

.footer-note { color: var(--dim); font-size: 11px; text-align: center; }

/* ── нижняя навигация ── */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: center;
  padding: 10px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--bg-nav); border-top: 1px solid var(--border);
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 56px; }
.nav-icon { font-size: 19px; filter: grayscale(1); opacity: .55; }
.nav-label { font-size: 10px; color: var(--dim); }
.nav-item.active .nav-icon { filter: none; opacity: 1; }
.nav-item.active .nav-label { color: var(--accent); font-weight: 600; }

/* ── bottom sheet ── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(13, 12, 11, 0.6);
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  background: var(--bg-sheet); border-top: 1px solid var(--border-sheet);
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
  max-height: 86vh; overflow-y: auto;
  animation: sheet-in .22s ease-out;
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 99px; background: var(--handle); align-self: center; flex-shrink: 0; }
.hidden { display: none !important; }

.sheet-product { display: flex; gap: 12px; align-items: center; }
.sheet-img {
  width: 64px; height: 64px; border-radius: 14px; flex-shrink: 0; overflow: hidden;
  background: repeating-linear-gradient(45deg, #2A2620 0 6px, #241F1B 6px 12px);
  display: flex; align-items: center; justify-content: center;
}
.sheet-img img { width: 100%; height: 100%; object-fit: cover; }
.sheet-img .noimg { font-family: ui-monospace, monospace; font-size: 8px; color: var(--dim); }
.sheet-title { font-family: var(--font-head); font-weight: 600; font-size: 15px; line-height: 1.3; }
.sheet-sub { color: var(--muted); font-size: 12px; }

.price-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 11px 14px;
}
.price-row.best { border: 1.5px solid var(--accent); }
.price-row.missing { opacity: .5; }
.price-store { font-weight: 600; font-size: 14px; }
.badge-best {
  background: var(--accent); color: var(--ink);
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
}
.badge-promo {
  background: var(--yellow); color: var(--ink);
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
}
.price-right { margin-left: auto; display: flex; align-items: baseline; gap: 6px; }
.price-right .old { color: var(--dim); font-size: 12px; text-decoration: line-through; }
.price-right .cur { font-weight: 700; font-size: 16px; }
.price-missing { margin-left: auto; color: var(--muted); font-size: 13px; }

.btn-primary {
  background: var(--accent); color: var(--ink);
  font-weight: 700; font-size: 15px; text-align: center;
  padding: 14px; border-radius: 14px; width: 100%;
}
.btn-primary:disabled { opacity: .6; }
.btn-secondary {
  flex: 1; background: var(--card); border: 1px solid var(--border-sheet);
  color: var(--text); font-weight: 600; font-size: 13px; text-align: center;
  padding: 12px; border-radius: 14px;
}
.btn-secondary.on { border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; gap: 8px; }

.threshold-row { display: flex; gap: 8px; align-items: center; }
.threshold-row input {
  flex: 1; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; color: var(--text); font-size: 14px; outline: none;
}
.threshold-row input:focus { border-color: var(--accent); }

/* график истории */
.history-chart { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.history-chart svg { display: block; width: 100%; }
.axis-label { fill: var(--dim); font-size: 9px; font-family: ui-monospace, monospace; }

textarea.feedback-input {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 14px; padding: 12px; min-height: 96px;
  width: 100%; outline: none; resize: vertical;
}
textarea.feedback-input:focus { border-color: var(--accent); }

.select-list { display: flex; flex-direction: column; gap: 8px; }
.select-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 13px 14px; font-size: 14px; font-weight: 500; text-align: left;
}
.select-item.on { border-color: var(--accent); }
.select-item .mark { color: var(--accent); font-weight: 700; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 60;
  background: var(--card); border: 1px solid var(--border-sheet);
  color: var(--text); font-size: 13px; font-weight: 500;
  padding: 10px 18px; border-radius: 99px; white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}

.skeleton { color: var(--dim); font-size: 13px; text-align: center; padding: 32px 0; }
