/**
 * Turnstile module — "Trust this browser" card.
 * Theme-agnostic: uses the brand --primary var (sane fallback) and the
 * login theme's --login-* vars; dark mode via :root[data-theme="dark"].
 */
.ts-trust {
    /* Hidden until Cloudflare has loaded and rendered the widget;
       TurnstileManager adds .ts-trust--ready to reveal it. */
    display: none;
    flex-direction: column;
    width: 100%;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--login-border, #e2e8f0);
    border-radius: 14px;
    background: var(--login-bg-secondary, #fff);
    transition: border-color .2s ease;
}

.ts-trust.ts-trust--ready {
    display: flex;
    animation: ts-trust-in .25s ease both;
}

@keyframes ts-trust-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ts-trust:has(.ts-trust__check:checked) {
    border-color: var(--primary, #FF5A36);
}

.ts-trust__head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    cursor: pointer;
}

.ts-trust__icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--primary, #FF5A36);
    background: color-mix(in srgb, var(--primary, #FF5A36) 12%, transparent);
    transition: background .2s ease, color .2s ease;
}

.ts-trust__icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.ts-trust:has(.ts-trust__check:checked) .ts-trust__icon {
    background: var(--primary, #FF5A36);
    color: #fff;
}

.ts-trust__body {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
}

.ts-trust__title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--login-text-dark, #1a202c);
}

.ts-trust__hint {
    font-size: .78rem;
    color: var(--login-text-secondary, #718096);
    margin-top: 2px;
}

.ts-trust__switch {
    flex: 0 0 auto;
    position: relative;
    width: 46px;
    height: 26px;
}

.ts-trust__check {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ts-trust__slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--login-border, #cbd5e1);
    transition: background .2s ease;
}

.ts-trust__slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s ease;
}

.ts-trust__check:checked + .ts-trust__slider {
    background: var(--primary, #FF5A36);
}

.ts-trust__check:checked + .ts-trust__slider::before {
    transform: translateX(20px);
}

.ts-trust__check:focus-visible + .ts-trust__slider {
    outline: 2px solid var(--primary, #FF5A36);
    outline-offset: 2px;
}

.ts-trust__widget {
    margin-top: 8px;
}

/* In-card captcha uses Cloudflare's "flexible" size — span the full card width,
   no border/divider so it blends into the card. */
.ts-trust__widget .cf-turnstile,
.ts-trust__widget .turnstile-wrapper {
    display: block;
    width: 100%;
    margin: 0 !important;
}

.ts-trust__widget iframe {
    width: 100% !important;
}

:root[data-theme="dark"] .ts-trust {
    border-color: var(--login-border, #334155);
    background: var(--login-bg-secondary, #1e293b);
}

:root[data-theme="dark"] .ts-trust__title {
    color: var(--login-text-dark, #e2e8f0);
}

:root[data-theme="dark"] .ts-trust__hint {
    color: var(--login-text-secondary, #94a3b8);
}

:root[data-theme="dark"] .ts-trust__slider {
    background: var(--login-border, #475569);
}
