/* HYPEDROP: компоненты UI-кита К1–К9 */

/* ---------- К9. Кнопки ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px;
  border-radius: var(--r); border: 2px solid transparent;
  font: 600 16px/1 var(--font-ui);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--t);
}
.btn-p { background: var(--ink); color: var(--white); }
.btn-p:hover { background: #2E2E2B; color: var(--white); }
.btn-p:active { background: #000; transform: translateY(1px); }
.btn-s { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn-s:hover { background: #F2F2EF; color: var(--ink); }
.btn-s:active { background: var(--line); }
.btn-d { background: var(--error); color: var(--white); }
.btn-d:hover { background: #951217; color: var(--white); }
.btn-d:active { background: #7A0E12; }
.btn-t { background: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; padding: 0 8px; }
.btn-t:hover { background: #F2F2EF; }
.btn-t:active { background: var(--line); }
.btn-lg { height: 56px; font-size: 17px; font-weight: 700; border-radius: var(--r-lg); padding: 0 24px; }
.btn-sm { height: 40px; padding: 0 14px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--disabled-bg); color: var(--disabled-fg); border-color: var(--disabled-bg);
  cursor: not-allowed; text-decoration: none; transform: none;
}
.btn-t:disabled { background: transparent; color: var(--placeholder); border-color: transparent; text-decoration: underline; }

/* загрузка: спиннер вместо текста, ширина не меняется */
.btn.is-loading { pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; margin: -9px 0 0 -9px;
  width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .btn.is-loading::after { animation-duration: 2.4s; }
}

/* ---------- К9. Поля ---------- */
.field { display: block; margin: 0; }
.label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--error); }
.input {
  display: block; width: 100%; height: 48px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--white); color: var(--ink); font: 400 16px var(--font-ui);
}
.input::placeholder { color: var(--placeholder); }
.input:focus-visible { border-color: var(--ink); }
.input.is-compact { height: 44px; padding: 0 12px; }
textarea.input { height: auto; padding: 12px 14px; line-height: 1.5; resize: vertical; }
select.input { cursor: pointer; }
.input[aria-invalid="true"] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.input:disabled { background: var(--panel); color: var(--disabled-fg); border-color: var(--border-soft); cursor: not-allowed; }
.input[readonly] { background: var(--panel); border-style: dashed; }

.field-error, .inline-error {
  display: flex; gap: 6px; align-items: flex-start;
  color: var(--error); font-size: 14px; margin-top: 6px;
}
.field-error svg, .inline-error svg { flex-shrink: 0; margin-top: 2px; }
.field-hint { font-size: 14px; color: var(--muted); margin-top: 6px; }
.field-foot { display: flex; justify-content: space-between; gap: 12px; }
.field-foot .counter { margin-left: auto; margin-top: 6px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.check { display: flex; align-items: center; gap: 10px; min-height: 28px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); flex-shrink: 0; }

/* переключатель карты HYPE CLUB */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; flex-shrink: 0; width: 48px; height: 28px; border-radius: 14px; background: var(--border); transition: background var(--t); }
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--white); transition: left var(--t), background var(--t);
}
.switch input:checked + .switch__track { background: var(--ink); }
.switch input:checked + .switch__track::after { left: 23px; background: var(--lime); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch__track { opacity: 0.5; }

/* чип (размеры, фильтры) */
.chip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; height: 40px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 999px;
  font-size: 14px; font-weight: 600; background: var(--white); color: var(--ink);
  cursor: pointer; text-decoration: none; transition: border-color var(--t);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip:has(input:checked), .chip[aria-current="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.chip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* степпер количества */
.stepper { display: inline-flex; align-items: stretch; border: 1.5px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--white); }
.stepper.is-invalid { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.stepper__btn { width: 44px; height: 44px; border: 0; background: var(--white); font: 600 20px/1 var(--font-ui); color: var(--ink); }
.stepper__btn:hover { background: #F2F2EF; }
.stepper__btn:disabled { background: var(--panel); color: var(--placeholder); cursor: not-allowed; }
.stepper__input {
  width: 48px; border: 0; border-left: 1.5px solid var(--border-soft); border-right: 1.5px solid var(--border-soft);
  text-align: center; font: 600 16px var(--font-ui); font-variant-numeric: tabular-nums; background: var(--white);
}
.stepper__input:disabled { background: var(--panel); color: var(--disabled-fg); }
.stepper.is-lg .stepper__btn { width: 48px; height: 48px; font-size: 22px; }
.stepper.is-lg .stepper__input { width: 64px; font-size: 18px; }
.stepper.is-lg { border-radius: var(--r-lg); }

/* ---------- К2. Бейджи, К3. Статусы ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px;
  border-radius: var(--r-sm); font: 700 14px/1 var(--font-ui); white-space: nowrap;
}
.badge-lg { height: 28px; padding: 0 10px; }
.badge-drop { background: var(--drop); color: var(--ink); }
.badge-sale { background: var(--lime); color: var(--ink); }
.badge-out { background: var(--ink); color: var(--white); }
.badge-inactive { background: var(--line); color: var(--muted-2); }
.badge-club { background: var(--ink); color: var(--lime); }

.status {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px;
  border-radius: 999px; font: 600 14px/1 var(--font-ui); white-space: nowrap;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-created { background: var(--st-created-bg); color: var(--st-created-fg); }
.status-paid { background: var(--st-paid-bg); color: var(--st-paid-fg); }
.status-shipped { background: var(--st-shipped-bg); color: var(--st-shipped-fg); }
.status-delivered { background: var(--st-delivered-bg); color: var(--st-delivered-fg); }
.status-cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled-fg); }

.level { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: var(--r-sm); font: 700 14px/1 var(--font-mono); }
.level-INFO { background: #E2E8F0; color: #334155; }
.level-WARNING { background: #FEF3C7; color: #92400E; }
.level-ERROR { background: #FEE2E2; color: #991B1B; }

/* ---------- К5. Плашки ---------- */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; font-size: 15px;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.alert__title { font-weight: 700; }
.alert-error { border-color: var(--error); background: var(--error-bg); }
.alert-error svg { color: var(--error); }
.alert-warn { border-color: var(--warn); background: var(--warn-bg); color: var(--warn-text); }
.alert-info { border-color: #CFCFCA; background: var(--panel); color: #2A2A27; align-items: center; }

.server-error {
  display: flex; gap: 14px; align-items: flex-start;
  border: 1.5px solid var(--ink); background: var(--white); border-radius: var(--r-lg); padding: 16px 18px;
}
.server-error > svg { flex-shrink: 0; margin-top: 2px; color: var(--error); }
.server-error__body { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.server-error__title { font-weight: 700; font-size: 18px; }
.server-error__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.req-id { font-family: var(--font-mono); font-weight: 600; background: var(--panel); padding: 3px 8px; border-radius: var(--r-sm); user-select: all; }
.server-error__time { font: 14px var(--font-mono); color: var(--muted-2); }
.btn.is-copied { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }

.warn-pill {
  display: inline-flex; gap: 8px; align-items: center;
  border: 1.5px solid var(--warn); background: var(--warn-bg); border-radius: var(--r);
  padding: 6px 10px; font-size: 14px; font-weight: 600; color: var(--warn-text);
}

/* ---------- К7. Тосты ---------- */
.toasts {
  position: fixed; top: calc(var(--header-h) + 16px); right: 32px; z-index: 50;
  display: flex; flex-direction: column; gap: 10px; width: 340px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--white); border-radius: var(--r-lg);
  padding: 12px 10px 12px 16px; box-shadow: 0 12px 32px rgba(0,0,0,.25);
}
.toast svg { flex-shrink: 0; color: var(--lime); }
.toast__body { flex: 1; display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.toast__body a { color: var(--lime); font-size: 15px; }
.toast__close { width: 36px; height: 36px; border: 0; border-radius: var(--r); background: transparent; color: var(--white); display: flex; align-items: center; justify-content: center; }
.toast__close:hover { background: #2E2E2B; }
.toast :focus-visible { outline-color: var(--lime); }

/* ---------- К6. Пагинация ---------- */
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.pg {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 12px;
  border: 1.5px solid var(--line-2); border-radius: var(--r);
  font-weight: 600; text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums;
}
a.pg:hover { border-color: var(--ink); color: var(--ink); }
.pg-on { background: var(--ink); color: var(--white); border-color: var(--ink); }
.pg-off { color: var(--placeholder); border-color: var(--line); background: var(--panel); }
.pg-gap { border: 0; min-width: 24px; padding: 0; }

/* ---------- К4. Таблицы ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
.table { width: 100%; }
.table th {
  font-size: 14px; font-weight: 600; color: var(--muted); text-align: left;
  padding: 10px 12px; border-bottom: 1.5px solid var(--ink); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--panel-2); }
.table tr.is-click { cursor: pointer; }
.table td.empty { text-align: center; padding: 28px; color: var(--muted-2); }
.table td.empty:hover { background: none; }
.sk { display: block; height: 14px; border-radius: var(--r-sm); background: #ECECE8; }
.skeleton-box { display: block; border-radius: var(--r); background: #ECECE8; }

/* ---------- К9. Модальное окно (нативный dialog) ---------- */
dialog.modal {
  border: 0; padding: 28px; width: 420px; max-width: calc(100vw - 32px);
  border-radius: var(--r-xl); box-shadow: 0 20px 48px rgba(0,0,0,.3); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(17,17,17,.55); }
.modal__title { margin: 0 0 24px; font-size: 22px; font-weight: 700; }
.modal__actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ---------- К8. История статусов ---------- */
.history { display: flex; flex-direction: column; }
.history__item { display: flex; gap: 16px; }
.history__rail { display: flex; flex-direction: column; align-items: center; }
.history__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); margin-top: 6px; flex-shrink: 0; }
.history__line { flex: 1; width: 2px; background: var(--border-soft); min-height: 24px; }
.history__item:last-child .history__line { background: transparent; }
.history__body { padding-bottom: 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.history__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history__meta { font-size: 14px; color: var(--muted); }
.history__note { font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- К1. Карточка товара в списке ---------- */
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 14px;
  border-radius: 14px; text-decoration: none; color: var(--ink); transition: box-shadow var(--t);
}
.card:hover { box-shadow: 0 8px 24px rgba(17,17,17,.14); color: var(--ink); }
.card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.media { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r); overflow: hidden; background: #E6E9EE; display: flex; align-items: center; justify-content: center; }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media.is-dim img, .media.is-dim .media__art { opacity: 0.4; }
.media__art { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.media__stub { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--white); text-align: center; padding: 16px; }
.media__stub-cat { font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1.15; }
.media__stub-sku { font: 15px var(--font-mono); }
.media.is-dim .media__stub { opacity: 0.6; }
.media__badges { position: absolute; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.card__name {
  font-size: 16px; font-weight: 600; line-height: 1.3; min-height: 42px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.card__sku { font: 14px var(--font-mono); color: var(--muted); }
.card__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.price { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-old { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* пустое состояние */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  text-align: center; padding: 48px 20px; border: 1.5px solid var(--line); border-radius: var(--r-xl);
}
.empty-state__title { font-family: var(--font-display); font-weight: 800; font-size: 24px; margin: 0; }
.empty-state svg { color: var(--ink); }

.spacer { flex: 1; }
