/* ========================================
   GLOBAL SEARCH CSS - VERSION PROPRE
   ======================================== */

/* Styles pour la recherche globale uniquement */
#global-search-input {
    transition: all 0.3s ease;
}

#global-search-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-width: 400px !important; /* Largeur réduite */
    margin: 0 auto;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1050;
}

#search-results-content {
    max-height: 350px;
    overflow-y: auto;
    padding: 0;
}

/* Styles spécifiques pour les résultats de recherche */
.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    background: white;
}

.search-result-item:hover {
    background-color: #f8f9fa;
    border-left: 3px solid #007bff;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Icône du résultat - Style AdminLTE */
.search-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 0.9rem;
    color: white;
    background-color: #007bff;
    flex-shrink: 0;
}

/* Icônes par type - Couleurs AdminLTE */
.search-result-icon.fa-user {
    background-color: #28a745; /* success */
}

.search-result-icon.fa-truck {
    background-color: #ffc107; /* warning */
    color: #212529;
}

.search-result-icon.fa-box {
    background-color: #17a2b8; /* info */
}

.search-result-icon.fa-file-invoice,
.search-result-icon.fa-file-invoice-dollar {
    background-color: #6f42c1; /* purple */
}

.search-result-icon.fa-receipt,
.search-result-icon.fa-file-alt {
    background-color: #fd7e14; /* orange */
}

.search-result-icon.fa-university {
    background-color: #6c757d; /* secondary */
}

/* Contenu du résultat */
.search-result-item .flex-grow-1 {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Type de résultat - Style badge AdminLTE */
.search-result-type {
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.search-result-type.client {
    background-color: #28a745;
    color: white;
}

.search-result-type.fournisseur {
    background-color: #ffc107;
    color: #212529;
}

.search-result-type.produit {
    background-color: #17a2b8;
    color: white;
}

.search-result-type.facture_client,
.search-result-type.facture_fournisseur {
    background-color: #6f42c1;
    color: white;
}

.search-result-type.bon_client,
.search-result-type.bon_fournisseur {
    background-color: #fd7e14;
    color: white;
}

.search-result-type.compte_bancaire {
    background-color: #6c757d;
    color: white;
}

/* En-têtes de section - Style AdminLTE */
.search-section-header {
    padding: 0.5rem 1rem;
    background-color: #f4f6f9;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-section-header i {
    color: #007bff;
    font-size: 0.9rem;
}

/* Filtres de recherche - Style AdminLTE */
.search-filters {
    padding: 0.75rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.search-filter-checkbox {
    display: flex;
    align-items: center;
}

.search-filter-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #495057;
    cursor: pointer;
    margin: 0;
}

.search-filter-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #007bff;
}

/* Historique de recherche - Style AdminLTE */
.search-history {
    padding: 0.75rem 1rem;
}

.search-history-title {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.search-history-item {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    margin: 0.2rem 0.3rem 0.2rem 0;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 0.8rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-history-item:hover {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Message "Aucun résultat" - Style AdminLTE */
.search-no-results {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    font-size: 0.9rem;
}

.search-no-results i {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Animation de chargement - Style AdminLTE */
.search-loading {
    padding: 1rem;
    text-align: center;
    color: #007bff;
    font-size: 0.9rem;
}

.search-loading i {
    margin-right: 0.5rem;
}

/* Message "Aucun résultat" */
.search-no-results {
    padding: 2rem 1.25rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.search-no-results::before {
    content: '🔍';
    display: block;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Animation de chargement */
.search-loading {
    padding: 1.5rem 1.25rem;
    text-align: center;
    color: #007bff;
}

.search-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive pour la recherche */
@media (max-width: 768px) {
    #search-results-dropdown {
        border-radius: 0 0 15px 15px;
    }
    
    .search-result-item {
        padding: 0.5rem 0.75rem;
    }
    
    .search-result-title {
        font-size: 0.9rem;
    }
    
    .search-result-description {
        font-size: 0.8rem;
    }
}

/* ========================================
   SIDEBAR STYLES (NON-NAVBAR)
   ======================================== */

/* Styles pour la sidebar gauche uniquement */
.main-sidebar {
    transition: width 0.3s ease-in-out;
}

.sidebar-collapse .main-sidebar {
    width: 4.6rem !important;
}

.main-sidebar .brand-link.logo_sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.main-sidebar .brand-link.logo_sidebar img {
    max-width: 40px;
    max-height: 40px;
}

/* User panel dans la sidebar */
.main-sidebar .user-panel {
    padding: 1rem;
}

.main-sidebar .user-panel .image {
    display: flex;
    align-items: center;
}

.main-sidebar .user-panel .info {
    margin-left: 0.5rem;
}

/* Navigation dans la sidebar */
.main-sidebar .nav-sidebar .nav-item .nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: #495057;
    transition: all 0.3s ease;
}

.main-sidebar .nav-sidebar .nav-item .nav-link:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.main-sidebar .nav-sidebar .nav-item .nav-link.active {
    background-color: #007bff;
    color: white;
}

.main-sidebar .nav-sidebar .nav-item .nav-link i {
    margin-right: 0.5rem;
    width: 1.5rem;
    text-align: center;
}

.main-sidebar .nav-sidebar .nav-item .nav-link p {
    margin: 0;
    flex: 1;
}

/* Sidebar en mode collapse */
.sidebar-collapse .main-sidebar .nav-sidebar .nav-item .nav-link {
    text-align: center;
    padding: 0.75rem 0.5rem;
    justify-content: center;
}

.sidebar-collapse .main-sidebar .nav-sidebar .nav-item .nav-link p {
    display: none;
}

.sidebar-collapse .main-sidebar .nav-sidebar .nav-item .nav-link i {
    margin: 0;
}

/* ========================================
   DÉCONNEXION DANS SIDEBAR
   ======================================== */

.main-sidebar .nav-sidebar .nav-item .nav-link.text-danger {
    color: #dc3545 !important;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.main-sidebar .nav-sidebar .nav-item .nav-link.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1) !important;
    border-left-color: #dc3545 !important;
    color: #dc3545 !important;
}

.main-sidebar .nav-sidebar .nav-item .nav-link.text-danger i {
    color: #dc3545 !important;
}

.main-sidebar .nav-sidebar .nav-item.mt-3 {
    margin-top: 2rem !important;
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
}

/* ========================================
   CORRECTIONS GÉNÉRALES
   ======================================== */

/* Supprimer tout espace blanc entre navbar et contenu */
body {
    padding-top: 0 !important;
}

.wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.content-wrapper {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.container-fluid {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Empêcher tout débordement horizontal */
html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

.wrapper {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* Box-sizing pour tous les éléments */
* {
    box-sizing: border-box !important;
}