/* =============================================================================
   crm-overrides.css — Personnalisations CRM par-dessus Dashtrans
   ============================================================================= */

/* --- Avatar utilisateur à initiales ---
   Porte AUSSI la classe .user-img de la template : taille (42px), rond et
   bordure viennent de app.css. Ici on n'ajoute QUE le rendu "initiales". */
.user-avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* --- Sélecteur de société (topbar) --- */
.company-switcher .company-active-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.company-switcher .dropdown-menu { min-width: 260px; }
.company-switcher .company-switch-item.active {
    background-color: rgba(13, 110, 253, 0.1);
    font-weight: 600;
}

/* --- Pages d'authentification --- */
body.bg-login {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    min-height: 100vh;
}
.authentication-container { padding: 1rem; }
.auth-card { border: none; border-radius: 1rem; }

/* --- Pages d'erreur --- */
body.bg-error { background: #f8f9fa; }

/* --- Zone flash --- */
.flash-zone .alert { margin-bottom: .75rem; }

/* --- Boutons d'action de ligne (DataTables) --- */
.btn-action-group .btn { margin-right: .15rem; }

/* --- Menu : labels de section --- */
.metismenu .menu-label {
    padding: .5rem 1.25rem .25rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    opacity: .6;
    font-weight: 700;
}

/* --- Toast container (fallback notify) --- */
#crm-toast-container .toast { box-shadow: 0 .5rem 1rem rgba(0,0,0,.15); }

/* --- Éditeur HTML léger (HOTFIX-PDF-HTML §2) --- */
.html-editor-toolbar .btn { font-size: .78rem; padding: .2rem .5rem; }
.html-editor-field { font-family: "SFMono-Regular", Consolas, monospace; font-size: .82rem; }
.html-rich-preview { border: 1px dashed #ccc; border-radius: .375rem; padding: .5rem .65rem; font-size: .85rem; background: #fafafa; min-height: 2.2rem; }
.html-rich-preview ul, .html-rich-preview ol { margin-bottom: .25rem; padding-left: 1.2rem; }
.html-rich-preview p { margin-bottom: .35rem; }

/* --- Dropdown recherche catalogue (HOTFIX-UI-PDF-BUSINESS §13) ---
   Fond explicitement solide + contraste garanti : sans cette règle, le
   dropdown flottant hérite d'un fond potentiellement transparent selon le
   contexte (thème sombre), le rendant presque illisible — même esprit
   visuel que le composant Select2 Dashtrans (fond clair, texte foncé,
   surbrillance au survol). */
#productResults.list-group {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: .375rem;
}
#productResults .list-group-item {
    background: #fff;
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, .08);
    cursor: pointer;
}
#productResults .list-group-item:hover,
#productResults .list-group-item:focus {
    background: #f3f6fb;
    color: #1a1a1a;
}
#productResults .list-group-item small {
    color: #6c757d;
}

/* --- Select2 (Dashtrans) : cohérence de hauteur avec .form-select --- */
.select2-container--bootstrap4 .select2-selection--single {
    height: calc(2.25rem + 2px) !important;
}
.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--bootstrap4.select2-container--open .select2-selection {
    border-color: #86b7fe;
    box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}

/* --- Champs de date natifs (HOTFIX-UI-PDF-BUSINESS §9) ---
   Sans color-scheme explicite, les champs date/heure natifs (icône
   calendrier, texte) peuvent hériter du mode sombre du système
   d'exploitation et devenir presque illisibles, indépendamment du thème de
   l'application. Force le rendu clair du contrôle natif. */
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
    color-scheme: light;
}
