/* ============================================================
   Style global — page captcha d'entrée
   Responsive PC + mobile
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: #f2f2f2;
    color: #222;
    -webkit-font-smoothing: antialiased;
}

/* Conteneur principal centré verticalement
   100svh = "small viewport height" : prend en compte le clavier mobile,
   donc le contenu reste bien centré même quand le clavier est ouvert.
   Fallback 100vh pour les vieux navigateurs. */
.captcha-wrapper {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}

.captcha-card {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
}

/* --- Emplacement logo ---
   Par défaut : carré vert (placeholder visible tant qu'il n'y a pas de logo).
   Dès qu'un <img> est présent dans la boîte, le fond vert disparaît
   automatiquement → le logo transparent s'affiche sur le fond gris de la page,
   sans démarcation de couleur. */
.logo-box {
    width: 180px;
    height: 110px;
    margin: 10px auto 0;
    background: #21c034;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    position: relative;
    animation: logoBreathe 2.2s ease-in-out infinite;
}

@keyframes logoBreathe {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}
.logo-box:has(img) {
    background: transparent;
    border-radius: 0;
    width: auto;         /* la boîte s'adapte à la taille du logo */
    max-width: 100%;
}
.logo-box img {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* --- Texte d'intro --- */
.intro {
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.45;
    margin: 6px 4px 0;
    color: #1d1d1d;
}

/* --- Message d'erreur --- */
.error-box {
    background: #fdecec;
    color: #b3261e;
    border: 1px solid #f5c2c0;
    padding: 10px 14px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.95rem;
}

/* --- Question mathématique --- */
.math-question {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 8px 2px -10px; /* marge négative = rapproche du champ */
    color: #111;
}

/* --- Formulaire --- */
.captcha-form {
    width: 100%;
    margin: 0;
}

.input-group {
    display: flex;
    width: 100%;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    border: 1px solid #e3e3e3;
}

.input-group input[type="text"] {
    flex: 1;
    border: 0;
    outline: none;
    padding: 16px 18px;
    font-size: 1rem;
    background: #fff;
    color: #222;
    min-width: 0;
}

.input-group input::placeholder {
    color: #9a9a9a;
}

.input-group button {
    border: 0;
    background: #E50914;
    color: #fff;
    width: 64px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.input-group button:hover,
.input-group button:focus {
    background: #b5080f;
}

/* --- Loading spinner dans le bouton captcha --- */
.input-group button.loading {
    pointer-events: none;
    position: relative;
}
.input-group button.loading svg {
    visibility: hidden;
}
.input-group button.loading::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
    inset: 0;
    margin: auto;
}
@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* --- Notice reCAPTCHA --- */
.recaptcha-notice {
    background: #ffffff;
    border: 1px solid #ececec;
    border-radius: 4px;
    padding: 18px 16px;
    text-align: center;
    font-size: 0.95rem;
    color: #333;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* --- Responsive --- */
@media (max-width: 420px) {
    .captcha-wrapper {
        padding: 28px 16px;
    }
    .logo-box {
        width: 150px;
        height: 92px;
    }
    .intro {
        font-size: 1rem;
    }
    .math-question {
        font-size: 1.25rem;
    }
    .input-group input[type="text"] {
        padding: 14px 14px;
        font-size: 0.95rem;
    }
    .input-group button {
        width: 56px;
    }
}

@media (min-width: 768px) {
    .captcha-card {
        max-width: 520px;
    }
    .logo-box {
        width: 200px;
        height: 120px;
    }
}

@media (min-width: 960px) {
    .captcha-wrapper {
        padding: 60px 40px;
    }
    .captcha-card {
        max-width: 560px;
        background: #fff;
        padding: 48px 44px;
        border-radius: 8px;
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    }
    .logo-box {
        width: 220px;
        height: 130px;
    }
}
