/*
 * Unicomm Theme — Page de connexion moderne en deux colonnes.
 *
 * Colonne gauche : image de marque (configurable dans les paramètres du plugin).
 * Colonne droite : carte de connexion GLPI (SSO + formulaire), restylée.
 *
 * Le layout 2 colonnes est activé par js/login.js (classe .utheme-2col) qui pose
 * aussi la variable --utheme-side (url de l'image) et injecte l'en-tête.
 */

:root { --utheme-brand: #243b53; --utheme-brand2: #334e68; --utheme-side: none; }

/* ---- Structure 2 colonnes ---- */
.utheme-2col .flex-fill {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 100vh;
    width: 100%;
}

.utheme-left {
    flex: 0 0 40%;
    max-width: 40%;
    background:
        var(--utheme-side) center / contain no-repeat,
        #ffffff;
    padding: 3rem;
    position: relative;
    border-right: 1px solid rgba(0, 0, 0, .07);
}

.utheme-2col .container-tight {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 3rem !important;
}

/* On masque le logo GLPI flottant : on le réinjecte dans la carte. */
.utheme-2col .container-tight > .text-center:has(.glpi-logo) { display: none; }

/* ---- Carte de connexion ---- */
.utheme-2col .main-content-card {
    border: 0 !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 34px rgba(20, 33, 61, .10) !important;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}
.utheme-2col .main-content-card .card-header { border-bottom: 0; padding-bottom: 0; }
.utheme-2col .main-content-card .card-body { padding: 2rem 2.75rem 2.25rem; }

/* Le formulaire GLPI/singlesignon est enfermé dans un .col-md-5 (bridé à 41%).
   On le remet à pleine largeur pour occuper la carte. */
.utheme-2col .main-content-card .row { justify-content: stretch !important; margin: 0 !important; }
.utheme-2col .main-content-card .col-md-5 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
}
.utheme-2col .singlesignon-auth-stack,
.utheme-2col .singlesignon-auth-pane { width: 100%; }

/* ---- En-tête injecté (logo + titre + sous-titre) ---- */
.unicommtheme-header { text-align: center; margin-bottom: 1.25rem; }
.unicommtheme-logo { max-height: 64px; max-width: 220px; margin-bottom: .85rem; }
.unicommtheme-title {
    font-size: 1.35rem; font-weight: 700; color: var(--utheme-brand);
    margin: 0 0 .25rem; line-height: 1.25;
}
.unicommtheme-subtitle { font-size: .92rem; color: #6c7a91; margin: 0; }

/* La carte gère son propre titre "Se connecter" : on l'atténue (redondant). */
.utheme-2col .singlesignon-classic-title h2,
.utheme-2col .card-header h2 { font-size: 1rem; color: #6c7a91; font-weight: 600; }

/* ---- Boutons ---- */
.utheme-2col .btn-primary,
.utheme-2col .btn-primary:focus {
    background: var(--utheme-brand) !important;
    border-color: var(--utheme-brand) !important;
    color: #ffffff !important;
    font-weight: 600;
}
.utheme-2col .btn-primary:hover,
.utheme-2col .btn-primary:active {
    background: #1b2d43 !important;
    border-color: #1b2d43 !important;
    color: #ffffff !important;
}
.utheme-2col .btn-primary * { color: #ffffff !important; }

/* Mot de passe oublié : couleur de marque, lisible sur blanc */
.utheme-2col .forgot_password a { color: var(--utheme-brand); }

/* ---- Bascule « Je suis un collaborateur / client » : vrais boutons ---- */
.utheme-2col .singlesignon-login-classic {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tblr-border-color, #e6e7e9);
}
.utheme-2col .singlesignon-login-classic > small,
.utheme-2col .singlesignon-login-classic > span { display: none; } /* retire un éventuel « ou » */

.utheme-2col [data-sso-switch] {
    display: block;
    width: 100%;
    text-align: center;
    padding: .6rem 1rem !important;
    border-radius: 8px;
    border: 1.5px solid var(--utheme-brand) !important;
    background: #fff;
    color: var(--utheme-brand) !important;
    font-weight: 600;
    text-decoration: none !important;
    transition: background .12s ease, color .12s ease;
}
.utheme-2col [data-sso-switch]:hover {
    background: var(--utheme-brand);
    color: #fff !important;
}

/* ---- Écran de choix : 2 boutons empilés ---- */
.utheme-chooser { margin: .25rem 0; }
.utheme-choice { padding: .75rem 1rem !important; font-weight: 600; font-size: 1rem; }
.utheme-2col .btn-outline-primary.utheme-choice {
    color: var(--utheme-brand) !important;
    border-color: var(--utheme-brand) !important;
    background: #fff !important;
}
.utheme-2col .btn-outline-primary.utheme-choice:hover {
    background: var(--utheme-brand) !important;
    color: #fff !important;
}

/* ---- Pied de page injecté ---- */
.unicommtheme-footer { font-size: .8rem; color: #97a3b4; }

/* ---- Responsive ---- */
/* Colonnes plus équilibrées sur écrans moyens */
@media (max-width: 1200px) {
    .utheme-left { flex-basis: 36%; max-width: 36%; }
    .utheme-2col .container-tight { padding: 2rem 2.25rem !important; }
    .utheme-2col .main-content-card { max-width: 560px; }
}

/* Passage en une colonne (image en bandeau au-dessus) */
@media (max-width: 820px) {
    .utheme-2col .flex-fill { flex-direction: column !important; min-height: auto; }
    .utheme-left {
        flex: 0 0 auto; max-width: 100%; width: 100%;
        min-height: 150px; padding: 1.5rem;
        border-right: 0; border-bottom: 1px solid rgba(0, 0, 0, .07);
    }
    .utheme-2col .container-tight { padding: 1.75rem 1.1rem !important; }
    .utheme-2col .main-content-card { max-width: 100%; box-shadow: none !important; }
    .utheme-2col .main-content-card .card-body { padding: 1.25rem 1.1rem 1.5rem; }
}

/* Petits mobiles */
@media (max-width: 420px) {
    .utheme-left { min-height: 110px; padding: 1rem; }
    .unicommtheme-title { font-size: 1.15rem; }
}
