/* ============================================================
   Ползунок «Я не робот» — модуль темы inc/antispam.php, формы Contact Form 7
   Цвета teamexpert: фиолетовый #571E87, золото #D0821C.
   ============================================================ */

.sgc {
  --sgc-navy: #571E87;
  --sgc-coral: #D0821C;
  --sgc-ink: #1E1C2A;
  --sgc-muted: #6b6878;
  --sgc-line: #DDD9E1;
  --sgc-bg: #fff;
  --sgc-err: #B5402C;
  --sgc-x: 0px;

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

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

.sgc__box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--sgc-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(56 19 90 / .06), 0 8px 20px -14px rgb(56 19 90 / .25);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.sgc:not(.is-done) .sgc__box:hover { border-color: #c9bcdc; }

.sgc.is-done .sgc__box {
  border-color: rgb(208 130 28 / .45);
  background: #fff;
}

.sgc.is-error .sgc__box { border-color: var(--sgc-err); }

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

.sgc__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(87 30 135 / .08), rgb(87 30 135 / .02));
  box-shadow: inset 0 1px 2px rgb(87 30 135 / .08);
  color: var(--sgc-muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  overflow: hidden;
}

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

/* Пройденная часть пути подсвечивается за ручкой. */
.sgc__fill {
  position: absolute;
  inset-block: 0;
  left: 0;
  width: calc(var(--sgc-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;
}

.sgc.is-dragging .sgc__fill,
.sgc.is-busy .sgc__fill { opacity: 1; }

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

/* Куда вести ручку: пунктирная площадка у правого края. */
.sgc__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;
}

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

.sgc.is-done .sgc__target { opacity: 0; }

.sgc__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;
}

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

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

.sgc__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, #7A4FA8, var(--sgc-navy));
  color: #fff;
  box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 3px 8px rgb(56 19 90 / .35);
  translate: var(--sgc-x) 0;
  cursor: grab;
  touch-action: none;
}

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

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

.sgc__tick { display: none; }
.sgc.is-done .sgc__tick { display: block; }
.sgc.is-done .sgc__arrow { display: none; }

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

.sgc.is-busy .sgc__arrow { opacity: 0; }

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

.sgc__shield {
  flex: none;
  display: inline-flex;
  color: rgb(87 30 135 / .4);
  transition: color .2s ease, scale .2s ease;
}

.sgc.is-done .sgc__shield { color: var(--sgc-coral); scale: 1.06; }

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

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

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

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

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

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

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

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

/* Тёмные формы темы (.te-form-dark) */
.te-form-dark .sgc { --sgc-ink: #fff; --sgc-muted: rgba(255, 255, 255, .65); --sgc-line: rgba(255, 255, 255, .22); }
.te-form-dark .sgc__box, .te-form-dark .sgc.is-done .sgc__box { background: rgba(255, 255, 255, .08); box-shadow: none; }
.te-form-dark .sgc__shield { color: rgba(255, 255, 255, .6); }
.te-form-dark .sgc__track { background: rgba(255, 255, 255, .06); box-shadow: none; }
