/* ═══════════════════════════════════════════════════════════════════════
 * utilities.css — Atomic utility classes (Tailwind-style, v200.0)
 *
 * Заменяют inline-стили. ВСЕ значения — из design-tokens.css.
 * Префикс u- (utility) чтобы не конфликтовать с legacy.
 *
 * Покрывает:
 *  - Layout: flex, grid, block, hidden
 *  - Spacing: m/p (0-24 по 8px-grid)
 *  - Sizing: w/h
 *  - Typography: text-{xs,sm,md,lg,xl}, font-{normal,medium,semibold,bold}
 *  - Colors: text-{muted,text,text-2,text-3,accent,success,...}, bg-{surface,surface-2,...}
 *  - Border: border, rounded-{sm,md,lg,xl,full}
 *  - Effects: shadow-{xs,sm,md,lg,xl}, opacity
 *  - Flexbox: items, justify, gap
 *  - Overflow, position
 * ═══════════════════════════════════════════════════════════════════════ */

/* ─── DISPLAY ─── */
.u-block       { display: block; }
.u-inline      { display: inline; }
.u-inline-block{ display: inline-block; }
.u-flex        { display: flex; }
.u-inline-flex { display: inline-flex; }
.u-grid        { display: grid; }
.u-hidden      { display: none !important; }

/* ─── FLEX direction / wrap ─── */
.u-flex-row    { flex-direction: row; }
.u-flex-col    { flex-direction: column; }
.u-flex-wrap   { flex-wrap: wrap; }
.u-flex-nowrap { flex-wrap: nowrap; }
.u-flex-1      { flex: 1 1 0%; }
.u-flex-auto   { flex: 1 1 auto; }
.u-flex-none   { flex: none; }
.u-flex-shrink-0 { flex-shrink: 0; }

/* ─── JUSTIFY / ALIGN ─── */
.u-justify-start   { justify-content: flex-start; }
.u-justify-center  { justify-content: center; }
.u-justify-end     { justify-content: flex-end; }
.u-justify-between { justify-content: space-between; }
.u-justify-around  { justify-content: space-around; }
.u-items-start     { align-items: flex-start; }
.u-items-center    { align-items: center; }
.u-items-end       { align-items: flex-end; }
.u-items-stretch   { align-items: stretch; }
.u-items-baseline  { align-items: baseline; }
.u-self-start      { align-self: flex-start; }
.u-self-center     { align-self: center; }
.u-self-end        { align-self: flex-end; }

/* ─── GAP (8px grid) ─── */
.u-gap-0  { gap: var(--sp-0); }
.u-gap-1  { gap: var(--sp-1); }
.u-gap-2  { gap: var(--sp-2); }
.u-gap-3  { gap: var(--sp-3); }
.u-gap-4  { gap: var(--sp-4); }
.u-gap-5  { gap: var(--sp-5); }
.u-gap-6  { gap: var(--sp-6); }
.u-gap-8  { gap: var(--sp-8); }

/* ─── PADDING ─── */
.u-p-0  { padding: 0; }
.u-p-1  { padding: var(--sp-1); }
.u-p-2  { padding: var(--sp-2); }
.u-p-3  { padding: var(--sp-3); }
.u-p-4  { padding: var(--sp-4); }
.u-p-5  { padding: var(--sp-5); }
.u-p-6  { padding: var(--sp-6); }
.u-px-1 { padding-left: var(--sp-1); padding-right: var(--sp-1); }
.u-px-2 { padding-left: var(--sp-2); padding-right: var(--sp-2); }
.u-px-3 { padding-left: var(--sp-3); padding-right: var(--sp-3); }
.u-px-4 { padding-left: var(--sp-4); padding-right: var(--sp-4); }
.u-px-5 { padding-left: var(--sp-5); padding-right: var(--sp-5); }
.u-py-1 { padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
.u-py-2 { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.u-py-3 { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.u-py-4 { padding-top: var(--sp-4); padding-bottom: var(--sp-4); }

/* ─── MARGIN ─── */
.u-m-0   { margin: 0; }
.u-m-auto{ margin: auto; }
.u-ml-auto{ margin-left: auto; }
.u-mr-auto{ margin-right: auto; }
.u-mt-1  { margin-top: var(--sp-1); }
.u-mt-2  { margin-top: var(--sp-2); }
.u-mt-3  { margin-top: var(--sp-3); }
.u-mt-4  { margin-top: var(--sp-4); }
.u-mb-1  { margin-bottom: var(--sp-1); }
.u-mb-2  { margin-bottom: var(--sp-2); }
.u-mb-3  { margin-bottom: var(--sp-3); }
.u-mb-4  { margin-bottom: var(--sp-4); }

/* ─── WIDTH / HEIGHT ─── */
.u-w-full { width: 100%; }
.u-w-auto { width: auto; }
.u-w-fit  { width: fit-content; }
.u-h-full { height: 100%; }
.u-h-auto { height: auto; }
.u-h-screen { height: 100vh; }
.u-min-w-0 { min-width: 0; }
.u-max-w-full { max-width: 100%; }

/* ─── TYPOGRAPHY ─── */
.u-text-xs  { font-size: var(--fs-xs); }
.u-text-sm  { font-size: var(--fs-sm); }
.u-text-md  { font-size: var(--fs-md); }
.u-text-lg  { font-size: var(--fs-lg); }
.u-text-xl  { font-size: var(--fs-xl); }
.u-text-2xl { font-size: var(--fs-2xl); }

.u-font-normal   { font-weight: var(--fw-normal); }
.u-font-medium   { font-weight: var(--fw-medium); }
.u-font-semibold { font-weight: var(--fw-semibold); }
.u-font-bold     { font-weight: var(--fw-bold); }

.u-leading-tight  { line-height: var(--lh-tight); }
.u-leading-snug   { line-height: var(--lh-snug); }
.u-leading-normal { line-height: var(--lh-normal); }

.u-text-left   { text-align: left; }
.u-text-center { text-align: center; }
.u-text-right  { text-align: right; }
.u-uppercase   { text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.u-truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.u-tabular { font-variant-numeric: tabular-nums; }

/* ─── COLORS ─── */
.u-text       { color: var(--text); }
.u-text-2     { color: var(--text-2); }
.u-text-3     { color: var(--text-3); }
.u-text-muted { color: var(--muted); }
.u-text-accent{ color: var(--accent); }
.u-text-success{ color: var(--success); }
.u-text-warn  { color: var(--warn); }
.u-text-danger{ color: var(--danger); }
.u-text-info  { color: var(--info); }
.u-text-white { color: white; }

.u-bg         { background: var(--bg); }
.u-bg-surface { background: var(--surface); }
.u-bg-surface-2{ background: var(--surface-2); }
.u-bg-surface-3{ background: var(--surface-3); }
.u-bg-accent  { background: var(--accent); }
.u-bg-success-soft { background: var(--success-soft); }
.u-bg-warn-soft   { background: var(--warn-soft); }
.u-bg-danger-soft { background: var(--danger-soft); }
.u-bg-info-soft   { background: var(--info-soft); }
.u-bg-accent-soft { background: var(--accent-soft); }

/* ─── BORDER ─── */
.u-border        { border: 1px solid var(--border); }
.u-border-2      { border: 1px solid var(--border-2); }
.u-border-t      { border-top: 1px solid var(--border); }
.u-border-b      { border-bottom: 1px solid var(--border); }
.u-border-l      { border-left: 1px solid var(--border); }
.u-border-r      { border-right: 1px solid var(--border); }
.u-border-none   { border: none; }
.u-border-accent { border-color: var(--accent); }
.u-border-danger { border-color: var(--danger); }

.u-rounded-none { border-radius: 0; }
.u-rounded-sm   { border-radius: var(--r-sm); }
.u-rounded-md   { border-radius: var(--r-md); }
.u-rounded-lg   { border-radius: var(--r-lg); }
.u-rounded-xl   { border-radius: var(--r-xl); }
.u-rounded-2xl  { border-radius: var(--r-2xl); }
.u-rounded-full { border-radius: var(--r-full); }

/* ─── SHADOW ─── */
.u-shadow-none { box-shadow: none; }
.u-shadow-xs   { box-shadow: var(--shadow-xs); }
.u-shadow-sm   { box-shadow: var(--shadow-sm); }
.u-shadow-md   { box-shadow: var(--shadow-md); }
.u-shadow-lg   { box-shadow: var(--shadow-lg); }
.u-shadow-xl   { box-shadow: var(--shadow-xl); }

/* ─── OVERFLOW / POSITION ─── */
.u-overflow-hidden { overflow: hidden; }
.u-overflow-auto   { overflow: auto; }
.u-overflow-y-auto { overflow-y: auto; }
.u-overflow-x-auto { overflow-x: auto; }

.u-relative { position: relative; }
.u-absolute { position: absolute; }
.u-fixed    { position: fixed; }
.u-sticky   { position: sticky; }
.u-inset-0  { inset: 0; }
.u-top-0    { top: 0; }
.u-bottom-0 { bottom: 0; }
.u-left-0   { left: 0; }
.u-right-0  { right: 0; }

/* ─── CURSOR ─── */
.u-cursor-pointer { cursor: pointer; }
.u-cursor-default { cursor: default; }
.u-cursor-not-allowed { cursor: not-allowed; }
.u-select-none { user-select: none; }

/* ─── OPACITY ─── */
.u-opacity-0   { opacity: 0; }
.u-opacity-50  { opacity: 0.5; }
.u-opacity-75  { opacity: 0.75; }
.u-opacity-100 { opacity: 1; }

/* ─── TRANSITIONS ─── */
.u-transition       { transition: all var(--duration-fast) var(--ease-out); }
.u-transition-base  { transition: all var(--duration-base) var(--ease-out); }
.u-transition-slow  { transition: all var(--duration-slow) var(--ease-out); }

/* ─── RESPONSIVE — mobile-first breakpoints ─── */

@media (min-width: 768px) {
  .md\:u-flex  { display: flex; }
  .md\:u-hidden{ display: none !important; }
  .md\:u-block { display: block; }
}
@media (min-width: 1024px) {
  .lg\:u-flex   { display: flex; }
  .lg\:u-hidden { display: none !important; }
  .lg\:u-flex-row { flex-direction: row; }
  .lg\:u-flex-col { flex-direction: column; }
}

/* ─── ACCESSIBILITY ─── */
.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.u-focus-ring:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ─── v199.339 H1 ДОБАВЛЕНИЯ — топ inline-style паттерны ─── */
.u-border-all  { border: 1px solid var(--border); }
.u-gap-1-5     { gap: 6px; }   /* промежуточное между gap-1 (4px) и gap-2 (8px) */
.u-h-input     { height: 32px; }   /* стандартный input/button height */
.u-h-input-lg  { height: 40px; }
.u-z-modal     { z-index: 1000; }
.u-z-overlay   { z-index: 9998; }
.u-z-panel     { z-index: 9999; }
.u-z-toast     { z-index: 10000; }

/* v199.340 H1 phase 2: дополнительные utility-классы для остатка inline-style */
.u-h-32 { height: 32px; }
.u-h-30 { height: 30px; }
.u-h-28 { height: 28px; }
.u-h-26 { height: 26px; }
.u-h-24 { height: 24px; }
.u-w-100 { width: 100%; }
.u-flex-end { display: flex; justify-content: flex-end; }
.u-flex-between { display: flex; align-items: center; justify-content: space-between; }
.u-flex-col-gap { display: flex; flex-direction: column; gap: 6px; }
.u-input-32 { height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 0 10px; }
.u-px-10 { padding: 0 10px; }
.u-px-12 { padding: 0 12px; }
.u-rounded-6 { border-radius: 6px; }
.u-bg-surface2 { background: var(--surface2); }
.u-text-fz-11 { font-size: 11px; }
.u-text-fz-12 { font-size: 12px; }
.u-text-fz-13 { font-size: 13px; }
.u-color-red { color: var(--red); }
.u-color-accent { color: var(--accent); }
.u-color-text2 { color: var(--text2); }
.u-color-text3 { color: var(--text3); }
