/* ============================================================================
   UzNetPress — Component CSS
   Built on colors_and_type.css tokens. Refined from apps/miniapp/src/style.css.
   Class prefix `uz-` to avoid collisions. Light + dark follow the token layer.
   ============================================================================ */

/* ---- Buttons ------------------------------------------------------------ */
.uz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-bold);
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
  -webkit-tap-highlight-color: transparent;
}
.uz-btn--block {
  width: 100%;
}
.uz-btn--primary {
  background: var(--accent);
  color: var(--text-on-accent);
}
.uz-btn--primary:hover {
  background: var(--accent-hover);
}
.uz-btn--primary:active {
  background: var(--accent-pressed);
  transform: translateY(1px);
}
.uz-btn--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.uz-btn--secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}
.uz-btn--secondary:active {
  transform: translateY(1px);
}
.uz-btn--ghost {
  background: transparent;
  color: var(--accent);
  padding: 0 10px;
  min-width: 64px;
}
.uz-btn--ghost:hover {
  background: var(--accent-soft);
}
.uz-btn--icon {
  width: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
}
.uz-btn--icon:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.uz-btn--danger {
  background: var(--danger);
  color: #fff;
}
.uz-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.uz-btn--loading {
  cursor: wait;
  opacity: 0.7;
}
.uz-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Chips -------------------------------------------------------------- */
.uz-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-primary);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  padding: 7px 12px;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard);
  -webkit-tap-highlight-color: transparent;
}
.uz-chip--muted {
  color: var(--text-secondary);
  cursor: default;
}
.uz-chip .uz-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.uz-chip:hover {
  border-color: var(--text-muted);
}
.uz-chip--selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-pressed);
  box-shadow: inset 0 0 0 1px var(--accent);
  font-weight: var(--fw-semibold);
}
[data-theme="dark"] .uz-chip--selected {
  color: var(--accent);
}
.uz-chip--removable {
  padding-right: 10px;
}
.uz-chip--removable .x {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}

/* ---- Story / article card ---------------------------------------------- */
.uz-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 16px;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    background var(--dur-fast) var(--ease-standard);
  -webkit-tap-highlight-color: transparent;
}
.uz-card:active {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.uz-card__body {
  display: grid;
  gap: 8px;
}
.uz-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: var(--fs-caption);
}
.uz-card__meta .sep {
  color: var(--text-muted);
}
.uz-card__flag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
  color: var(--success);
  font-weight: var(--fw-bold);
}
.uz-card__title {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  text-wrap: pretty;
}
.uz-card__desc {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-secondary);
}
.uz-card__media {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  overflow: hidden;
}
.uz-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.uz-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
/* Footer toolbar: actions left (away from right-thumb scroll), stats right. */
.uz-card__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.uz-card__acts {
  display: flex;
  align-items: center;
  gap: 8px;
}
.uz-card__stats {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}
.uz-cardact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
  -webkit-tap-highlight-color: transparent;
}
.uz-cardact:active {
  transform: scale(0.92);
}
.uz-cardact--up:hover {
  color: var(--success);
  border-color: var(--success);
}
.uz-cardact--up.is-on {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.uz-cardact--down:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border-strong));
}
.uz-cardact--down.is-on {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}
.uz-cardact.is-saved {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---- Compact article row ----------------------------------------------- */
.uz-rowitem {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.uz-rowitem:last-child {
  border-bottom: 0;
}
.uz-rowitem__body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}
.uz-rowitem__title {
  margin: 0;
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text-primary);
}
.uz-rowitem__meta {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}
.uz-rowitem__thumb {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}

/* ---- Input / search ----------------------------------------------------- */
.uz-field {
  display: grid;
  gap: 6px;
}
.uz-field__label {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}
.uz-input {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 0 12px;
}
.uz-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--fs-body);
  outline: none;
}
.uz-input input::placeholder {
  color: var(--text-muted);
}
.uz-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.uz-input svg {
  color: var(--text-muted);
  flex: none;
}

/* ---- Segmented control / tabs ------------------------------------------ */
.uz-segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}
.uz-segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--fs-meta);
  font-weight: var(--fw-bold);
  cursor: pointer;
  padding: 0 14px;
  transition: all var(--dur-fast) var(--ease-standard);
}
.uz-segmented button.is-active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-1);
}
[data-theme="dark"] .uz-segmented button.is-active {
  background: var(--surface-2);
}

/* underline tabs (for section nav) */
.uz-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}
.uz-tabs button {
  border: 0;
  background: none;
  padding: 12px 0;
  font: inherit;
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.uz-tabs button.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* ---- Bottom navigation ------------------------------------------------- */
.uz-nav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.uz-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--nav-h);
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  position: relative;
}
.uz-nav__item.is-active {
  color: var(--accent);
}
.uz-nav__badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  display: grid;
  place-items: center;
}

/* ---- Header / top bar --------------------------------------------------- */
.uz-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.uz-header__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
}
.uz-header__spacer {
  flex: 1;
}

/* ---- Badge / counter ---------------------------------------------------- */
.uz-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  line-height: 1;
}
.uz-badge--neutral {
  background: var(--surface-sunken);
  color: var(--text-secondary);
}
.uz-badge--accent {
  background: var(--accent-soft);
  color: var(--accent-pressed);
}
[data-theme="dark"] .uz-badge--accent {
  color: var(--accent);
}
.uz-badge--success {
  background: var(--success-soft);
  color: var(--success);
}
.uz-badge--warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.uz-badge--danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.uz-badge--count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  justify-content: center;
  background: var(--accent);
  color: #fff;
}

/* ---- Toggle / switch ---------------------------------------------------- */
.uz-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  border: 0;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-standard);
}
.uz-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-base) var(--ease-out);
}
.uz-switch.is-on {
  background: var(--accent);
}
.uz-switch.is-on::after {
  transform: translateX(18px);
}

/* checkbox */
.uz-check {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.uz-check.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- Settings row ------------------------------------------------------- */
.uz-setting {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.uz-setting:last-child {
  border-bottom: 0;
}
.uz-setting__icon {
  color: var(--text-secondary);
  flex: none;
}
.uz-setting__body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.uz-setting__title {
  font-size: var(--fs-body);
  color: var(--text-primary);
}
.uz-setting__sub {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}
.uz-setting__value {
  font-size: var(--fs-meta);
  color: var(--text-secondary);
}
.uz-setting__chevron {
  color: var(--text-muted);
  flex: none;
}

/* ---- Skeleton ----------------------------------------------------------- */
.uz-skel {
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--surface-sunken) 25%,
    var(--surface-2) 37%,
    var(--surface-sunken) 63%
  );
  background-size: 400% 100%;
  animation: uz-shimmer 1.4s ease infinite;
}
@media (prefers-reduced-motion: reduce) {
  .uz-skel {
    animation: none;
  }
}
@keyframes uz-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* ---- Toast / snackbar --------------------------------------------------- */
.uz-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #11171d;
  color: #f4f6f9;
  box-shadow: var(--shadow-3);
  font-size: var(--fs-meta);
}
[data-theme="dark"] .uz-toast {
  background: #2a333d;
  border: 1px solid var(--border-strong);
}
.uz-toast__icon {
  flex: none;
}
.uz-toast__icon--success {
  color: #4fd0aa;
}
.uz-toast__icon--danger {
  color: #ff7b6e;
}
.uz-toast__action {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: var(--fw-bold);
  cursor: pointer;
}
[data-theme="dark"] .uz-toast__action {
  color: var(--accent-hover);
}

/* ---- Empty / error state ----------------------------------------------- */
.uz-state {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  padding: 40px 24px;
}
.uz-state__glyph {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--text-muted);
  margin-bottom: 4px;
}
.uz-state__title {
  margin: 0;
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}
.uz-state__sub {
  margin: 0;
  max-width: 280px;
  font-size: var(--fs-meta);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}

/* ---- Bottom sheet / modal ---------------------------------------------- */
.uz-sheet {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  padding: 8px 16px calc(16px + var(--safe-bottom));
}
.uz-sheet__grip {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 6px auto 12px;
}

/* ---- Progress ----------------------------------------------------------- */
.uz-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.uz-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width var(--dur-base) var(--ease-standard);
}
