/* ════════════════════════════════════════════════════════════════════════════
   abc/pages/login.css — Page de connexion (Home/Index, mise en page _LoginLayout)
   Ordre de ce fichier = ordre d'origine dans la page :
     1. ancien bloc <style> du <head> de Views/Shared/_LoginLayout.cshtml
     2. ancien fichier wwwroot/css/ui-login.css, à l'identique
     3. ancien bloc <style> du corps de Views/Home/Index.cshtml
   Chargé par _LoginLayout.cshtml, après Bootstrap, Font Awesome, Inter et
   css/abc/tokens.css.
   ════════════════════════════════════════════════════════════════════════════ */


/* ── Mise en page de l'écran (anciennement dans la vue Shared/_LoginLayout.cshtml) ── */
/* Override Font Awesome's font-display:block (FOIT) with swap — avoids
   invisible icons while the icon webfont loads. Same family/weight/src as
   lib/font-awesome/css/all.min.css; this rule wins as it's declared after. */
@font-face {
    font-family: "Font Awesome 6 Free";
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url("../../../lib/font-awesome/webfonts/fa-solid-900.woff2") format("woff2");
}
@font-face {
    font-family: "Font Awesome 6 Free";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../../../lib/font-awesome/webfonts/fa-regular-400.woff2") format("woff2");
}
@font-face {
    font-family: "Font Awesome 6 Brands";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../../../lib/font-awesome/webfonts/fa-brands-400.woff2") format("woff2");
}

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
}
/* Boutons principaux (Connexion, SSO, boutons des fenêtres) : bleu canard,
   voir « Bouton principal » et « Fenêtres » plus bas. */
.form-control:focus, .form-check-input:focus {
    border-color: var(--va-teal);
    box-shadow: 0 0 0 3px rgba(18, 112, 123, 0.15);
}
.form-check-input:checked {
    background-color: var(--va-teal);
    border-color: var(--va-teal);
}


/* ════════════════════════════════════════════════════════════════════════════
   Valoptia ABC — refonte UI de la page de connexion (charte « Marine & ambre »)
   La page de connexion a sa propre mise en page (_LoginLayout) et ne charge ni
   site.css ni la charte commune (_UiStyles), seulement tokens.css (palette
   --va-*, dégradés, échelle de texte --va-fs-*), juste avant ce fichier : ses
   styles vivent ici. Habillage seul : formulaires, champs, noms, ids, jetons
   et scripts inchangés ; aucun élément ajouté (décor par ::before / ::after).
   ════════════════════════════════════════════════════════════════════════════ */

/* Couleurs propres à la page de connexion (palette : tokens.css) */
:root {
    --lg-border:      #D8E0E6;
    --lg-muted:       #6B7785;
    /* Surfaces de la carte (redéfinies en thème sombre plus bas) */
    --lg-card-bg:     #FFFFFF;
    --lg-field-bg:    #F7FAFC;
    --lg-field-focus: #FFFFFF;
    --lg-text:        var(--va-navy);
    --lg-placeholder: #A3AEB9;
    --lg-faint:       #9AA5B1;
    --lg-switch-off:  #E6ECF1;
    --lg-switch-line: #C5CFD8;
    --lg-accent:      var(--va-teal);
    --lg-card-shadow: 0 30px 70px rgba(3, 14, 26, .45), 0 2px 8px rgba(3, 14, 26, .18);
}

/* ── Fond de l'écran : dégradé signature marine → bleu → bleu canard ─────────
   !important : la vue pose en ligne l'ancienne image (dégradé orange). Deux
   halos discrets donnent de la profondeur, une trame de points très légère
   évite l'aplat. */
body:has(#loginForm) .min-vh-100:has(> .card) {
    background:
        radial-gradient(900px 600px at 85% 8%, rgba(18, 112, 123, .55), transparent 65%),
        radial-gradient(700px 520px at 8% 95%, rgba(30, 79, 122, .55), transparent 70%),
        radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.5px) 0 0 / 22px 22px,
        var(--va-gradient) !important;
    background-attachment: fixed !important;
    padding: 24px 0;
}

/* ── Carte ─────────────────────────────────────────────────────────────────── */
body:has(#loginForm) .card {
    max-width: 420px !important;
    /* place pour le logo, posé au-dessus de la carte */
    margin-top: 84px;
    border-radius: 16px;
    background: var(--lg-card-bg);
    box-shadow: var(--lg-card-shadow);
}
body:has(#loginForm) .card-body { padding: 36px 40px 28px; }

/* Logo : logotype Valoptia (jaune) sur le fond sombre, au-dessus de la carte
   et centré sur elle, suivi du nom du produit. L'ancienne pastille rouge
   (vaABCIcon.ico, décentrée dans son cadre) est masquée. */
body:has(#loginForm) .login-brand {
    position: absolute; left: 0; right: 0; bottom: calc(100% + 30px);
    margin: 0;
    display: flex; align-items: center; justify-content: center; gap: 16px;
}
body:has(#loginForm) .login-brand img:first-child { display: none; }
body:has(#loginForm) .login-brand img + img { width: 176px; height: auto; margin: 0 !important; }
body:has(#loginForm) .login-brand::after {
    content: "ABC";
    padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .28);
    font-size: var(--va-fs-2xl); font-weight: 300; letter-spacing: .32em;
    line-height: 24px; color: #fff; margin-right: -.32em;
}

/* ── Champs ───────────────────────────────────────────────────────────────── */
body:has(#loginForm) .form-label {
    display: flex; align-items: center; gap: 8px;
    font-size: var(--va-fs-sm); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--lg-muted); margin-bottom: 6px;
}
body:has(#loginForm) .form-label > i {
    width: 22px; height: 22px; margin: 0; border-radius: 6px;
    display: inline-grid; place-items: center; font-size: 10px;
    background: rgba(18, 112, 123, .12); color: var(--lg-accent);
}
body:has(#loginForm) .form-control,
body:has(#loginForm) #loginForm .form-control-lg {
    height: 46px; border-radius: 10px; font-size: var(--va-fs-lg);
    border: 1px solid var(--lg-border); background: var(--lg-field-bg); color: var(--lg-text);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
body:has(#loginForm) .form-control::placeholder { color: var(--lg-placeholder); }
body:has(#loginForm) .form-control:focus {
    background: var(--lg-field-focus); color: var(--lg-text); border-color: var(--va-teal) !important;
    box-shadow: 0 0 0 4px rgba(18, 112, 123, .14) !important;
}

/* Mot de passe + œil = un seul objet : le cadre est porté par le groupe */
body:has(#loginForm) .input-group {
    border: 1px solid var(--lg-border); border-radius: 10px; background: var(--lg-field-bg);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
body:has(#loginForm) .input-group:focus-within {
    background: var(--lg-field-focus); border-color: var(--va-teal);
    box-shadow: 0 0 0 4px rgba(18, 112, 123, .14);
}
body:has(#loginForm) .input-group > .form-control {
    border: 0 !important; background: transparent !important;
    height: 44px;
}
body:has(#loginForm) .input-group > #togglePassword {
    border: 0; background: transparent; box-shadow: none;
    width: 44px; color: #8A96A3; border-radius: 0 10px 10px 0;
}
body:has(#loginForm) .input-group > #togglePassword:hover { color: var(--va-teal); }

/* « Forcer la connexion » : interrupteur (la case reste la même, valeur inchangée) */
body:has(#loginForm) #loginForm .form-check { display: flex; align-items: center; gap: 10px; padding-left: 0; }
body:has(#loginForm) #loginForm .form-check-input {
    float: none; margin: 0;
    width: 34px; height: 20px; border-radius: 20px; cursor: pointer;
    border: 1px solid var(--lg-switch-line); background-color: var(--lg-switch-off);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-position: left center;
    transition: background-position .15s, background-color .15s;
}
body:has(#loginForm) #loginForm .form-check-input:checked {
    background-color: var(--va-teal); border-color: var(--va-teal); background-position: right center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}
body:has(#loginForm) #loginForm .form-check-input:focus { box-shadow: 0 0 0 4px rgba(18, 112, 123, .14); border-color: var(--va-teal); }
body:has(#loginForm) #loginForm .form-check-label { font-size: var(--va-fs-md); color: var(--lg-muted); cursor: pointer; }
body:has(#loginForm) #loginForm .alert-warning .form-check-label { color: #7A4E00; }
body:has(#loginForm) #loginForm hr { border-color: var(--lg-border); opacity: 1; }

/* ── Bouton principal (Connexion, SSO) : bleu canard, pas le rouge d'origine ── */
body:has(#loginForm) #loginForm button[type="submit"].btn,
body:has(#loginForm) a#btnSamlLogin.btn,
body:has(#loginForm) a#btnOidcLogin.btn {
    height: 48px; border-radius: 10px; border: 0;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: var(--va-fs-xl); font-weight: 600; letter-spacing: .01em;
    background: linear-gradient(135deg, var(--va-blue), var(--va-teal));
    box-shadow: 0 8px 20px rgba(18, 112, 123, .28);
    transition: filter .15s, box-shadow .15s, transform .15s;
}
body:has(#loginForm) #loginForm button[type="submit"].btn > i,
body:has(#loginForm) a#btnSamlLogin.btn > i,
body:has(#loginForm) a#btnOidcLogin.btn > i { margin: 0; }
body:has(#loginForm) #loginForm button[type="submit"].btn:hover,
body:has(#loginForm) a#btnSamlLogin.btn:hover,
body:has(#loginForm) a#btnOidcLogin.btn:hover {
    filter: brightness(1.08); box-shadow: 0 10px 24px rgba(18, 112, 123, .34); transform: translateY(-1px);
}
/* Connexion administrateur en mode SSO : bouton secondaire */
body:has(#loginForm) #adminLoginFields button[type="submit"].btn-outline-primary {
    background: #fff; color: var(--va-teal);
    border: 1px solid var(--lg-border); box-shadow: none;
}

/* Lien « mot de passe oublié » et version */
body:has(#loginForm) #lkForgotPassword {
    color: var(--lg-accent); font-weight: 600; font-size: var(--va-fs-md); text-decoration: none;
}
body:has(#loginForm) #lkForgotPassword:hover { text-decoration: underline; }
body:has(#loginForm) .card-body > .text-center.mt-4 small {
    font-size: var(--va-fs-xs); letter-spacing: .04em; color: var(--lg-faint) !important;
}

/* Messages d'erreur / d'avertissement : étiquettes douces arrondies */
body:has(#loginForm) .alert { border-radius: 10px; border: 0; font-size: var(--va-fs-md); }
body:has(#loginForm) .alert-danger { background: rgba(215, 108, 87, .12); color: #A8432F; }
body:has(#loginForm) .alert-warning { background: rgba(234, 159, 34, .14); color: #7A4E00; }
body:has(#loginForm) .alert-success { background: rgba(18, 112, 123, .12); color: var(--va-teal-dark); }

/* ── Fenêtres (mot de passe oublié, code à usage unique, changement de mot de
   passe) : en-tête au dégradé signature, champs et boutons de la charte ───── */
body:has(#loginForm) .modal-content {
    border: 0; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px rgba(9, 32, 52, .3);
    background: var(--lg-card-bg); color: var(--lg-text);
}
body:has(#loginForm) .modal-header {
    /* !important : la fenêtre du code à usage unique porte un fond vert pâle
       en ligne (style="background:#e6f4ee") qui rendait le titre blanc illisible */
    background: var(--va-gradient) !important;
    color: #fff; border-bottom: 0; padding: 16px 20px;
}
body:has(#loginForm) .modal-header .modal-title { display: flex; align-items: center; gap: 10px; font-size: var(--va-fs-xl); }
body:has(#loginForm) .modal-header .modal-title > i {
    width: 30px; height: 30px; margin: 0 !important; border-radius: 8px;
    display: inline-grid; place-items: center; font-size: 13px;
    background: rgba(255, 255, 255, .14); color: var(--va-amber-light);
}
body:has(#loginForm) .modal-header .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .8; }
body:has(#loginForm) .modal-body { padding: 20px; }
body:has(#loginForm) .modal-body .form-label { font-size: var(--va-fs-xs); }
body:has(#loginForm) .modal-footer { border-top: 0; padding: 0 20px 20px; gap: 8px; }
body:has(#loginForm) .modal .form-control { height: 42px; }
body:has(#loginForm) .modal .btn {
    height: 42px; border-radius: 10px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
body:has(#loginForm) .modal .btn > i { margin: 0 !important; }
body:has(#loginForm) .modal .btn-primary,
body:has(#loginForm) .modal .btn-success,
body:has(#loginForm) .modal .btn-warning {
    background: linear-gradient(135deg, var(--va-blue), var(--va-teal)); border: 0;
}
body:has(#loginForm) .modal .btn:disabled { opacity: .45; }
body:has(#loginForm) .modal .btn-secondary { background: var(--lg-card-bg); color: var(--lg-text); border: 1px solid var(--lg-border) !important; }

/* Code à usage unique : 6 cases lisibles (le texte était en 12 px) */
body:has(#loginForm) #otpInputs { gap: 10px !important; }
body:has(#loginForm) #otpInputs .otp-digit {
    width: 50px; height: 58px; padding: 0;
    font-size: var(--va-fs-3xl); font-weight: 700; color: var(--lg-text);
    border-radius: 12px; border: 1.5px solid var(--lg-border); background: var(--lg-field-bg);
}
body:has(#loginForm) #otpInputs .otp-digit:focus { border-color: var(--va-teal); background: var(--lg-field-focus); }
body:has(#loginForm) #otpQr canvas, body:has(#loginForm) #otpQr img {
    padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--lg-border);
}

/* Thème sombre : la page de connexion suit le réglage du système (elle ne
   connaît pas encore le choix fait dans Paramètres → Apparence). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --lg-card-bg:     #172031;
        --lg-field-bg:    #1D283B;
        --lg-field-focus: #202D42;
        --lg-text:        #E6EDF3;
        --lg-placeholder: #6F7E8F;
        --lg-muted:       #9AA9B8;
        --lg-faint:       #6F7E8F;
        --lg-border:      #2C3A50;
        --lg-switch-off:  #2A3648;
        --lg-switch-line: #3A4A61;
        --lg-accent:      #5FBCC6;
        --lg-card-shadow: 0 30px 70px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
    }
}

/* Petits écrans */
@media (max-width: 480px) {
    body:has(#loginForm) .card { border-radius: 14px; margin: 64px 16px 0; }
    body:has(#loginForm) .card-body { padding: 30px 22px 24px; }
    body:has(#loginForm) .login-brand { bottom: calc(100% + 22px); gap: 12px; }
    body:has(#loginForm) .login-brand img + img { width: 150px; }
    body:has(#loginForm) .login-brand::after { padding-left: 12px; font-size: var(--va-fs-xl); line-height: 20px; }
    body:has(#loginForm) #otpInputs .otp-digit { width: 42px; height: 52px; }
}


/* ── Mise en page de l'écran (anciennement dans la vue Home/Index.cshtml) ──
   Ancien bloc <style> du corps de la page : il venait après ui-login.css,
   il reste donc en fin de fichier pour garder sa priorité. */
/* Trop de tailles de police différentes sur l'écran de login : aligner le
   contenu des champs et le bouton Connexion sur la taille des libellés
   (.form-label, 1rem) au lieu des tailles -lg par défaut de Bootstrap (1.25rem). */
#loginForm .form-control-lg {
    font-size: var(--va-fs-xl);
}
#loginForm .btn-lg {
    font-size: var(--va-fs-xl);
}
