﻿input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    border: 1px solid var(--bs-primary);
    -webkit-text-fill-color: var(--bs-primary);
    -webkit-box-shadow: 0 0 0px 1000px var(--bs-body-bg) inset;
    transition: background-color 5000s ease-in-out 0s;
}

.form-control {
    color: var(--bs-gray-800) !important;
}

.form-control:disabled, .form-control[readonly] {
    color: var(--bs-gray-600) !important;
}

/* === SB2 — contraste : le bas de l'échelle de gris du thème sombre est trop foncé
   (gray-500 = #565674). On le remonte GLOBALEMENT au niveau des variables, pour que
   tout ce qui s'en sert (texte secondaire, placeholders, bordures, cases à cocher, etc.)
   gagne en lisibilité, sans toucher à la logique des composants. */
html[data-bs-theme="dark"] {
    /* Grays "structurels" (placeholders, bordures, cases…) — remontés pour le contraste. */
    --bs-gray-400: #7E8299;
    --bs-gray-500: #92929F;
    --bs-gray-600: #A1A5B7;
    --bs-gray-700: #B5B5C3;
    /* Namespace SÉPARÉ des utilitaires de texte Metronic (.text-gray-*) — texte secondaire
       clairement lisible sur fond sombre. */
    --bs-text-gray-400: #92929F;
    --bs-text-gray-500: #A1A5B7;
    --bs-text-gray-600: #B5B5C3;
    --bs-text-gray-700: #C9C9D6;
}

/* text-muted ne s'appuie pas sur --bs-gray-* : on le remonte explicitement. */
html[data-bs-theme="dark"] .text-muted {
    color: #B5B5C3 !important;
}

/* Placeholder des champs : lisible mais plus discret que le texte saisi. */
html[data-bs-theme="dark"] .form-control::placeholder {
    color: #92929F !important;
    opacity: 1;
}

/* EXCEPTION : champs à label flottant — le placeholder doit rester TRANSPARENT,
   sinon il se superpose au label (« Identifiant », « Mot de passe »…). */
html[data-bs-theme="dark"] .form-floating > .form-control::placeholder {
    color: transparent !important;
}

/* Sidebar légèrement élargi (265px → 290px) pour que les libellés longs comme
   « Protection Double Facteur » tiennent sur une seule ligne, badge compris. */
@media (min-width: 992px) {
    :root {
        --bs-app-sidebar-width: 290px;
        --bs-app-sidebar-width-actual: 290px;
    }
}

/* Badges "secondaires" (ex. « Non configurée ») : le texte par défaut est trop sombre sur le
   thème dark → on l'éclaircit pour qu'il reste lisible. */
html[data-bs-theme="dark"] .badge.badge-light-secondary {
    background-color: #2b2c40 !important;
    color: #c5c8d4 !important;
}
