/* ALTCHA widget theme: tinted box matching the portal inputs */
altcha-widget {
    --altcha-border-radius: 4.8px;
    --altcha-padding: 0.75rem 1rem;
    --altcha-max-width: 100%;
    --altcha-checkbox-size: 22px;
    /* stretch to the full width of the form container */
    display: block;
    width: 100%;
    /* keep the widget clear of the surrounding fields and buttons */
    margin: 1.25rem 0;
}

/* not validated yet (unverified, verifying, expired, error): light red */
altcha-widget .altcha {
    --altcha-color-base: #fdf0f0;
    --altcha-border-color: #f1c4c4;
}

/* validated: light green */
altcha-widget .altcha[data-state="verified"] {
    --altcha-color-base: #edf8f1;
    --altcha-border-color: #b9e2c8;
}

altcha-widget .altcha-main {
    justify-content: center;
    min-height: 54px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

altcha-widget .altcha-checkbox-wrap {
    align-items: center;
    gap: 0.75rem;
}

/* reset Bootstrap's label margin so the text is vertically centered with the checkbox */
altcha-widget .altcha-checkbox-wrap label {
    margin: 0;
    line-height: 1.2;
    padding-top: 2px;
    cursor: pointer;
}

/* small hint under "Nu sunt un robot" while the box still has to be ticked;
   the text comes from the --altcha-hint variable set in components/altcha.blade.php (general.altcha.hint) */
altcha-widget .altcha[data-state="unverified"] .altcha-checkbox-wrap label,
altcha-widget .altcha[data-state="expired"] .altcha-checkbox-wrap label {
    /* the label is a flex row: stack the hint under the text */
    flex-direction: column;
    align-items: flex-start;
}

altcha-widget .altcha[data-state="unverified"] .altcha-checkbox-wrap label::after,
altcha-widget .altcha[data-state="expired"] .altcha-checkbox-wrap label::after {
    content: var(--altcha-hint, "");
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    font-weight: normal;
    color: #6c757d;
}

/* status icon on the right side of the widget, one per state
   (Font Awesome 6 solid font, loaded by components/altcha.blade.php) */
altcha-widget .altcha-main {
    position: relative;
    padding-right: 3rem;
}

altcha-widget .altcha-main::after {
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: -0.625rem;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.25rem;
    line-height: 1.25rem;
    text-align: center;
    /* unverified: click cursor with a gentle "tap" animation ("click the box") */
    content: "\f25a";
    color: #c0392b;
    animation: altcha-icon-tap 1.6s ease-in-out infinite;
}

/* verifying: spinning circle-notch */
altcha-widget .altcha[data-state="verifying"] .altcha-main::after {
    content: "\f1ce";
    color: #6c757d;
    animation: altcha-icon-spin 0.9s linear infinite;
}

/* verified: checked user */
altcha-widget .altcha[data-state="verified"] .altcha-main::after {
    content: "\f4fc";
    width: 1.5rem;
    color: #28a745;
    animation: none;
}

/* expired: rotate-right, "tick it again" */
altcha-widget .altcha[data-state="expired"] .altcha-main::after {
    content: "\f2f9";
    color: #d39e00;
    animation: none;
}

/* error: triangle-exclamation */
altcha-widget .altcha[data-state="error"] .altcha-main::after {
    content: "\f071";
    color: #dc3545;
    animation: none;
}

/* "tap": the cursor presses down briefly, then rests */
@keyframes altcha-icon-tap {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
    }
    70% {
        transform: translateY(2px) scale(0.85);
    }
    80% {
        transform: translateY(0) scale(1);
    }
}

@keyframes altcha-icon-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    altcha-widget .altcha-main::after,
    altcha-widget .altcha[data-state="verifying"] .altcha-main::after {
        animation: none;
    }
}

/* use when the field above already provides bottom spacing (e.g. a .form-group) */
.altcha-no-top-gap altcha-widget {
    margin-top: 0;
}
