 /* ==================================================== */
/* A. VARIABLES ET BASE */
/* ==================================================== */
:root {
    /* Couleurs principales (Inspirées de Bootstrap, ajustées pour le design) */
    --primary: #4f46e5;      /* Bleu Indigo pour l'accentuation */
    --secondary: #4338ca;    /* Bleu plus foncé */
    --accent-color: #6366f1; /* Couleur d'accentuation vive */
    --success: #10b981;
    --info: #3b82f6;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Couleurs du Thème */
    --light-bg: #f3f4f6;     /* Fond du contenu principal */
    --dark-bg: #1f2937;      /* Fond de la sidebar (Dark) */
    --text-color: #374151;   /* Couleur principale du texte */
    --border-color: #e5e7eb; /* Couleur des bordures */
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-transition: all 0.3s ease-in-out;
    --font-primary: 'Inter', system-ui, -apple-system, sans-serif; /* Police moderne et lisible */
    --sidebar-text-color: #f9fafb;
    --sidebar-active-bg: rgba(255, 255, 255, 0.15);
}

body {
    font-family: var(--font-primary);
    background-color: var(--light-bg);
    color: var(--text-color);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ---------------------------------------------------- */
/* B. STRUCTURE DU DASHBOARD & RESPONSIVENESS (Toggle) */
/* ---------------------------------------------------- */

#wrapper {
    display: flex;
    min-height: 100vh;
}

/* 1. Sidebar */
#sidebar-wrapper {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--dark-bg); /* Thème sombre et élégant */
    transition: var(--sidebar-transition);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.15);
}

#sidebar-wrapper .sidebar-heading {
    padding: 20px 20px 20px 15px;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* 2. Main Content Wrapper */
#page-content-wrapper {
    width: 100%;
    min-width: 0;
    transition: var(--sidebar-transition);
    padding: 20px;
}

/* 3. Toggle effect (Mode Compact) */
#wrapper.toggled #sidebar-wrapper {
    margin-left: calc(var(--sidebar-width) * -1); /* Fait disparaître la sidebar */
}

/* ---------------------------------------------------- */
/* C. NAVIGATION (Sidebar & Navbar) */
/* ---------------------------------------------------- */

/* Sidebar Menu Items (Amélioration esthétique) */
.list-group-item {
    display: flex;
    align-items: center;
    padding: 12px 15px; /* Espace vertical */
    font-size: 1rem;
    font-weight: 500;
    color: var(--sidebar-text-color) !important;
    border: none !important;
    border-radius: 6px;
    margin: 5px 10px; /* Espace autour de chaque lien */
    background-color: transparent;
    transition: background-color 0.2s, transform 0.1s;
}

.list-group-item:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    transform: translateX(2px); /* Petit effet de mouvement au survol */
}

.list-group-item.active {
    background-color: var(--sidebar-active-bg) !important; 
    font-weight: 600;
    border-left: 4px solid var(--accent-color); /* Barre d'accentuation */
    margin-left: 0; 
    padding-left: 11px;
}

/* Styles des Icônes */
.list-group-item i {
    width: 25px; 
    margin-right: 10px;
    font-size: 1.1rem; /* Rendre les icônes légèrement plus grandes */
    color: var(--accent-color); /* Couleur d'accentuation pour les icônes */
    transition: color 0.2s;
}

.list-group-item.active i {
    color: white; /* Icône blanche quand l'élément est actif */
}

/* Navbar */
.navbar {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

/* ---------------------------------------------------- */
/* D. DASHBOARD CONTENT (Cards & Tables) */
/* ---------------------------------------------------- */

/* Card Enhancement (Ce design que vous avez apprécié) */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.7;
    text-transform: uppercase;
}

.card-text {
    font-weight: 700;
    font-size: 2.2rem;
    margin-top: 5px;
}

/* Table Enhancements */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background-color: white;
    /* Gère le défilement horizontal */
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
}

/* Style de la barre de défilement pour le tableau */
.table-responsive::-webkit-scrollbar {
    height: 8px; 
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.table thead {
    background-color: var(--primary);
    color: white;
}

.table thead th {
    border-bottom: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.table tbody tr:hover {
    background-color: #f7f7f9 !important; /* Survol des lignes */
}

/* Status Badges */
.status-badge {
    padding: 0.3em 0.8em;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-block;
}
.status-marie { background-color: #dbeafe; color: #1e40af; }
.status-celibataire { background-color: #d1fae5; color: #065f46; }
.status-divorce { background-color: #fee2e2; color: #991b1b; }
.status-veuf { background-color: #f3f4f6; color: #4b5563; }
.status-fiance { background-color: #fef3c7; color: #92400e; }


/* ---------------------------------------------------- */
/* E. MEDIA QUERIES (FULL RESPONSIVENESS) */
/* ---------------------------------------------------- */

@media (max-width: 992px) {
    /* Diminuer la taille des cartes sur les petites tablettes */
    .card-text {
        font-size: 1.8rem;
    }
}

/* Masquer la sidebar par défaut sur mobile (max 768px) */
@media (max-width: 768px) {
    
    #wrapper #sidebar-wrapper {
        margin-left: calc(var(--sidebar-width) * -1);
        position: fixed; 
        height: 100%;
        z-index: 1030; 
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.2);
    }
    
    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0; /* Afficher la sidebar quand l'icône est cliquée */
    }

    /* Le contenu prend tout l'espace */
    #page-content-wrapper {
        padding: 15px;
    }
    
    /* Fond semi-transparent quand la sidebar est ouverte */
    #wrapper.toggled #page-content-wrapper::before {
        content: '';
        position: fixed; /* Fixed pour couvrir tout le viewport */
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1029;
    }
    
    /* Masquer le titre de la sidebar sur les petits écrans */
    .sidebar-heading {
        font-size: 1.1rem;
    }

    .navbar-brand {
        display: none; 
    }
}

/* Réduire l'espace sur les mobiles très petits */
@media (max-width: 576px) {
    #page-content-wrapper {
        padding: 10px;
    }
}