/* ==========================================================================
   DESIGN INSTITUTIONNEL INSEI - STYLE "MODERN CAMPUS"
   Couleurs : Bleu Nuit (#1D2B57) et Rouge CY (#E30613)
   ========================================================================== */

:root {
    /* --- PALETTE --- */
    --color-primary: #1D2B57;       /* Bleu Nuit INSEI */
    --color-accent: #E30613;        /* Rouge CY */
    --color-bg-page: #eaeff2;       /* Gris bleuté très clair (Administratif) */
    --color-bg-card: #ffffff;       /* Blanc pur */
    --color-text-main: #2c3e50;     /* Gris foncé lisible */
    --color-input-bg: #f3f6f8;      /* Gris très clair pour les champs */
    --color-input-border: #dce1e6;  /* Bordure subtile */
    
    /* Variables CAS/MDC requises */
    --mdc-theme-primary: var(--color-primary);
    --mdc-theme-secondary: var(--color-accent);
    --mdc-theme-error: #b00020;
    --mdc-typography-font-family: "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
}

/* --- 1. STRUCTURE GÉNÉRALE --- */

body {
    background-color: var(--color-bg-page);
    /* Optionnel : Décommentez la ligne ci-dessous si vous avez une belle photo du bâtiment en fond */
    /* background: linear-gradient(rgba(29, 43, 87, 0.8), rgba(29, 43, 87, 0.8)), url('../images/background.jpg') no-repeat center center fixed; background-size: cover; */
    color: var(--color-text-main);
    font-family: var(--mdc-typography-font-family);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* --- 2. EN-TÊTE (HEADER) --- */

header[role="banner"] .mdc-top-app-bar__row {
    background-color: var(--color-primary) !important;
    height: 64px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Nettoyage du menu hamburger (Suppression du texte "menu") */
.mdc-top-app-bar__section--align-start .mdc-button__label {
    display: none !important;
}
.mdc-top-app-bar__navigation-icon {
    color: white !important;
}
#logo-container {
    display: flex;
    justify-content: center; /* Centre horizontalement */
    align-items: center;
    width: 100%;
    
    /* ESPACEMENTS À RÉGLER ICI */
    margin-top: 30px !important;    /* Espace entre le bandeau bleu et le logo */
    margin-bottom: 10px !important; /* Espace réduit entre le logo et le formulaire */
    
    position: relative;
    z-index: 10; /* S'assure qu'il passe au-dessus de tout */
}
#logo-container img {
    height: 80px !important;   /* Force une hauteur raisonnable (fini le logo géant) */
    width: auto !important;    /* Garde les proportions */
    max-width: 90% !important; /* Empêche de dépasser sur mobile */
    object-fit: contain;       /* S'assure que l'image est nette */
    
    /* Ombre légère pour le détacher du fond */
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}
.login-section, .mdc-card {
    margin-top: 0 !important; /* Colle la carte au plus près de la marge du logo */
}
/* La touche "Classe" : Une ligne rouge CY tout en haut de la carte */
.login-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: var(--color-accent);
}

/* Titre "Connexion" plus sobre */
h1, h2, h3 {
    color: var(--color-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Texte d'intro */
.login-section p {
    text-align: center;
    color: #666;
    font-size: 0.95rem;
}

/* --- 4. CHAMPS DE SAISIE (INPUTS) --- */

/* Style moderne : Fond gris qui devient blanc au focus */
.mdc-text-field--outlined {
    background-color: var(--color-input-bg);
    border-radius: 4px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.mdc-text-field--outlined:hover {
    background-color: #e8ecef;
}

.mdc-text-field--focused {
    background-color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(29, 43, 87, 0.1); /* Halo bleu subtil */
}

/* Enlever les bordures arrondies par défaut de MDC pour un look plus "Pro" */
.mdc-notched-outline__leading,
.mdc-notched-outline__notch,
.mdc-notched-outline__trailing {
    border-color: var(--color-input-border) !important;
    border-width: 1px !important;
}

.mdc-text-field--focused .mdc-notched-outline__leading,
.mdc-text-field--focused .mdc-notched-outline__notch,
.mdc-text-field--focused .mdc-notched-outline__trailing {
    border-color: var(--color-primary) !important;
    border-width: 2px !important;
}

/* Couleur du texte saisi */
.mdc-text-field__input {
    color: #000 !important;
    font-weight: 500;
}

/* Couleur des labels (Identifiant, Mot de passe) */
.mdc-floating-label {
    color: #666 !important;
}
.mdc-floating-label--float-above {
    color: var(--color-primary) !important;
    font-weight: bold;
}

/* --- 5. BOUTON SE CONNECTER --- */

.mdc-button--raised {
    background-color: var(--color-primary) !important; /* Bleu Nuit */
    height: 50px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    border-radius: 4px;
    width: 100%; /* Bouton pleine largeur */
    box-shadow: none !important;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.mdc-button--raised:hover {
    background-color: #2a3d75 !important; /* Bleu un peu plus clair au survol */
}

/* --- 6. RÉPARATION DU BOUTON ŒIL (Fix final) --- */
/* Pour qu'il soit parfaitement intégré dans le champ gris */

.mdc-text-field--with-trailing-icon .mdc-text-field__icon--trailing {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    width: 50px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 5;
    background-color: transparent; /* Fond transparent pour se fondre */
    color: var(--color-primary) !important; /* L'oeil en bleu nuit */
    cursor: pointer;
}

.mdc-text-field__icon--trailing .mdi {
    font-size: 22px !important;
}

/* --- 7. NETTOYAGE DIVERS --- */

/* Cacher les messages CAPS LOCK et Helper Text */
#capslock-on, 
.caps-warn, 
.caps-on,
.mdc-text-field-helper-line {
    display: none !important;
}

/* Pied de page discret */
footer {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    padding: 20px;
    opacity: 0.8;
}
/* --- FIX FINAL LOGO : CENTRÉ ET PETIT --- */

/* 1. Contraindre la taille de l'image (Plus petit) */
/* On force une hauteur de 50px (au lieu de 100% ou auto qui causait le logo géant) */
.cas-brand img.cas-logo,
.cas-brand,
header img {
    height: 50px !important;  /* Ajustez ici si besoin : 40px, 50px, 60px */
    width: auto !important;   /* Garde les proportions */
    max-width: 200px !important;
    object-fit: contain !important;
    border: none !important;
}

/* 2. Centrage absolu dans le bandeau du Header */
header[role="banner"] .mdc-top-app-bar__row {
    display: flex !important;
    justify-content: center !important; /* Centre horizontalement */
    align-items: center !important;     /* Centre verticalement */
    position: relative !important;
}

/* 3. Gérer le conteneur du logo pour qu'il ne prenne pas toute la place */
.cas-brand {
    margin: 0 auto !important; /* Marges auto pour centrer */
    flex-grow: 0 !important;   /* Empêche de s'étirer */
    display: flex !important;
    justify-content: center !important;
}

/* 4. (Astuce Pro) Empêcher le bouton "Menu" à gauche de pousser le logo */
/* On sort le menu du flux normal pour qu'il reste à gauche sans décaler le logo */
.mdc-top-app-bar__section--align-start {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    height: 100% !important;
    width: 64px !important; /* Largeur standard du bouton */
}

/* --- CACHER LE LIEN MOT DE PASSE OUBLIÉ --- */
#forgotPasswordLink,
#forgotPassword,
.forgot-password,
a[href*="password"] {
    display: none !important;
    visibility: hidden !important;
}
/* --- NETTOYAGE HEADER --- */
/* Cacher le logo original qui est resté dans le bandeau bleu */
header .cas-brand {
    display: none !important;
}

/* Réduire la hauteur du bandeau bleu puisqu'il est vide maintenant */
header[role="banner"] .mdc-top-app-bar__row {
    height: 50px !important;
}
/* Réduire la marge entre le logo et la carte */
.cas-brand {
    margin-bottom: 0 !important; /* Force zéro marge sous le logo */
}

/* Remonter légèrement la carte de connexion */
.login-section, .mdc-card {
    margin-top: 30px !important; /* Seulement 10px d'écart */
}
/* --- MASQUER LE BANDEAU BLEU (HEADER) --- */
header[role="banner"],
.mdc-top-app-bar,
.mdc-top-app-bar__row {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
}

/* --- AJUSTEMENT DU LOGO --- */
/* Comme le bandeau a disparu, il faut augmenter la marge du haut */
/* pour que le logo ne soit pas collé au bord de la fenêtre du navigateur */
#logo-container {
    margin-top: 60px !important; /* On donne de l'air au dessus du logo */
}
