/* ==========================================================================
   admin.css — стиль A (iOS Settings)
   ВНИМАНИЕ: имена классов НЕ менять — на них завязан form.html (JS-билдеры,
   сериализация, pell). Список (list.html) самодостаточен и использует отсюда
   только body + .container.
   ========================================================================== */

:root{
  --sf: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', ui-monospace, Menlo, monospace;
  --page:#f2f2f7;
  --card:#fff;
  --ink:#1c1c1e;
  --sub:#8a8a8e;
  --sub2:#6b7280;
  --line:#e5e5ea;
  --field:#f2f2f7;
  --blue:#007aff;
  --danger:#ff3b30;
  --green:#34c759;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sf);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}
.container--edit { max-width: 1400px; }

/* ── Edit: две колонки (форма + залипающее превью) ── */
.edit-layout { display: flex; gap: 28px; align-items: flex-start; }
.edit-form-col { width: 820px; flex-shrink: 0; }
.edit-preview-col {
  flex: 1; min-width: 0; position: sticky; top: 0; height: 100vh;
  overflow: hidden; padding: 20px 0; box-sizing: border-box;
}
.preview-pane { height: 100%; display: flex; flex-direction: column; }
.preview-pane__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; flex-shrink: 0;
}
.preview-pane__label { font-size: 13px; font-weight: 600; color: var(--sub2); }
.preview-pane iframe {
  flex: 1 1 auto; align-self: center;
  width: 390px; min-width: 390px; max-width: 390px; flex-shrink: 0; min-height: 0;
  border: 1px solid var(--line); border-radius: 22px; background: #fff; display: block;
}

/* ── Заголовки ── */
h1 { font-size: 22px; margin: 0 0 24px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 32px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 10px; }

.top-bar {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px;
}
.top-bar h1 { margin: 0; font-size: 24px; font-weight: 700; }

/* ── Кнопки ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 18px; border-radius: 11px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .13s, opacity .13s, transform .05s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #0a84ff; }
.btn-success { background: var(--blue); color: #fff; box-shadow: 0 6px 16px -6px rgba(0,122,255,.5); }
.btn-success:hover { background: #0a84ff; }
.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-outline:hover { background: var(--field); }
.btn-copy { background: var(--field); color: var(--ink); }
.btn-copy:hover { background: #e8e8ed; }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: 9px; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  transition: background .13s; text-decoration: none; flex-shrink: 0;
}
.btn-icon:hover { background: var(--field); text-decoration: none; }

/* ── Устаревшее (список теперь самодостаточен). Оставлено безвредным. ── */
.card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--field); text-align: left; padding: 10px 16px; font-size: 13px; color: var(--sub2); }
td { padding: 12px 16px; border-top: 1px solid var(--line); }
.slug-badge { font-family: var(--mono); background: var(--field); padding: 2px 7px; border-radius: 5px; font-size: 13px; }

/* ── Карточка / секция формы ── */
.form-card {
  background: var(--card); border-radius: 16px; padding: 22px 24px; margin-bottom: 16px;
}
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

label { display: block; font-size: 13px; font-weight: 600; color: #3a3a3c; margin-bottom: 7px; }

input[type="text"], input[type="url"], textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid #d8d8df; border-radius: 11px;
  font-size: 15px; font-family: inherit; color: var(--ink); background: var(--field);
  transition: border-color .13s, background .13s, box-shadow .13s;
}
input::placeholder, textarea::placeholder { color: #b6b6bb; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(0,122,255,.12);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.title-area {
  resize: none;
  overflow: hidden;
  min-height: 44px;
  line-height: 1.35;
  font-family: inherit;
}
select {
  appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a8e' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}

.hint { font-size: 12px; color: #9ca3af; margin-top: 6px; line-height: 1.45; }

/* Радио/чекбоксы — нативные, iOS-синий акцент */
input[type="radio"], input[type="checkbox"] { accent-color: var(--blue); width: 17px; height: 17px; }

.radio-group { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.radio-option {
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14.5px; font-weight: 500;
  background: var(--field); border: 1px solid transparent; border-radius: 11px; padding: 11px 14px;
  transition: background .13s, border-color .13s;
}
.radio-option:hover { background: #ebebf0; }
.radio-option:has(input:checked) { background: #fff; border-color: var(--blue); }

/* Контакты */
.contact-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.toggle-label {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500;
  min-width: 120px; cursor: pointer;
}
.contact-row input[type="text"], .contact-row input[type="url"] { flex: 1; margin: 0; }

/* ── Конструктор блоков ── */
.block-section {
  border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; background: #fff;
}
.block-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.block-header label { margin: 0; font-weight: 700; min-width: 60px; color: var(--sub2); font-size: 13px; }
.block-header select { flex: 1; margin: 0; }

.block-move { display: flex; gap: 4px; flex-shrink: 0; }
.btn-move {
  width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--sub); font-size: 14px; line-height: 1; cursor: pointer;
  transition: background .13s, border-color .13s, color .13s;
}
.btn-move:hover:not(:disabled) { background: #eef4ff; border-color: #bcd6ff; color: var(--blue); }
.btn-move:disabled { opacity: .4; cursor: not-allowed; }

.btn-eye {
  width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; font-size: 15px; line-height: 1; cursor: pointer; flex-shrink: 0;
  transition: background .13s, border-color .13s;
}
.btn-eye:hover { background: #eef4ff; border-color: #bcd6ff; }
.btn-eye.is-hidden { background: #fff0ef; border-color: #f4b8b3; }

.block-section.block-hidden { opacity: .55; }
.block-section.block-hidden:focus-within { opacity: 1; }
.block-hidden-badge {
  display: none; flex-shrink: 0; padding: 3px 9px; border-radius: 999px;
  background: #fde6e4; color: var(--danger); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
}
.block-section.block-hidden .block-hidden-badge { display: inline-block; }

.block-fields { display: none; }
.block-fields.active { display: block; }

/* Элемент-кейс — плоский: без карточки и тени, только тонкая линия-разделитель
   сверху. Поля серые единым ритмом на белом блоке. */
.item-row {
  background: transparent; border: none; border-radius: 0; box-shadow: none;
  padding: 14px 12px; margin: 0; position: relative;
  border-top: 1px solid var(--line);
}
.item-row input[type="text"], .item-row textarea, .item-row input[type="url"] {
  background: var(--field); margin-bottom: 9px;
}
.item-row input[type="text"]:last-of-type, .item-row textarea:last-of-type { margin-bottom: 0; }
.item-row input:focus, .item-row textarea:focus { background: #fff; }

.btn-remove {
  position: absolute; top: 8px; right: 8px; background: #fff0ef; color: var(--danger);
  border: none; border-radius: 7px; width: 26px; height: 26px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0; transition: background .13s;
}
.btn-remove:hover { background: #ffdedb; }

.add-item-btn {
  width: 100%; padding: 11px; background: #fff; color: var(--blue);
  border: 1px dashed #b9d6ff; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; margin-top: 8px; transition: background .13s;
}
.add-item-btn:hover { background: #f5faff; }

/* Загрузка */
.upload-row { display: flex; gap: 8px; align-items: center; }
.upload-row input[type="text"] { flex: 1; margin: 0; }
.btn-upload {
  padding: 10px 13px; background: var(--field); color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; font-size: 13px; white-space: nowrap; transition: background .13s;
}
.btn-upload:hover { background: #e8e8ed; }
.img-preview { max-height: 60px; border-radius: 8px; margin-top: 6px; display: block; }

/* Ошибки */
.error-banner {
  background: #fff0ef; color: #b91c1c; border: 1px solid #f4b8b3; border-radius: 11px;
  padding: 12px 16px; margin-bottom: 20px; font-size: 14px;
}

/* ИИ-интейк */
.btn-ai {
  background: #5e5ce6; color: #fff; width: 100%; padding: 12px; font-size: 14px; margin-top: 4px;
  justify-content: center;
}
.btn-ai:hover { background: #514fd6; }
.btn-ai:disabled { opacity: .5; cursor: not-allowed; }

/* Provenance-бейджи */
.prov-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; vertical-align: middle; }
.prov-site { background: #dcfce7; color: #15803d; }
.prov-reworded { background: #fef3c7; color: #92400e; }
.prov-invented { background: #fee2e2; color: #b91c1c; }
.prov-toggle-btn { background: none; border: none; font-size: 11px; color: var(--sub2); cursor: pointer; margin-left: 6px; padding: 0; }
.prov-toggle-btn:hover { color: #374151; }

/* Залипающая нижняя панель (в шаблоне сейчас не используется — оставлено) */
.sticky-bottom {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 16px 24px; display: flex; gap: 12px; margin: 0 -24px -22px; border-radius: 0 0 16px 16px;
}

.btn-tpl {
  display: inline-block; margin-bottom: 8px; padding: 8px 14px; background: #fff; color: var(--blue);
  border: 1px solid var(--line); border-radius: 9px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background .13s;
}
.btn-tpl:hover { background: var(--field); }

/* ==========================================================================
   Секции формы: полоса слева + номер в кружке (навигация по длинной форме).
   Механика сохранена, оформление приведено к A (мягкие тона iOS).
   ========================================================================== */
.form-card--section {
  position: relative; border-radius: 16px;
}
.form-card--section::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--sec-color, #888);
}
.form-card--section > h2 {
  display: flex; align-items: center; gap: 12px; margin-top: 0; font-size: 17px; font-weight: 650;
  color: var(--ink);
}
.form-card--section > h2::before {
  content: attr(data-sec); flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px;
  background: var(--sec-bg, #eee); color: var(--sec-color, #333);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.form-card--section[data-sec="1"]{ --sec-color:#007aff; --sec-bg:#e5f0ff; }
.form-card--section[data-sec="2"]{ --sec-color:#30b0c7; --sec-bg:#e2f5f8; }
.form-card--section[data-sec="3"]{ --sec-color:#34c759; --sec-bg:#e4f8ea; }
.form-card--section[data-sec="4"]{ --sec-color:#5e5ce6; --sec-bg:#ecebfd; }
.form-card--section[data-sec="5"]{ --sec-color:#ff9500; --sec-bg:#fff1e0; }
