/* ============================================================
   Ползунок «Я не робот» — модуль темы (вход, регистрация, заказ, комментарии)
   Тот же вид, что у плашки Silent Guard в заявках CF7: на одной странице
   встречаются обе, и выглядеть они должны одинаково.
   Палитра бренда: navy #1E3A5F, coral #EA580C.
   ============================================================ */

.pas {
  --pas-navy: #1E3A5F;
  --pas-coral: #EA580C;
  --pas-ink: #1E3A5F;
  --pas-muted: #5b6b80;
  --pas-line: #d9e1ea;
  --pas-bg: #fff;
  --pas-err: #c2410c;
  --pas-x: 0px;

  position: relative;
  container-type: inline-size;
  margin-block: 14px;
  font-family: inherit;
  text-align: left;
}

/* Ловушка: не display:none — часть ботов пропускает скрытые поля. */
.pas__trap {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.pas__box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--pas-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f6f8fb);
  box-shadow: 0 1px 2px rgb(30 58 95 / .06), 0 8px 20px -14px rgb(30 58 95 / .45);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.pas:not(.is-done) .pas__box:hover { border-color: #b9c7d8; }

.pas.is-done .pas__box {
  border-color: rgb(234 88 12 / .45);
  background: linear-gradient(180deg, #fff, #fff6f0);
}

.pas.is-error .pas__box { border-color: var(--pas-err); }

/* ---------- Дорожка ---------- */

.pas__track {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgb(30 58 95 / .09), rgb(30 58 95 / .03));
  box-shadow: inset 0 1px 2px rgb(30 58 95 / .08);
  color: var(--pas-muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  overflow: hidden;
}

.pas__track:focus-visible { outline: 2px solid var(--pas-coral); outline-offset: 2px; }

/* Пройденная часть пути подсвечивается за ручкой. */
.pas__fill {
  position: absolute;
  inset-block: 0;
  left: 0;
  width: calc(var(--pas-x) + 42px);
  border-radius: inherit;
  background: linear-gradient(90deg, rgb(234 88 12 / .16), rgb(234 88 12 / .05));
  opacity: 0;
  transition: opacity .2s ease;
}

.pas.is-dragging .pas__fill,
.pas.is-busy .pas__fill { opacity: 1; }

.pas.is-done .pas__fill { width: 100%; opacity: 1; background: rgb(234 88 12 / .12); }

/* Куда вести ручку: пунктирная площадка у правого края. */
.pas__target {
  position: absolute;
  inset-block: 3px;
  right: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  border: 1.5px dashed rgb(234 88 12 / .55);
  border-radius: 8px;
  color: rgb(234 88 12 / .75);
  transition: background-color .2s ease, border-color .2s ease, opacity .2s ease, scale .2s ease;
}

.pas.is-dragging .pas__target {
  border-style: solid;
  background: rgb(234 88 12 / .12);
  color: var(--pas-coral);
  scale: 1.05;
}

.pas.is-done .pas__target { opacity: 0; }

.pas__hint {
  position: relative;
  z-index: 1;
  padding-inline: 50px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
  transition: opacity .2s ease, color .2s ease;
}

.pas.is-dragging .pas__hint { opacity: .45; }
.pas.is-done .pas__hint { padding-inline: 12px 48px; color: var(--pas-ink); }

/* ---------- Ручка ---------- */

.pas__knob {
  position: absolute;
  z-index: 2;
  inset-block: 3px;
  left: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  border-radius: 8px;
  background: linear-gradient(180deg, #2b4d78, var(--pas-navy));
  color: #fff;
  box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 3px 8px rgb(30 58 95 / .35);
  translate: var(--pas-x) 0;
  cursor: grab;
  touch-action: none;
}

.pas.is-dragging .pas__knob { cursor: grabbing; }
.pas:not(.is-dragging) .pas__knob { transition: translate .22s ease, background-color .2s ease, left .22s ease; }

/* Подтверждено: ручка стоит у правого края при любой ширине формы. */
.pas.is-done .pas__knob {
  left: calc(100% - 41px);
  translate: none;
  background: linear-gradient(180deg, #f2711f, var(--pas-coral));
  box-shadow: 0 1px 0 rgb(255 255 255 / .2) inset, 0 3px 8px rgb(234 88 12 / .35);
  cursor: default;
}

.pas__tick { display: none; }
.pas.is-done .pas__tick { display: block; }
.pas.is-done .pas__arrow { display: none; }

.pas.is-busy .pas__knob::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px solid rgb(255 255 255 / .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pas-spin .7s linear infinite;
}

.pas.is-busy .pas__arrow { opacity: 0; }

/* ---------- Щит и подпись ---------- */

.pas__shield {
  flex: none;
  display: inline-flex;
  color: rgb(30 58 95 / .4);
  transition: color .2s ease, scale .2s ease;
}

.pas.is-done .pas__shield { color: var(--pas-coral); scale: 1.06; }

.pas__note {
  min-height: 18px;
  margin: 5px 2px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--pas-muted);
}

.pas__note:empty { min-height: 0; margin: 0; }
.pas.is-error .pas__note { color: var(--pas-err); }

/* Попытка отправить без подтверждения — плашка вздрагивает. */
.pas.is-nudge .pas__box { animation: pas-nudge .45s ease; }

/* Кнопка, которая ждёт подтверждения. */
.pas-locked { opacity: .55; cursor: not-allowed !important; }

@keyframes pas-spin { to { rotate: 360deg; } }
@keyframes pas-nudge {
  20%, 60% { translate: -5px 0; }
  40%, 80% { translate: 5px 0; }
}

@media (max-width: 420px) {
  .pas__track { font-size: 13px; }
  .pas__hint { padding-inline: 46px; }
}

/* Узкая форма (системный вход, боковая колонка): щит уступает место подписи. */
@container (max-width: 320px) {
  .pas__shield { display: none; }
  .pas__box { padding-right: 5px; }
  .pas__hint { padding-inline: 44px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .pas, .pas * { transition: none !important; animation: none !important; }
}
