/* Капча ALTCHA (common\components\helpers\Altcha::widget) в стиле сайта.
   Светлая тема — модалки и формы; тёмная — страницы входа и регистрации (.premium-recaptcha). */

altcha-widget.altcha-captcha {
    --ac-bg: #f7f8fa;
    --ac-border: #e2e5ea;
    --ac-text: #1f2937;
    --ac-muted: #8a909c;
    --ac-box: #c5cad3;
    --ac-accent: #F6055B;
    --ac-ok: #16a34a;
    --ac-error: #e11d48;

    --altcha-max-width: 100%;
    --altcha-border-radius: 12px;
    --altcha-color-base: var(--ac-bg);
    --altcha-color-border: var(--ac-border);
    --altcha-color-border-focus: var(--ac-accent);
    --altcha-color-text: var(--ac-text);
    --altcha-color-error-text: var(--ac-error);

    display: block;
    width: 100%;
    margin: 4px 0 16px;
    font-family: inherit;
}

.premium-recaptcha altcha-widget.altcha-captcha {
    --ac-bg: rgba(255, 255, 255, 0.05);
    --ac-border: rgba(255, 255, 255, 0.1);
    --ac-text: #ffffff;
    --ac-muted: rgba(255, 255, 255, 0.45);
    --ac-box: rgba(255, 255, 255, 0.35);
    --ac-ok: #4ade80;
    --ac-error: #ff6b6b;
    margin: 0;
}

/* Пока скрипт не пришёл — место под виджет, чтобы форма не прыгала */
altcha-widget.altcha-captcha:not(:defined) {
    min-height: 52px;
    border: 1px solid var(--ac-border);
    border-radius: 12px;
    background: var(--ac-bg);
    box-sizing: border-box;
}

.altcha-captcha .altcha {
    box-sizing: border-box;
    min-height: 52px;
    justify-content: center;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.altcha-captcha .altcha:focus-within {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac-accent) 18%, transparent);
}

.altcha-captcha .altcha-main {
    gap: 12px;
    padding: 12px 16px;
}

/* Значок щита справа */
.altcha-captcha .altcha-main::after {
    content: "";
    flex: none;
    width: 20px;
    height: 20px;
    background: var(--ac-muted);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 4 5v6c0 5.25 3.4 9.9 8 11 4.6-1.1 8-5.75 8-11V5l-8-3Zm-1.2 14.2-3.5-3.5 1.4-1.4 2.1 2.1 4.6-4.6 1.4 1.4-6 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 4 5v6c0 5.25 3.4 9.9 8 11 4.6-1.1 8-5.75 8-11V5l-8-3Zm-1.2 14.2-3.5-3.5 1.4-1.4 2.1 2.1 4.6-4.6 1.4 1.4-6 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: background-color .2s ease;
}

.altcha-captcha .altcha-label {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--ac-text);
    user-select: none;
}

/* Галочка */
.altcha-captcha .altcha-checkbox {
    width: 24px;
    height: 24px;
    color: var(--ac-accent);
}

.altcha-captcha .altcha-checkbox input {
    -webkit-appearance: none;
    appearance: none;
    display: grid;
    place-content: center;
    width: 24px;
    height: 24px;
    margin: 0;
    border: 2px solid var(--ac-box);
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .15s ease;
}

.altcha-captcha .altcha-checkbox input:hover {
    border-color: var(--ac-accent);
}

.altcha-captcha .altcha-checkbox input:active {
    transform: scale(.92);
}

.altcha-captcha .altcha-checkbox input:checked {
    border-color: transparent;
    background: linear-gradient(135deg, #F6055B 0%, #D134C2 100%);
    animation: altcha-site-pop .25s ease;
}

.altcha-captcha .altcha-checkbox input:checked::after {
    content: "";
    width: 11px;
    height: 6px;
    border-left: 2.5px solid #fff;
    border-bottom: 2.5px solid #fff;
    transform: translateY(-1px) rotate(-45deg);
}

.altcha-captcha .altcha-checkbox .altcha-spinner {
    color: var(--ac-accent);
}

/* Состояния */
.altcha-captcha .altcha[data-state="verified"] {
    border-color: color-mix(in srgb, var(--ac-ok) 45%, var(--ac-border));
}

.altcha-captcha .altcha[data-state="verified"] .altcha-main::after {
    background: var(--ac-ok);
}

.altcha-captcha .altcha[data-state="verifying"] .altcha-label {
    color: var(--ac-muted);
}

.altcha-captcha .altcha[data-state="error"],
.altcha-captcha .altcha[data-state="expired"] {
    border-color: var(--ac-error);
}

.altcha-captcha .altcha-error {
    padding: 0 16px 12px 52px;
    font-size: 13px;
}

@keyframes altcha-site-pop {
    0% { transform: scale(.7); }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); }
}
