/*
 * bel-texts.css — страница «Тексты сайтов» (ZONE-B, ADMIN-DESIGN-SPEC §2.2).
 * Токены --bel-* и .bel-lamp / .bel-lang-label / .bel-sr задаёт bel-admin.css (ZONE-A).
 * Акцент здесь только у фонаря (точка 6 px) и кольца фокуса; активное — чернилами.
 */

.bel-texts {
  --bel-texts-top: 4rem;            /* высота топбара Filament */
  --bel-texts-bar: 4.25rem;         /* высота статус-бара (для рельса и якорей) */
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ───────────────────────── вкладки сайтов ───────────────────────── */
.bel-texts-tabs { position: relative; margin-top: -4px; }
.bel-texts-tabs__list {
  display: flex; gap: 4px; margin: 0; padding: 0; list-style: none;
  border-bottom: 1px solid var(--bel-line);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
  scroll-padding-inline: 16px;
}
.bel-texts-tabs__list::-webkit-scrollbar { display: none; }
.bel-texts-tabs__list > li { flex: none; }
.bel-texts-tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--bel-dim); font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap;
  border-radius: 8px 8px 0 0;
  transition: color 150ms var(--ease-out), background-color 150ms var(--ease-out);
}
.bel-texts-tab__no { font-family: var(--bel-mono); font-size: 11px; letter-spacing: .04em; color: var(--bel-faint); font-variant-numeric: tabular-nums; }
.bel-texts-tab.is-active { color: var(--bel-text); font-weight: 600; border-bottom-color: var(--bel-text); }
.bel-texts-tab.is-active .bel-texts-tab__no { color: var(--bel-dim); }
.bel-texts-tab:focus-visible { outline: 2px solid var(--bel-focus); outline-offset: -2px; }
.bel-texts-tab__lamp { transition: opacity 300ms var(--ease-out); }
.bel-texts-tab__lamp.is-off { opacity: 0; }
@media (hover: hover) and (pointer: fine) {
  .bel-texts-tab:not(.is-active):hover { color: var(--bel-text); background-color: var(--bel-surface-2); }
}

/* ───────────────────────── статус-бар ───────────────────────── */
.bel-statusbar {
  position: sticky; top: calc(var(--bel-texts-top) + 8px); z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding: 12px 12px 12px 18px;
  background-color: var(--bel-surface);
  border: 1px solid var(--bel-line); border-radius: 12px;
  box-shadow: 0 8px 24px -16px rgba(0, 0, 0, .35);
}
.bel-statusbar__text { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; min-width: 0; font-size: 14px; line-height: 1.45; color: var(--bel-dim); }
.bel-statusbar__wrap { display: contents; }
.bel-statusbar__line { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.bel-statusbar__strong { color: var(--bel-text); font-weight: 600; }
.bel-statusbar__meta { color: var(--bel-dim); }
.bel-statusbar__meta .bel-mono { font-size: 13px; }
.bel-statusbar__icon { width: 20px; height: 20px; flex: none; color: var(--bel-dim); }
.bel-statusbar__spin { width: 18px; height: 18px; color: var(--bel-dim); }
.bel-statusbar__actions { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.bel-sb-publish { display: inline-flex; }
.bel-sb-save__short { display: none; }
.bel-statusbar__open { white-space: nowrap; }
.bel-statusbar__open--m { display: none; }

/* правки в форме не сохранены: «Сохранить черновик» — главная, «Опубликовать» — второстепенная */
.bel-statusbar.bel-form-dirty .bel-sb-save.fi-btn {
  background-color: var(--bel-ink); color: var(--bel-on-ink); box-shadow: none;
}
.bel-statusbar.bel-form-dirty .bel-sb-save.fi-btn .fi-icon { color: var(--bel-on-ink); }
.bel-statusbar.bel-form-dirty .bel-sb-publish .fi-btn.fi-color-primary {
  --bg: var(--bel-surface); --dark-bg: var(--bel-surface); --text: var(--bel-text); --dark-text: var(--bel-text);
  --hover-bg: var(--bel-surface-2); --dark-hover-bg: var(--bel-surface-2); --hover-text: var(--bel-text); --dark-hover-text: var(--bel-text);
  box-shadow: inset 0 0 0 1px var(--bel-line-2);
}
@media (hover: hover) and (pointer: fine) {
  .bel-statusbar.bel-form-dirty .bel-sb-save.fi-btn:not([disabled]):hover { background-color: var(--bel-ink-hover); }
}

/* ───────────────────────── поиск и армянский ───────────────────────── */
.bel-texts-tools { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.bel-texts-search { flex: 1 1 22rem; max-width: 40rem; min-height: 44px; }
.bel-texts-search .fi-input { font-size: 15px; }
.bel-texts-search .fi-input::-webkit-search-cancel-button { cursor: pointer; }
.bel-texts-hy {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding-inline: 4px;
  font-size: 14px; color: var(--bel-text); cursor: pointer; user-select: none;
}
.bel-texts-hy .fi-checkbox-input { width: 18px; height: 18px; }
.bel-texts-hy .fi-checkbox-input:focus-visible,
.bel-texts .fi-section-collapse-btn:focus-visible { outline: 2px solid var(--bel-focus) !important; outline-offset: 2px; }
.bel-texts-search .fi-input::placeholder { text-overflow: ellipsis; }
.bel-texts-hy-note .fi-callout-description { color: var(--bel-dim); }

/* ───────────────────────── тело: рельс + разделы ───────────────────────── */
.bel-texts-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.bel-texts-rail { display: none; }
.bel-texts-jump { display: flex; align-items: center; gap: 12px; }
.bel-texts-jump__label { font-size: 14px; color: var(--bel-dim); flex: none; }
.bel-texts-jump__field { flex: 1; min-width: 0; max-width: 24rem; }

@media (min-width: 1024px) {
  .bel-texts-body { grid-template-columns: 13rem minmax(0, 1fr); }
  .bel-texts-jump { display: none; }
  .bel-texts-rail {
    display: block; position: sticky; top: calc(var(--bel-texts-top) + var(--bel-texts-bar) + 24px);
    max-height: calc(100dvh - var(--bel-texts-top) - var(--bel-texts-bar) - 48px); overflow-y: auto;
    padding-bottom: 8px;
  }
}
.bel-texts-rail__title {
  margin: 0 0 8px; padding-inline: 10px;
  font-family: var(--bel-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--bel-faint);
}
.bel-texts-rail__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.bel-texts-rail__list--tail { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--bel-line-2); }
.bel-texts-rail__link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 36px; padding: 6px 10px; border-radius: 6px;
  font-size: 14px; line-height: 1.3; color: var(--bel-dim); text-decoration: none;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.bel-texts-rail__link.is-active { color: var(--bel-text); background-color: var(--bel-surface-2); box-shadow: inset 2px 0 0 var(--bel-text); }
.bel-texts-rail__link:focus-visible { outline: 2px solid var(--bel-focus); outline-offset: 1px; }
.bel-texts-rail__count {
  flex: none; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-family: var(--bel-mono); font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--bel-text); background-color: var(--bel-surface-2); box-shadow: inset 0 0 0 1px var(--bel-line-2);
}
.bel-texts-rail__more { color: var(--bel-faint); font-size: 12px; }
@media (hover: hover) and (pointer: fine) {
  .bel-texts-rail__link:not(.is-active):hover { color: var(--bel-text); background-color: var(--bel-surface-2); }
}

.bel-texts-main { min-width: 0; }
.bel-texts-form { display: block; }
.bel-texts-empty { margin-bottom: 16px; }

/* ───────────────────────── разделы ───────────────────────── */
.bel-texts-sec { scroll-margin-top: calc(var(--bel-texts-top) + var(--bel-texts-bar) + 24px); }
.bel-texts .fi-section { border-radius: 12px; }
.bel-texts-sec[data-bel-top] > .fi-section > .fi-section-header .fi-section-header-heading {
  font-family: var(--bel-display); font-weight: 500; font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.005em;
  color: var(--bel-text);
}
.bel-texts-sec[data-bel-top] > .fi-section > .fi-section-header .fi-section-header-heading:focus { outline: none; }
.bel-texts-sec > .fi-section > .fi-section-header .fi-section-header-description { color: var(--bel-dim); max-width: 70ch; }
.bel-texts-sec:not([data-bel-top]) > .fi-section > .fi-section-header .fi-section-header-heading { font-size: 15px; font-weight: 600; color: var(--bel-text); }
.bel-texts-onsite { font-size: 13px; white-space: nowrap; }
@media (pointer: coarse), (max-width: 767px) { .bel-texts-onsite { min-height: 44px; } }

/* строки внутри раздела: без промежутка сетки, разделитель пунктиром — как подвал карточек хаба */
.bel-texts-sec > .fi-section > .fi-section-content-ctn > .fi-section-content { row-gap: 0; padding-top: 8px; }
.bel-texts-sec > .fi-section > .fi-section-content-ctn > .fi-section-content > .fi-grid-col:not(.bel-is-filtered) ~ .fi-grid-col > .fi-sc-component > .bel-texts-row {
  border-top: 1px dashed var(--bel-line-2);
}
.bel-texts-row { padding-block: 18px; }
.bel-texts-sec > .fi-section > .fi-section-content-ctn > .fi-section-content > .fi-grid-col > .fi-sc-component > .fi-sc-section { padding-top: 12px; }
.bel-texts-sec > .fi-section > .fi-section-content-ctn > .fi-section-content > .fi-grid-col:last-child > .fi-sc-component > .bel-texts-row { padding-bottom: 4px; }
.bel-texts-row > .fi-sc { row-gap: 10px; }
.bel-texts-row__head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; }
.bel-texts-row__label { font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--bel-text); }
.bel-texts-row__changed {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-family: var(--bel-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--bel-dim);
}
.bel-texts-row__hint { margin: 4px 0 0; max-width: 72ch; font-size: 13px; line-height: 1.5; color: var(--bel-dim); }
.bel-texts-dot { display: inline-block; flex: none; width: 6px; height: 6px; border-radius: 50%; background-color: currentColor; color: var(--bel-dim); }
.bel-texts-row .fi-fo-field-label-content { display: inline-flex; align-items: center; }
.bel-texts-row .fi-fo-field { row-gap: 6px; }
.bel-texts-row .fi-fo-field-wrp-hint .fi-link,
.bel-texts-row .fi-fo-field-label-ctn .fi-link { font-size: 12px; }
@media (pointer: coarse), (max-width: 767px) {
  .bel-texts-row .fi-fo-field-wrp-hint .fi-link, .bel-texts-row .fi-fo-field-label-ctn .fi-link { min-height: 32px; padding-inline: 4px; }
}
.bel-texts [data-field-wrapper] { scroll-margin-top: calc(var(--bel-texts-top) + var(--bel-texts-bar) + 32px); }
.bel-texts .fi-input, .bel-texts .fi-fo-textarea textarea { line-height: 1.5; }
.bel-lang-hy { font-family: var(--font-family), 'Noto Sans Armenian', 'Arian AMU', sans-serif; }

/* подписи для диктора и вложенные группы — тише основного */
.bel-texts-sub > .fi-section, .bel-texts-grp .bel-texts-sec > .fi-section { box-shadow: inset 0 0 0 1px var(--bel-line); }
.bel-texts-sub > .fi-section { background-color: transparent; border: 1px dashed var(--bel-line-2); box-shadow: none; }
.bel-texts-sub > .fi-section { margin-top: 0; }

/* поиск: скрытые совпадения (класс ставит Alpine на обёртку строки/раздела) */
.bel-texts .bel-is-filtered { display: none !important; }

/* ───────────────────────── планшет и телефон ───────────────────────── */
@media (max-width: 1023px) {
  .bel-texts { --bel-texts-bar: 7.5rem; }
}

@media (max-width: 767px) {
  .bel-texts { gap: 14px; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .bel-texts-tabs { margin-inline: -16px; }
  .bel-texts-tabs__list { padding-inline: 12px; }
  .bel-texts-tab { padding-inline: 12px; }

  .bel-statusbar { position: static; padding: 12px 14px; box-shadow: none; }
  .bel-statusbar__text { gap: 8px 12px; }
  .bel-statusbar__open { display: none; }
  .bel-statusbar__open--m { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--bel-text); font-size: 14px; font-weight: 500; text-decoration: underline; text-decoration-color: var(--bel-line-2); text-underline-offset: 4px; }

  .bel-statusbar__actions {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background-color: var(--bel-surface); border-top: 1px solid var(--bel-line);
    box-shadow: 0 -10px 24px -18px rgba(0, 0, 0, .45);
  }
  .bel-statusbar__actions .fi-btn { width: 100%; min-height: 44px; padding-inline: 8px; white-space: normal; line-height: 1.2; }
  .bel-statusbar__actions .fi-btn > .fi-icon { display: none; }
  .bel-sb-publish { display: flex; }
  .bel-sb-publish > * { flex: 1; display: flex; }
  .bel-sb-save__long { display: none; }
  .bel-sb-save__short { display: inline; }

  .bel-texts-tools { gap: 8px; }
  .bel-texts-search { flex-basis: 100%; max-width: none; }
  .bel-texts-search .fi-input { font-size: 16px; }
  .bel-texts-jump__field { max-width: none; }
  .bel-texts-jump .fi-select-input { font-size: 16px; min-height: 44px; }

  .bel-texts-sec { scroll-margin-top: calc(var(--bel-texts-top) + 12px); }
  .bel-texts [data-field-wrapper] { scroll-margin-top: calc(var(--bel-texts-top) + 16px); }
  .bel-texts-sec[data-bel-top] > .fi-section > .fi-section-header .fi-section-header-heading { font-size: 1.375rem; }
  .bel-texts-sec > .fi-section > .fi-section-header { flex-wrap: wrap; row-gap: 4px; }
  .bel-texts-sec > .fi-section > .fi-section-header > .fi-section-header-text-ctn { flex: 1 1 calc(100% - 64px); }
  .bel-texts-sec > .fi-section > .fi-section-header > .fi-section-header-after-ctn { order: 3; flex-basis: 100%; margin-top: -6px; }
  .bel-texts-row__label { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .bel-texts-tab__lamp { transition-duration: 120ms; }
  .bel-texts-tab, .bel-texts-rail__link { transition: none; }
}
