/* Ценот — компоненты дизайн-системы (components/bundle.css из артефакта «Ценот»), без подключения Google Fonts: шрифты — свои, в site.css */

/* Ценот — стили компонентов. Значения только из токенов (tokens.css). Префикс cn-.
   Без теней у карточек, без свечений, без градиентов, без капса с разрядкой. */

.cn-root, .cn-root * { box-sizing: border-box; }
.cn-root {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}
.cn-root :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cn-num { font-variant-numeric: tabular-nums; }
.cn-icon { width: var(--icon-md); height: var(--icon-md); flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cn-group-label { margin: 0 0 var(--space-2); font-size: 13px; line-height: 18px; font-weight: 700; color: var(--text-muted); }

/* Кнопки */
.cn-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap-min); padding: 0 var(--space-4);
  border-radius: var(--radius-lg); border: 1px solid transparent;
  font-family: var(--font-text); font-size: 15px; line-height: 22px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.25, 1, 0.5, 1), transform 150ms cubic-bezier(0.25, 1, 0.5, 1);
}
.cn-btn:active { transform: scale(0.98); }
.cn-btn--primary { background: var(--gold); color: var(--on-gold); min-height: var(--control-h); font-size: 16px; font-weight: 800; }
.cn-btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.cn-btn--ghost { background: transparent; color: var(--gold-text); padding: 0 var(--space-2); }
.cn-btn--block { width: 100%; }
.cn-btn--icon { width: var(--tap-min); padding: 0; border-radius: var(--radius-md); background: var(--surface-raised); color: var(--text); }
.cn-btn[disabled], .cn-btn[aria-disabled="true"] { background: var(--surface-raised); color: var(--text-subtle); border-color: transparent; cursor: not-allowed; transform: none; }
.cn-btn[aria-busy="true"] { cursor: progress; transform: none; }
.cn-btn--secondary .cn-icon, .cn-btn--ghost .cn-icon { color: var(--gold-text); }
.cn-spin { width: 18px; height: 18px; border-radius: var(--radius-pill); border: 2px solid currentColor; border-right-color: transparent; animation: cn-spin 700ms linear infinite; }
@keyframes cn-spin { to { transform: rotate(360deg); } }

/* Строки списка (разделы, события, настройки): без коробок, с разделителями */
.cn-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.cn-row {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 60px; padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.cn-list > :last-child .cn-row, .cn-list > .cn-row:last-child { border-bottom: 0; }
.cn-row__icon { color: var(--gold-text); width: var(--icon-lg); height: var(--icon-lg); stroke-width: 1.8; }
.cn-row__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex-grow: 1; }
.cn-row__title { font-size: 16px; line-height: 22px; font-weight: 700; }
.cn-row__hint { font-size: 13px; line-height: 18px; color: var(--text-muted); overflow-wrap: anywhere; }
.cn-row__end { flex-shrink: 0; font-size: 13px; line-height: 18px; color: var(--text-subtle); }
.cn-row__chevron { color: var(--text-subtle); width: 18px; height: 18px; }
.cn-row--soon .cn-row__icon, .cn-row--soon .cn-row__title { color: var(--text-muted); }
.cn-row--down .cn-row__icon { color: var(--success); }
.cn-row--new .cn-row__icon { color: var(--gold-text); }
.cn-row--gone .cn-row__icon { color: var(--danger); }
.cn-row--down .cn-row__tag { color: var(--success); }
.cn-row--gone .cn-row__tag { color: var(--danger); }
.cn-row--new .cn-row__tag { color: var(--gold-text); }
.cn-row__tag { font-weight: 800; }

/* Бейджи */
.cn-site {
  display: inline-flex; align-items: center; padding: 3px var(--space-2);
  border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--text-muted);
  font-size: 11px; line-height: 14px; font-weight: 700;
}
.cn-best {
  display: inline-flex; align-items: center; align-self: flex-start; padding: 3px var(--space-2);
  border-radius: var(--radius-sm); background: var(--gold); color: var(--on-gold);
  font-size: 11px; line-height: 14px; font-weight: 800;
}

/* Цена */
.cn-price { display: flex; flex-direction: column; gap: var(--space-1); }
.cn-price__now { font-family: var(--font-display); font-size: 26px; line-height: 30px; font-weight: 700; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.cn-price__now--md { font-family: var(--font-text); font-size: 18px; line-height: 24px; font-weight: 800; letter-spacing: 0; }
.cn-price__row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.cn-price__old { font-size: 13px; line-height: 18px; color: var(--text-subtle); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.cn-delta {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px var(--space-2);
  border-radius: var(--radius-sm); font-size: 12px; line-height: 16px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.cn-delta .cn-icon { width: 14px; height: 14px; stroke-width: 2.4; }
.cn-delta--down { background: var(--success-soft); color: var(--success); }
.cn-delta--up { background: var(--danger-soft); color: var(--danger); }

/* Карточка объявления в выдаче — единственная «коробка» в системе */
.cn-listing {
  display: flex; gap: var(--space-3); padding: var(--space-3);
  background: var(--surface); color: var(--text);
  border-radius: var(--radius-lg); text-decoration: none;
}
[data-theme="dark"] .cn-listing { box-shadow: inset 0 0 0 1px var(--border); }
.cn-listing__thumb {
  width: var(--thumb); height: 96px; flex-shrink: 0; border-radius: var(--radius-md);
  background: var(--surface-raised); color: var(--text-subtle); object-fit: cover;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1);
  font-size: 11px; line-height: 14px;
}
.cn-listing__thumb .cn-icon { width: 32px; height: 32px; stroke-width: 1.5; }
.cn-listing__body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; flex-grow: 1; }
.cn-listing__title { font-size: 14px; line-height: 20px; font-weight: 700; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cn-listing__specs { font-size: 13px; line-height: 18px; color: var(--text-muted); }
.cn-listing__meta { display: flex; align-items: center; gap: var(--space-2); margin-top: auto; padding-top: var(--space-1); font-size: 12px; line-height: 16px; color: var(--text-subtle); }

/* Характеристики в карточке объявления: список «название — значение», не плитки */
.cn-specs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin: 0; }
.cn-specs dt, .cn-specs dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 20px; }
.cn-specs dt { color: var(--text-muted); }
.cn-specs dd { font-weight: 700; text-align: right; }

/* Чипы */
.cn-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cn-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--chip-h); padding: 0 var(--space-3);
  border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
  background: var(--surface-raised); color: var(--text);
  font-family: var(--font-text); font-size: 13px; line-height: 18px; font-weight: 700; cursor: pointer;
}
.cn-chip .cn-icon { width: 16px; height: 16px; }
.cn-chip[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold-text); color: var(--text); }
.cn-chip[aria-pressed="true"] .cn-icon { color: var(--gold-text); }
.cn-chip__count { min-width: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--gold); color: var(--on-gold); font-size: 11px; line-height: 18px; text-align: center; }

/* Поле поиска */
.cn-search {
  display: flex; align-items: center; gap: 10px; height: var(--control-h); padding: 0 14px;
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); color: var(--text-muted);
}
.cn-search:focus-within { border-color: var(--gold-text); box-shadow: 0 0 0 1px var(--gold-text); }
.cn-search input { flex-grow: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: none; color: var(--text); font-family: var(--font-text); font-size: 16px; font-weight: 500; }
.cn-search input::placeholder { color: var(--text-subtle); }

/* Переключатель */
.cn-segment { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-1); padding: var(--space-1); background: var(--surface-raised); border-radius: var(--radius-lg); }
.cn-segment button {
  min-height: 40px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-muted);
  font-family: var(--font-text); font-size: 14px; font-weight: 700; cursor: pointer;
}
.cn-segment button[aria-selected="true"] { background: var(--gold); color: var(--on-gold); font-weight: 800; }

/* Нижние вкладки */
.cn-tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: var(--space-2) var(--space-2) max(14px, env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--border); }
.cn-tab {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-1); min-height: var(--tap-min); padding: 6px 0;
  color: var(--text-muted); text-decoration: none; font-size: 11px; line-height: 14px; font-weight: 700;
}
.cn-tab .cn-icon { width: var(--icon-lg); height: var(--icon-lg); stroke-width: 1.8; }
.cn-tab[aria-current="page"] { color: var(--gold-text); }
.cn-tab__dot { position: relative; display: inline-flex; }
.cn-tab__dot::after { content: ""; position: absolute; top: -2px; right: -4px; width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--gold); border: 2px solid var(--bg); }

/* Пустое состояние и ошибка */
.cn-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-10) var(--space-4); }
.cn-empty img { width: 104px; height: 104px; border-radius: var(--radius-pill); object-fit: cover; }
.cn-empty__title { margin: var(--space-2) 0 0; font-family: var(--font-display); font-size: 18px; line-height: 24px; font-weight: 700; }
.cn-empty__text { margin: 0; font-size: 14px; line-height: 21px; color: var(--text-muted); max-width: 290px; }
.cn-empty .cn-btn { margin-top: var(--space-4); }

/* Загрузка: скелетон повторяет форму карточки объявления */
.cn-skel { display: flex; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-lg); background: var(--surface); }
.cn-skel__block { border-radius: var(--radius-sm); background: var(--surface-raised); animation: cn-fade 1.2s ease-in-out infinite alternate; }
.cn-skel__thumb { width: var(--thumb); height: 96px; border-radius: var(--radius-md); flex-shrink: 0; }
.cn-skel__lines { display: flex; flex-direction: column; gap: var(--space-2); flex-grow: 1; padding-top: 2px; }
@keyframes cn-fade { from { opacity: 1; } to { opacity: 0.45; } }

/* Всплывашка об успехе */
.cn-toast {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-sheet);
  font-size: 14px; line-height: 20px; font-weight: 700;
}
[data-theme="dark"] .cn-toast { background: var(--surface-raised); }
.cn-toast .cn-icon { color: var(--success); }
.cn-toast__action { margin-left: auto; }

/* Формы: одна колонка, подпись всегда над полем, всё выровнено по одной левой линии */
.cn-form { display: flex; flex-direction: column; gap: 20px; }
.cn-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cn-field__label { font-size: 14px; line-height: 20px; font-weight: 700; color: var(--text); }
.cn-field__hint { font-size: 12px; line-height: 16px; color: var(--text-muted); }
.cn-input {
  display: flex; align-items: center; gap: var(--space-2); height: var(--control-h); padding: 0 14px;
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); color: var(--text-muted);
}
.cn-input:focus-within { border-color: var(--gold-text); box-shadow: 0 0 0 1px var(--gold-text); }
.cn-input input { flex-grow: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: none; color: var(--text); font-family: var(--font-text); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cn-input input::placeholder { color: var(--text-subtle); font-weight: 500; }
.cn-input__affix { flex-shrink: 0; font-size: 15px; color: var(--text-muted); }
.cn-field--error .cn-input { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.cn-field__error { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--danger); }
.cn-field__error .cn-icon { width: 16px; height: 16px; }
.cn-range { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2); }

/* Выбор из длинного списка: печатаешь — список сужается; можно и листать */
.cn-combo { display: flex; flex-direction: column; gap: var(--space-2); }
.cn-combo__list { margin: 0; padding: var(--space-1) 0; list-style: none; background: var(--surface); border-radius: var(--radius-lg); max-height: 280px; overflow-y: auto; }
[data-theme="dark"] .cn-combo__list { box-shadow: inset 0 0 0 1px var(--border); }
.cn-combo__group { padding: var(--space-2) 14px var(--space-1); font-size: 12px; line-height: 16px; font-weight: 700; color: var(--text-muted); }
.cn-combo__option { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: var(--tap-min); padding: 0 14px; font-size: 15px; color: var(--text); cursor: pointer; }
.cn-combo__option[aria-selected="true"] { background: var(--gold-soft); }
.cn-combo__option mark { background: transparent; color: var(--gold-text); font-weight: 800; }
.cn-combo__meta { font-size: 13px; color: var(--text-subtle); }

@media (prefers-reduced-motion: reduce) {
  .cn-btn, .cn-skel__block, .cn-spin { animation: none; transition: none; }
}
