/* ============================================================
   TBase Smart Captcha — thème bleu royal / cyber, cohérent site
   ============================================================ */

.tb-captcha {
    background: var(--bg-elevated, #171c27);
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 12px;
    padding: 14px;
    user-select: none;
    transition: border-color .25s ease, box-shadow .25s ease;
}

.tb-captcha-stage {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 2 / 1;
    background: var(--bg-dark, #0a0d14);
}

.tb-captcha-bg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.tb-captcha-piece {
    position: absolute;
    width: 15.625%; /* 50 / 320 */
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.55));
    pointer-events: none;
    transition: filter .2s ease;
}

.tb-captcha-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 8, 13, 0.85);
    color: var(--accent-cyan, #19a8ff);
    font-size: 1.6rem;
}

/* ---- Piste de glissement ---- */
.tb-captcha-track {
    position: relative;
    margin-top: 12px;
    height: 44px;
    border-radius: 22px;
    background: var(--bg-dark, #0a0d14);
    border: 1px solid rgba(56, 189, 248, 0.15);
    overflow: hidden;
}

.tb-captcha-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--gradient-brand-soft, linear-gradient(135deg, rgba(37,99,235,.16), rgba(56,189,248,.10)));
    border-right: 1px solid rgba(56, 189, 248, 0.35);
    pointer-events: none;
}

.tb-captcha-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 56px;
    height: 38px;
    border-radius: 19px;
    background: var(--gradient-brand, linear-gradient(135deg, #0039b3, #0046d6 55%, #19a8ff));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: var(--glow-brand, 0 0 22px rgba(37, 99, 235, 0.3));
    transition: box-shadow .2s ease;
    touch-action: none;
    z-index: 2;
}
.tb-captcha-handle:active { cursor: grabbing; }

.tb-captcha-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6b7486);
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    pointer-events: none;
    transition: opacity .25s ease;
}

/* ---- Pied : statut + refresh ---- */
.tb-captcha-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    min-height: 22px;
}

.tb-captcha-status { font-size: 0.85rem; color: var(--text-secondary, #a7b0c0); }
.tb-captcha-status.is-success { color: #4ade80; font-weight: 600; }
.tb-captcha-status.is-error   { color: #f87171; font-weight: 600; }

.tb-captcha-refresh {
    background: transparent;
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: var(--accent-cyan, #19a8ff);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: background .2s ease, transform .3s ease;
}
.tb-captcha-refresh:hover {
    background: rgba(56, 189, 248, 0.12);
    transform: rotate(180deg);
}

/* ---- États ---- */
.tb-captcha-success {
    border-color: rgba(74, 222, 128, 0.55);
    box-shadow: 0 0 18px rgba(74, 222, 128, 0.18);
}
.tb-captcha-success .tb-captcha-handle {
    background: linear-gradient(135deg, #16a34a, #4ade80);
    box-shadow: 0 0 18px rgba(74, 222, 128, 0.45);
}
.tb-captcha-success .tb-captcha-piece { filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.7)); }

.tb-captcha-error { border-color: rgba(248, 113, 113, 0.55); }
.tb-captcha-error .tb-captcha-handle { background: linear-gradient(135deg, #b91c1c, #ef4444); }

@keyframes tbCaptchaShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.tb-captcha-shake { animation: tbCaptchaShake .45s ease; }
