/* Вынесено из tema/rankedin_new/tournament_apply.tpl — 20261108, 1:1 без изменений.
   Правки стилей теперь только здесь, в tpl CSS не возвращать. */

/* === source: tournament_apply.tpl (строки 45–452) === */

  /* Вертикальный ритм полей: вопросы рендерятся внутрь .apply-page (JS), поэтому
     отступ между ними задаёт сам .apply-page — иначе label прилипает к полю выше. */
  #apply-fields { display: flex; flex-direction: column; gap: 20px; margin-top: 24px; }
  .apply-page { display: flex; flex-direction: column; gap: 20px; }
  .apply-page > .apply-block { margin-top: 0; }

  .apply-field label,
  .apply-q-label, .apply-sub-label {
    display: block; font-size: 13px; font-weight: 700; color: var(--text);
    margin-bottom: 7px; letter-spacing: 0.2px; line-height: 1.35;
  }
  .apply-field label .req, .apply-q-label .req, .apply-sub-label .req { color: var(--danger, #e5484d); }
  .apply-field input[type="text"],
  .apply-field input[type="email"],
  .apply-field input[type="tel"],
  .apply-field input[type="date"],
  .apply-field input[type="number"],
  .apply-field textarea,
  .apply-field select {
    width: 100%; padding: 11px 14px; border: 1px solid var(--surface-border);
    border-radius: var(--r-sm, 8px); background: var(--surface);
    color: var(--text); font-size: 14px; font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
  }
  .apply-field textarea { min-height: 90px; resize: vertical; }
  .apply-field input:focus, .apply-field textarea:focus, .apply-field select:focus {
    outline: none; border-color: var(--teal, #2aa08a); box-shadow: 0 0 0 3px rgba(42,160,138,.15);
  }
  .apply-field input.invalid, .apply-field textarea.invalid, .apply-field select.invalid,
  .apply-field .choice.invalid {
    border-color: var(--danger, #e5484d) !important;
  }
  .apply-field-error { color: var(--danger, #e5484d); font-size: 12px; margin-top: 5px; }
  .apply-field-hint { font-size: 12px; color: var(--text-subtle); margin-top: 4px; }

  /* Форма после дедлайна показывается, но неактивна */
  .apply-field input:disabled, .apply-field textarea:disabled, .apply-field select:disabled,
  .apply-series-add:disabled { opacity: .65; cursor: not-allowed; }

  /* Заголовок шага (схема v2): «Шаг N» + название (фолбэк — только «Шаг N») */
  .apply-page-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 17px;
    font-weight: 800;
    color: var(--teal, #2aa08a);
    margin: 10px 0 -4px;
    line-height: 1.4;
  }
  .apply-page-title .apply-step-num { white-space: nowrap; }
  .apply-page-title .apply-step-name { color: var(--text); font-weight: 700; }
  .apply-page-title .apply-step-name::before {
    content: '·';
    margin-right: 8px;
    color: var(--text-muted);
    font-weight: 800;
  }

  /* Картинка вопроса / подпись */
  .apply-q-img { display: block; max-width: 100%; max-height: 180px; border-radius: var(--r-sm, 8px);
    border: 1px solid var(--surface-border); margin: 0 auto 10px; object-fit: cover; }
  .apply-image { text-align: center; }
  .apply-image-title { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

  /* Текстовый блок (без ответа) */
  .apply-textblock { color: var(--text); font-size: 15px; line-height: 1.6; }
  .apply-textblock-header { font-size: 19px; font-weight: 800; text-align: center; margin: 6px 0; }

  /* Шкала (звёзды 1..N) */
  .apply-scale { display: flex; gap: 6px; flex-wrap: wrap; }
  .apply-star { font-size: 26px; line-height: 1; color: var(--surface-border); cursor: pointer;
    transition: transform .1s, color .1s; }
  .apply-star.on { color: #f59e0b; }
  .apply-star:hover { transform: scale(1.15); }

  /* Серия (повторяемые строки) */
  .apply-series { border: 1px solid var(--surface-border); border-radius: var(--r-md, 14px);
    padding: 16px 18px; background: var(--surface); }
  .apply-series-rows { display: flex; flex-direction: column; gap: 12px; }
  .apply-series-row { border: 1px solid var(--surface-border); border-radius: var(--r-sm, 8px);
    padding: 14px; background: var(--surface); }
  .apply-series-row-head { display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .05em; margin-bottom: 12px; }
  .apply-series-del { border: none; background: none; color: var(--text-subtle); font-size: 18px;
    line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 4px; transition: color .15s; }
  .apply-series-del:hover { color: var(--danger, #e5484d); }
  .apply-series-add { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
    padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--teal, #2aa08a);
    background: transparent; border: 1px dashed var(--teal, #2aa08a); border-radius: var(--r-sm, 8px);
    cursor: pointer; transition: background .15s; }
  .apply-series-add:hover { background: rgba(42,160,138,.08); }
  .apply-series-sub { margin-bottom: 12px; }
  .apply-series-sub:last-child { margin-bottom: 0; }
  .apply-series-sub .apply-q-img { max-width: 100%; margin: 0 auto 8px; }

  /* Файл — заглушка (публичная загрузка отложена) */
  .apply-file-note { font-size: 12px; color: var(--text-subtle); margin-top: 6px; }
  .apply-field input[type="file"]:disabled { opacity: .6; cursor: not-allowed; }

  .apply-field .choice, .apply-block .choice { border: 1px solid var(--surface-border); border-radius: var(--r-sm, 8px);
    padding: 10px 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; cursor: pointer;
    background: var(--surface); transition: border-color .15s ease; }
  .apply-field .choice:hover, .apply-block .choice:hover { border-color: var(--teal, #2aa08a); }
  .apply-field .choice.checked, .apply-block .choice.checked { border-color: var(--teal, #2aa08a); background: rgba(42,160,138,.05); }
  .apply-field .choice input, .apply-block .choice input { margin: 0; }

  /* Список категорий: те же карточки-опции, что и у radio/checkbox в полях */
  #apply-categories { display: flex; flex-direction: column; gap: 8px; }
  #apply-categories .choice { margin-bottom: 0; }

  .apply-block { margin-top: 26px; }
  .apply-block-title { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
  .apply-categories-counter { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--teal, #2aa08a); }
  .apply-categories-counter:empty { display: none; }
  .apply-categories-counter.maxed { color: var(--danger, #e5484d); }
  .apply-cat-badge { display: inline-block; font-size: 11px; font-weight: 600; color: var(--teal, #2aa08a);
    background: rgba(42,160,138,.1); border-radius: 99px; padding: 2px 8px; margin-left: 6px; }

  .apply-captcha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .apply-captcha img { border: 1px solid var(--surface-border); border-radius: var(--r-sm, 8px); cursor: pointer; }
  .apply-captcha input { width: 180px; padding: 10px 12px; border: 1px solid var(--surface-border);
    border-radius: var(--r-sm, 8px); background: var(--surface); color: var(--text); font-size: 14px; }

  /* ── Футер действий: пагинация сверху, «Отправить» справа ── */
  .apply-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
  }
  .apply-actions:empty { display: none; }

  .apply-actions #apply-submit {
    padding: 14px 30px;
    font-size: 16px;
    min-height: 48px;
    border-radius: var(--r-md);
  }
  .apply-actions #apply-submit:hover {
    background: var(--teal-light);
    box-shadow: var(--shadow-lg);
  }
  .apply-actions #apply-submit:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
  }
  .apply-actions #apply-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
  }

  /* ── Кнопки навигации по шагам: «← Назад» (вторичная) / «Далее →» (основная) ── */
  .apply-pagination .apply-page-btn {
    min-height: 44px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--r-sm, 8px);
  }
  .apply-pagination .apply-page-btn.apply-page-prev {
    color: var(--teal, #2aa08a);
    background: transparent;
    border: 1px solid var(--teal, #2aa08a);
  }
  .apply-pagination .apply-page-btn.apply-page-prev:hover {
    background: var(--surface-hover);
    color: var(--teal, #2aa08a);
  }
  .apply-pagination .apply-page-btn.apply-page-next {
    color: #fff;
    background: var(--teal, #2aa08a);
    border-color: var(--teal, #2aa08a);
  }
  .apply-pagination .apply-page-btn.apply-page-next:hover {
    background: var(--teal-light);
    box-shadow: var(--shadow-lg);
  }
  .apply-pagination .apply-page-btn:focus-visible {
    outline: 2px solid var(--teal, #2aa08a);
    outline-offset: 2px;
  }
  .apply-pagination .apply-page-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    box-shadow: none;
  }

  @media (max-width: 600px) {
    .apply-actions #apply-submit { width: 100%; }
    .apply-pagination .apply-page-btn { min-height: 44px; }
  }
  @media (max-width: 480px) {
    .apply-pagination .apply-page-btn { min-width: 0; flex: 1 1 0; padding: 10px 12px; font-size: 13px; }
    .apply-pagination .apply-page-counter { white-space: nowrap; }
  }
  .apply-error { background: rgba(229,72,77,.08); border: 1px solid var(--danger, #e5484d);
    border-radius: var(--r-sm, 8px); color: var(--danger, #e5484d); padding: 12px 16px;
    font-size: 14px; margin-top: 20px; }

  #apply-success { text-align: center; padding: 40px 20px; }
  .apply-success-head { display: inline-flex; align-items: center; gap: 12px; }
  .apply-success-icon { font-size: 32px; color: var(--teal, #2aa08a); }
  .apply-success-title { font-size: 20px; font-weight: 800; }
  .apply-success-text { color: var(--text-muted); margin: 8px 0 20px; }

  /* ═══════════════════════════════════════════════════════════════════
     Поиск участника: выпадающий список результатов + карточка выбора
     Токены формы: --surface / --surface-hover / --surface-border,
     --text / --text-muted, --r-sm / --r-md, --shadow-lg, --teal.
     ═══════════════════════════════════════════════════════════════════ */

  /* Родитель для абсолютного списка. Отдельное правило — существующие
     .apply-field > * не трогаем. */
  .apply-field { position: relative; }

  /* Мелкий текст-акцент: --teal (#0d9488) на белом даёт 3.7:1 — ниже AA.
     Поэтому локальный токен: светлая тема — тёмный teal (5.5:1),
     тёмная тема — светлый teal (7.9:1). */
  .apply-person-search,
  .apply-person-card {
    --person-accent: #0f766e;
  }
  [data-theme="dark"] .apply-person-search,
  [data-theme="dark"] .apply-person-card {
    --person-accent: var(--teal-light, #5eead4);
  }

  /* ── Выпадающий список (position:absolute внутри .apply-field) ── */
  .apply-person-search {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 120;
    margin-top: 6px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--r-md, 14px);
    box-shadow: var(--shadow-lg);
    max-height: min(320px, 45vh);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* Пункт списка: аватар + ФИО + мета + подсказка */
  .apply-person-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--r-sm, 8px);
    cursor: pointer;
    transition: background-color .15s ease;
  }
  .apply-person-item:hover { background: var(--surface-hover); }
  .apply-person-item:focus-visible {
    outline: 2px solid var(--teal, #0d9488);
    outline-offset: -2px;
  }

  /* Выбранный / активный пункт — акцент teal */
  .apply-person-item.is-active,
  .apply-person-item.is-selected,
  .apply-person-item[aria-selected="true"] {
    background: var(--teal-glow, rgba(13, 148, 136, .12));
  }
  .apply-person-item.is-active::before,
  .apply-person-item.is-selected::before,
  .apply-person-item[aria-selected="true"]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--teal, #0d9488);
  }

  .apply-person-item__avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-hover);
    border: 1px solid var(--surface-border);
  }
  .apply-person-item__body {
    flex: 1 1 auto;
    min-width: 0;
  }
  .apply-person-item__name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .apply-person-item__meta {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .apply-person-item__hint {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--person-accent);
    white-space: nowrap;
  }

  /* Пустой результат поиска */
  .apply-person-search__empty {
    padding: 14px 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-muted);
    text-align: center;
  }

  /* ── Карточка выбранного человека ── */
  /* display задаём только когда атрибут hidden снят — иначе перебьём
     браузерное [hidden]{display:none} и блок «залипнет» видимым. */
  .apply-person-card:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 12px;
    /* карточка — сосед .apply-field внутри .apply-page (обычный блок, без gap) */
    margin: 12px 0 18px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-left: 3px solid var(--teal, #0d9488);
    border-radius: var(--r-md, 14px);
  }
  .apply-person-card__avatar {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-hover);
    border: 1px solid var(--surface-border);
  }
  .apply-person-card__body {
    flex: 1 1 auto;
    min-width: 0;
  }
  .apply-person-card__name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    overflow-wrap: anywhere;
  }
  .apply-person-card__meta {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
    overflow-wrap: anywhere;
  }
  .apply-person-card__link {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--person-accent);
    text-decoration: none;
    border: 1px solid var(--person-accent);
    border-radius: var(--r-sm, 8px);
    transition: background-color .15s ease;
  }
  .apply-person-card__link:hover {
    background: var(--teal-glow, rgba(13, 148, 136, .12));
  }
  .apply-person-card__link:focus-visible {
    outline: 2px solid var(--teal, #0d9488);
    outline-offset: 2px;
  }

  /* ── Адаптив: узкие экраны ── */
  @media (max-width: 600px) {
    .apply-person-item { gap: 10px; padding: 8px; }
    .apply-person-item__hint { display: none; }
    .apply-person-card:not([hidden]) {
      flex-wrap: wrap;
      row-gap: 10px;
      padding: 10px 12px;
    }
    .apply-person-card__body { flex: 1 1 0; }
    .apply-person-card__link { flex: 1 1 100%; text-align: center; }
  }
