/* -----------------------------------------
----                                    ----
----  EN MODE DE FONCTIONNEMENT COMMUN  ----
----                                    ----
--------------------------------------------
*/

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f8;
    /* Fond gris clair moderne */
    margin: 0;
    display: flex;
    flex-direction: column;
    /* Empilement vertical (Header, Main, Footer) */
    min-height: 100vh;
}

/* Conteneur Principal (Carte) */
.loginBody {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1000px;
    margin-top: 0;
    position: relative;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.8rem;
    border-bottom: 2px solid #478ac9;
    display: inline-block;
    padding-bottom: 10px;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

/* Croix de fermeture */
.close-register {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    color: #aaa;
    text-decoration: none;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-register:hover {
    color: #e74c3c;
}

/* Formulaire en Grille */
form {
    display: grid;
    grid-template-columns: 1fr;
    /* Mobile : 1 colonne */
    gap: 20px;
}

/* Champs de saisie */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    background-color: #f9fafb;
    transition: border-color 0.3s;
}

input:focus {
    border-color: #478ac9;
    outline: none;
    background-color: #fff;
}

/* Conteneur pour icônes */
.input-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-field-container input[type="password"] {
    padding-right: 40px; /* Espace pour l'icône œil */
}

.toggle-password {
    position: absolute;
    right: 10px;
    cursor: pointer;
    color: #666;
    font-size: 1.2rem;
}

.toggle-password:hover {
    color: #000;
}

/* Fieldsets (Sites & Marques) */
fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
    margin: 0;
    scroll-margin-top: 110px; /* Marge pour le scroll automatique (hauteur navbar + espace) */
}

legend {
    font-weight: 600;
    color: #4b5563;
    padding: 0 10px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

/* --- STYLE PERSONNALISÉ DES CHECKBOXES --- */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    margin: 0;
    margin-right: 10px;
    font: inherit;
    color: currentColor;
    width: 1.2em;
    height: 1.2em;
    border: 2px solid #478ac9;
    /* Bordure bleue */
    border-radius: 4px;
    display: grid;
    place-content: center;
    cursor: pointer;
}

input[type="checkbox"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
    /* Le V blanc */
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="checkbox"]:checked {
    background-color: #478ac9;
    /* Fond bleu quand coché */
}

input[type="checkbox"]:checked::before {
    transform: scale(1);
}

/* Style pour "Tout sélectionner" */
.label-select-all {
    color: #478ac9;
    font-weight: bold;
    margin-bottom: 10px;
    display: inline-flex;
}

/* --- STYLE PERSONNALISÉ DES RADIO BUTTONS (pour Rôle) --- */
.role-fieldset input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    margin: 0;
    margin-right: 10px;
    font: inherit;
    color: currentColor;
    width: 1.2em;
    height: 1.2em;
    border: 2px solid #e74c3c; /* Bordure ROUGE */
    border-radius: 4px; /* Carré arrondi comme checkbox */
    display: grid;
    place-content: center;
    cursor: pointer;
}

.role-fieldset input[type="radio"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white; /* Point blanc */
    /* Le V blanc (checkmark) */
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.role-fieldset input[type="radio"]:checked {
    background-color: #e74c3c; /* Fond ROUGE quand coché */
}

.role-fieldset input[type="radio"]:checked::before {
    transform: scale(1);
}

.btn-principal {
    flex: 1;
    max-width: 250px; /* Limiter la largeur des boutons */
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    background-color: #478ac9;
    font-weight: bold;
    display: inline-flex; /* Changé pour un meilleur contrôle de l'alignement */
    align-items: center;
    justify-content: center; 
    gap: 15px; /* Espace entre l'icône et le texte */
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    padding-left: 20px; /* Indentation pour l'icône */
}

.action-btn-icon {
    width: 25px;
    height: 25px;
    flex-shrink: 0; /* Empêche l'icône de se réduire */
}

.btn-principal:hover {
    background-color: #2d6ca8;
}



/* Alertes */
.alertError {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #fecaca;
}

.alertSuccess {
    background-color: #dcfce7;
    color: #166534;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #bbf7d0;
}

/* --------------------------------------------
----                                       ----
----  EN MODE DE FONCTIONNEMENT TELEPHONE  ----
----                                       ----
-----------------------------------------------
*/
@media screen and (max-width: 767.98px) {

    /* --- MENU DÉROULANT MOBILE (Accordéon) --- */
    .mobile-toggle-checkbox {
        display: none !important; /* On cache la checkbox technique */
    }

    .mobile-toggle-label {
        display: block;
        background-color: #e9ecef;
        color: #478ac9;
        padding: 10px;
        border-radius: 6px;
        text-align: center;
        font-weight: bold;
        cursor: pointer;
        margin-bottom: 10px;
        transition: background-color 0.3s;
        font-size: 0.9rem; 
    }

    .mobile-toggle-label:hover {
        background-color: #dee2e6;
    }

    .mobile-toggle-label::after {
        content: ' ▼';
        font-size: 0.8em;
    }
    .btn-principal
{
    max-width: 100%;
}

    /* Cible le label pour le rôle spécifiquement */
    .role-fieldset .mobile-toggle-label::after {
        content: ' ▼';
    }

    .collapsible-content {
        display: none; /* Caché par défaut sur mobile */
    }

    /* Quand on clique (checkbox cochée), on affiche le contenu */
    .mobile-toggle-checkbox:checked ~ .collapsible-content {
        display: block;
        animation: fadeIn 0.3s ease-in-out;
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(-5px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* -----------------------------------------
----                                    ----
----  EN MODE DE FONCTIONNEMENT PC      ----
----                                    ----
--------------------------------------------
*/
@media screen and (min-width: 768px) {

    main{
        margin-top: 0;
    }

    .loginBody {
        margin-top: 0;
    }

    form {
        grid-template-columns: 1fr 1fr;
        /* 2 colonnes */
        column-gap: 30px;
        row-gap: 25px;
    }

    /* Classes utilitaires pour la grille */
    .full-width {
        grid-column: 1 / -1;
        /* Prend toute la largeur */
    }

    /* Le bouton centré et moins large sur PC */
    button[type="submit"] {
        grid-column: 1 / -1;
        width: 50%;
        justify-self: center;
    }
    
    /* Cacher le bouton "menu déroulant" sur PC */
    .mobile-toggle-label {
        display: none;
    }

    /* Toujours afficher le contenu sur PC */
    .collapsible-content {
        display: block !important;
    }

    /* Grille 2 colonnes pour les checkboxes */
    .checkbox-group {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 2 colonnes égales */
        gap: 10px 20px; /* Espace vertical et horizontal */
    }

    /* On cache la checkbox technique aussi sur PC */
    .mobile-toggle-checkbox {
        display: none !important;
    }
}
