/**
 * Ajustements appliqués uniquement dans l'application mobile SIAMDesk.
 *
 * La classe `siam-app` est posée sur <html> par push-bootstrap.php dès le
 * <head>, à partir du marqueur « SIAMDeskApp » que l'application ajoute à son
 * User-Agent. Elle n'existe jamais dans un navigateur : rien de ce fichier ne
 * s'applique au site web, dont la mise en page est inchangée.
 *
 * Deux sujets :
 *   1. la barre du site, qui ferait doublon avec la barre native ;
 *   2. la page de connexion, redessinée pour le téléphone.
 */

/* ========================================================================
   1. Barre de navigation du site
   ========================================================================
   L'application affiche sa propre barre native, fixe en haut. Celle du site
   étant elle aussi `fixed-top`, les deux se superposeraient et mangeraient
   près d'un tiers de la hauteur utile sur un téléphone. Dans l'application,
   celle du site redevient une barre normale, qui défile avec le contenu : la
   navigation par rôle reste accessible, sans doublon figé. */

.siam-app body {
    padding-top: 0 !important;
}

.siam-app .navbar.fixed-top {
    position: static !important;
}

/* La barre native porte déjà le nom de l'application. */
.siam-app .navbar-brand {
    font-size: 1rem;
}

/* ========================================================================
   2. Page de connexion
   ========================================================================
   Le balisage n'est pas touché : tout passe par la feuille de style, donc le
   formulaire, ses champs, le « se souvenir de moi », le lien de mot de passe
   oublié et le sélecteur FR/EN gardent exactement leur comportement. */

.siam-app {
    /* Identité SIAM. Le vert principal est celui de l'application. */
    --app-green: #059A6D;
    --app-green-dark: #04603F;
    --app-green-deep: #0B3A26;
    --app-gold: #C9A84C;
    --app-gold-light: #E6C877;
}

.siam-app body.siam-auth {
    background: #FFFFFF;
}

.siam-app .auth-main {
    padding: 0 !important;
    align-items: stretch;
    min-height: 100vh;
}

.siam-app .auth-shell {
    max-width: none;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* La carte occupe tout l'écran : sur un téléphone, une carte flottante au
   milieu d'un fond vide gaspille la hauteur disponible. */
.siam-app .auth-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ---- En-tête vert ---------------------------------------------------- */

.siam-app .auth-card__head {
    position: relative;
    padding: 2.5rem 1.5rem 5.5rem;
    border-bottom: 0;
    background: var(--app-green-deep);
    background-image:
        radial-gradient(120% 90% at 85% 0%, rgba(5, 154, 109, 0.95) 0%, transparent 60%),
        linear-gradient(165deg, #0B3A26 0%, #06603F 55%, #059A6D 100%);
}

/* Vague dorée en bas de l'en-tête, reprise de la maquette. Dessinée en CSS
   plutôt qu'en image : rien à télécharger, et net sur tous les écrans. */
.siam-app .auth-card__head::after {
    content: '';
    position: absolute;
    left: -12%;
    right: -12%;
    bottom: 1rem;
    height: 3rem;
    background: var(--app-gold);
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.siam-app .auth-card__head > * {
    position: relative;
    z-index: 1;
}

.siam-app .auth-card__logo {
    height: auto;
    width: 7.5rem;
    padding: 0.5rem;
    margin: 0 auto 1.25rem;
    background: #FFFFFF;
    border-radius: 1.25rem;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.siam-app .auth-card__eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    color: var(--app-gold-light);
    margin-bottom: 0.5rem;
}

.siam-app .auth-card__title {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.siam-app .auth-card__subtitle {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.88);
}

/* ---- Sélecteur FR / EN ----------------------------------------------- */

.siam-app .auth-lang {
    margin-top: 1.5rem;
    border: 0;
    border-radius: 0.75rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.siam-app .auth-lang a {
    min-width: 4.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #FFFFFF;
    background: transparent;
    border: 0;
}

.siam-app .auth-lang a.is-active {
    color: var(--app-green-dark);
    background: var(--app-gold);
}

/* ---- Corps blanc ------------------------------------------------------ */

.siam-app .auth-card__body {
    position: relative;
    z-index: 2;
    /* Remonte juste assez pour que la vague dorée apparaisse comme un
       liseré courbe entre le vert et le blanc, et non comme un bandeau. */
    margin-top: -2.6rem;
    padding: 2rem 1.5rem 1.75rem;
    background: #FFFFFF;
    border-radius: 2rem 2rem 0 0;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
    flex: 1;
}

.siam-app .auth-field {
    margin-bottom: 1.25rem;
}

.siam-app .auth-field label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #15351F;
}

/* Les pictogrammes de la maquette, ajoutés sans toucher au balisage. */
.siam-app .auth-field label[for="email"]::before,
.siam-app .auth-field label[for="password"]::before {
    font-family: 'bootstrap-icons';
    font-weight: normal;
    font-size: 1.15rem;
    line-height: 1;
    color: var(--app-green);
}

/* Codes vérifiés dans bootstrap-icons 1.7.2, la version chargée par la page :
   bi-envelope et bi-lock. Ils changent d'une version à l'autre. */
.siam-app .auth-field label[for="email"]::before { content: '\f32f'; }
.siam-app .auth-field label[for="password"]::before { content: '\f47b'; }

.siam-app .auth-field .form-control {
    height: 3.25rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #DDE3DE;
    border-radius: 0.875rem;
    background: #FBFCFB;
}

.siam-app .auth-field .form-control:focus {
    border-color: var(--app-green);
    box-shadow: 0 0 0 0.2rem rgba(5, 154, 109, 0.18);
    background: #FFFFFF;
}

.siam-app .auth-options {
    margin: 0.25rem 0 1.5rem;
    font-size: 0.95rem;
}

.siam-app .auth-options .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    border-radius: 0.375rem;
    border-color: #C9D3CC;
}

.siam-app .auth-options .form-check-input:checked {
    background-color: var(--app-green);
    border-color: var(--app-green);
}

.siam-app .auth-options .form-check-label {
    padding-left: 0.25rem;
    color: #3C4A41;
}

.siam-app .auth-link {
    font-weight: 600;
    color: var(--app-green);
}

/* ---- Bouton ----------------------------------------------------------- */

.siam-app .auth-submit {
    width: 100%;
    min-height: 3.5rem;
    font-size: 1.0625rem;
    font-weight: 700;
    border: 0;
    border-radius: 0.875rem;
    color: #FFFFFF;
    background: var(--app-green-dark);
    box-shadow: 0 8px 20px rgba(4, 96, 63, 0.28);
}

.siam-app .auth-submit:active {
    transform: translateY(1px);
    box-shadow: 0 4px 12px rgba(4, 96, 63, 0.28);
}

/* ---- Pied -------------------------------------------------------------- */

.siam-app .auth-card__foot {
    padding: 1.25rem 1.5rem 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6B7A70;
    background: #FFFFFF;
    border: 0;
}

.siam-app .auth-note {
    margin: 0;
    padding: 0.25rem 1.5rem 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6B7A70;
    background: #FFFFFF;
}

.siam-app .auth-note .bi {
    color: var(--app-green);
}

/* Les alertes gardent leur sens, mais s'alignent sur les champs. */
.siam-app .auth-card__body .alert {
    border-radius: 0.875rem;
    font-size: 0.9375rem;
}

/* Écrans très courts : on resserre pour que le bouton reste atteignable
   sans défilement. */
@media (max-height: 680px) {
    .siam-app .auth-card__head {
        padding: 1.5rem 1.5rem 2.5rem;
    }

    .siam-app .auth-card__logo {
        width: 5.5rem;
        margin-bottom: 0.75rem;
    }

    .siam-app .auth-card__title {
        font-size: 1.75rem;
    }

    .siam-app .auth-field {
        margin-bottom: 0.875rem;
    }
}
