/**
 * Anti-bot Create My Website - styles du captcha proof-of-work (composant Blade
 * <x-antibot-captcha />, logique dans public/js/antibot-captcha.js).
 *
 * Theme clair par defaut ; le mode sombre suit automatiquement la classe `.dark`
 * posee sur <html> par le layout nexsas (Tailwind dark mode).
 * Accent = primaire CMW #696cff (pas de variable de theme : le widget doit
 * rester lisible partout, y compris hors nexsas).
 */

.cmw-antibot {
    --cmw-antibot-surface: #ffffff;
    --cmw-antibot-border: #d9d9e3;
    --cmw-antibot-text: #1c1c1c;
    --cmw-antibot-muted: #6b6b7b;
    --cmw-antibot-accent: #696cff;
    --cmw-antibot-accent-2: #9055ff;
    --cmw-antibot-success: #16a34a;
    --cmw-antibot-danger: #ef4444;

    display: block;
    margin: 0 0 1rem;
}

.dark .cmw-antibot {
    --cmw-antibot-surface: #262626;
    --cmw-antibot-border: #3a3a3a;
    --cmw-antibot-text: #e6e6f0;
    --cmw-antibot-muted: #9a9aa5;
    --cmw-antibot-success: #22c55e;
}

/* --- Boite principale --------------------------------------------------- */

.cmw-antibot__box {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 340px;
    padding: 12px 14px;
    background-color: var(--cmw-antibot-surface);
    border: 1px solid var(--cmw-antibot-border);
    border-radius: 10px;
    cursor: default;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.cmw-antibot[data-state="solving"] .cmw-antibot__box {
    border-color: var(--cmw-antibot-accent);
    box-shadow: 0 0 0 3px rgba(105, 108, 255, .15);
}

.cmw-antibot[data-state="done"] .cmw-antibot__box {
    border-color: var(--cmw-antibot-success);
}

.cmw-antibot[data-state="error"] .cmw-antibot__box {
    border-color: var(--cmw-antibot-danger);
    /* Cliquable : relance une tentative (cf. antibot-captcha.js). */
    cursor: pointer;
}

/* --- Indicateur (case a cocher / spinner / coche) ----------------------- */

.cmw-antibot__indicator {
    position: relative;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border: 2px solid var(--cmw-antibot-border);
    border-radius: 6px;
    background-color: transparent;
    transition: background-color .2s ease, border-color .2s ease;
}

.cmw-antibot[data-state="done"] .cmw-antibot__indicator {
    background: linear-gradient(135deg, var(--cmw-antibot-accent) 0%, var(--cmw-antibot-accent-2) 100%);
    border-color: transparent;
}

.cmw-antibot__check {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    opacity: 0;
    transform: scale(.6);
    transition: opacity .2s ease, transform .2s ease;
}

.cmw-antibot[data-state="done"] .cmw-antibot__check {
    opacity: 1;
    transform: scale(1);
}

.cmw-antibot__spinner {
    position: absolute;
    inset: 3px;
    display: none;
    border: 2px solid rgba(105, 108, 255, .25);
    border-top-color: var(--cmw-antibot-accent);
    border-radius: 50%;
    animation: cmwAntibotSpin .7s linear infinite;
}

.cmw-antibot[data-state="solving"] .cmw-antibot__spinner {
    display: block;
}

@keyframes cmwAntibotSpin {
    to { transform: rotate(360deg); }
}

/* --- Textes -------------------------------------------------------------- */

.cmw-antibot__texts {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.cmw-antibot__label {
    color: var(--cmw-antibot-text);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.2;
}

.cmw-antibot__status {
    color: var(--cmw-antibot-muted);
    font-size: .75rem;
    line-height: 1.3;
}

.cmw-antibot[data-state="done"] .cmw-antibot__status {
    color: var(--cmw-antibot-success);
}

.cmw-antibot[data-state="error"] .cmw-antibot__status {
    color: var(--cmw-antibot-danger);
}

/* --- Marque -------------------------------------------------------------- */

.cmw-antibot__brand {
    flex: 0 0 auto;
    text-align: right;
    line-height: 1.1;
}

.cmw-antibot__brand strong {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--cmw-antibot-accent) 0%, var(--cmw-antibot-accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cmw-antibot__brand small {
    display: block;
    color: var(--cmw-antibot-muted);
    font-size: .62rem;
}

/* --- Honeypot : invisible pour l'humain, visible pour les robots ---------- */

.cmw-antibot__honeypot {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* --- Message d'erreur serveur -------------------------------------------- */

.cmw-antibot__error {
    margin-top: .5rem;
    color: var(--cmw-antibot-danger);
    font-size: .8rem;
    font-weight: 600;
}

/* --- Bouton d'envoi verrouille -------------------------------------------
   Le bouton porte `disabled` (pose par antibot-captcha.js) tant que le
   challenge n'est pas resolu. Certains frameworks CSS mettent
   `pointer-events: none` sur les boutons desactives : on le retablit
   UNIQUEMENT pour afficher le curseur « interdit » et l'infobulle
   explicative — un controle desactive ne recoit de toute facon aucun
   evenement `click`.                                                        */

.cmw-antibot-locked,
.btn.cmw-antibot-locked,
.btn.cmw-antibot-locked:disabled {
    pointer-events: auto;
    cursor: not-allowed;
    opacity: .6;
}

/* --- Message sans JavaScript --------------------------------------------- */

.cmw-antibot__nojs {
    margin-top: .5rem;
    color: var(--cmw-antibot-danger);
    font-size: .8rem;
}
