/* ============================================================
   Vigie — Pages d'authentification (login + 2FA)
   ============================================================ */

:root {
    --bg:          #f2f0ed;
    --card:        #ffffff;
    --red:         #c8322b;
    --red-strong:  #b02620;
    --red-deep:    #7e100d;
    --text:        #1c1c1e;
    --text-soft:   #55565c;
    --text-faint:  #85868c;
    --input-bg:    #f4f4f5;
    --input-border:#e3e4e8;
    --font-sans:   "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-mono:   ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
    font-family: var(--font-sans);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------
   Carte deux volets
   ------------------------------------------------------------ */
/* Les coins arrondis sont portés par chaque volet plutôt que par un
   overflow:hidden global : rogner un contenu animé sous un border-radius
   force Firefox en rendu logiciel (animations saccadées). */
.auth-card {
    display: grid;
    grid-template-columns: 46% 54%;
    width: min(1000px, 100%);
    min-height: 560px;
    border-radius: 22px;
    box-shadow: 0 24px 70px rgba(30, 15, 10, .14);
}

/* ------------------------------------------------------------
   Volet gauche : panneau rouge décoratif
   ------------------------------------------------------------ */
.auth-left {
    position: relative;
    overflow: hidden;
    border-radius: 22px 0 0 22px;
    background: linear-gradient(140deg, #d33530 0%, #b71f1a 45%, var(--red-deep) 100%);
}

.wm {
    position: absolute;
    font-size: 230px;
    font-weight: 800;
    line-height: 1;
    color: rgba(255, 255, 255, .06);
    user-select: none;
}
.wm-top    { top: -48px;  right: -14px; }
.wm-bottom { bottom: -58px; left: -18px; }

.ring {
    position: absolute;
    border: 2px dashed rgba(255, 255, 255, .30);
    border-radius: 50%;
}
.ring-1 { width: 150px; height: 150px; top: 10%; left: 1%; }
.ring-2 { width: 170px; height: 170px; bottom: 3%; right: 16%; }

.tile {
    position: absolute;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .13);
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
    color: #fff;
}
.tile svg { width: 22px; height: 22px; }

/* Flottement : chaque tuile a sa durée et son déphasage propres
   pour éviter tout mouvement d'ensemble synchronisé.
   will-change force l'animation sur le GPU (mouvement fluide, sans saccade). */
@keyframes tile-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
.tile { animation: tile-float 4s ease-in-out infinite; }

.t1  { top:  9%; left: 11%; animation-duration: 3.6s; animation-delay: -0.9s; }   /* pin       */
.t2  { top:  9%; left: 74%; animation-duration: 4.4s; animation-delay: -2.6s; }   /* serveur   */
.t3  { top: 27%; left: 22%; animation-duration: 4.0s; animation-delay: -3.3s; }   /* terminal  */
.t4  { top: 22%; left: 51%; animation-duration: 3.4s; animation-delay: -1.5s; }   /* cpu       */
.t5  { top: 33%; left: 79%; animation-duration: 4.6s; animation-delay: -0.5s; }   /* bouclier  */
.t6  { top: 42%; left: 43%; animation-duration: 3.8s; animation-delay: -2.9s; }   /* horloge   */
.t7  { top: 46%; left:  8%; animation-duration: 4.2s; animation-delay: -1.2s; }   /* cadenas   */
.t8  { top: 56%; left: 72%; animation-duration: 3.5s; animation-delay: -2.0s; }   /* base      */
.t9  { top: 62%; left: 46%; animation-duration: 4.5s; animation-delay: -3.7s; }   /* globe     */
.t10 { top: 65%; left: 17%; animation-duration: 3.7s; animation-delay: -0.3s; }   /* cloche    */
.t11 { top: 84%; left:  7%; animation-duration: 4.1s; animation-delay: -1.8s; }   /* nuage     */
.t12 { top: 87%; left: 35%; animation-duration: 3.4s; animation-delay: -2.7s; }   /* flèche    */
.t13 { top: 78%; left: 57%; animation-duration: 4.3s; animation-delay: -1.0s; }   /* graphique */

@media (prefers-reduced-motion: reduce) {
    .tile { animation: none; }
}

/* ------------------------------------------------------------
   Volet droit : formulaire
   ------------------------------------------------------------ */
.auth-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px 72px;
    background: var(--card);
    border-radius: 0 22px 22px 0;
}
.auth-right > * { width: 100%; max-width: 400px; margin-left: auto; margin-right: auto; }

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}
.brand-logo { width: 42px; height: 39px; }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: .01em; }

.auth-title {
    text-align: center;
    font-size: 25px;
    font-weight: 700;
    margin-bottom: 26px;
}

.auth-subtitle {
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    margin: -10px 0 8px;
}

.auth-hint {
    text-align: center;
    font-size: 13.5px;
    color: var(--text-soft);
    margin-bottom: 22px;
    line-height: 1.5;
}

.auth-error {
    background: #fdecea;
    border: 1px solid #f3c1bd;
    color: #8e1414;
    font-size: 13.5px;
    padding: 10px 14px;
    border-radius: 9px;
    margin-bottom: 18px;
}

.auth-success {
    background: #e8f7ec;
    border: 1px solid #b9e4c5;
    color: #1e6e34;
    font-size: 13.5px;
    padding: 10px 14px;
    border-radius: 9px;
    margin-bottom: 18px;
}

/* Page d'installation */
.setup-key {
    margin-bottom: 18px;
    padding: 12px 14px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    text-align: center;
}
.setup-key code, .auth-hint code, .auth-error code {
    font-family: var(--font-mono);
    font-size: 13px;
    word-break: break-all;
}

.btn-link {
    display: block;
    text-align: center;
    text-decoration: none;
}

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(200, 50, 43, .12);
}
.field input::placeholder { color: var(--text-faint); }

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 18px;
    font-size: 13.5px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
    font-weight: 600;
}
.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--red);
}

.btn-primary {
    width: 100%;
    padding: 13px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg, #ce3730, var(--red-strong));
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: filter .15s;
}
.btn-primary:hover  { filter: brightness(.94); }
.btn-primary:active { filter: brightness(.88); }
.btn-primary:focus-visible { outline: 3px solid rgba(200, 50, 43, .35); outline-offset: 2px; }

/* Champ code 2FA */
.otp-input {
    text-align: center;
    font-size: 20px !important;
    letter-spacing: .4em;
    font-weight: 600;
}

.auth-back {
    margin-top: 18px;
    font-size: 13.5px;
}
.auth-back a {
    color: var(--text-soft);
    text-decoration: none;
}
.auth-back a:hover { color: var(--text); text-decoration: underline; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------------
   Mobile : le panneau décoratif disparaît
   ------------------------------------------------------------ */
@media (max-width: 860px) {
    .auth-card {
        grid-template-columns: 1fr;
        width: min(460px, 100%);
        min-height: 0;
    }
    .auth-left  { display: none; }
    .auth-right { padding: 44px 30px; border-radius: 22px; }
}
