/* style_pro.css (FINAL - COMPLET AVEC CORRECTION LAUNCHPAD) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css');

:root {
    --primary-color: #3b82f6;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --bg-color: #111827; /* Fond principal sombre */
    --bg-light-color: #1f2937; /* Fond des cartes, sidebar */
    --bg-lighter-color: #374151; /* Couleur pour hover, etc. */
    --border-color: #374151; /* Bordures */
    --text-color: #e5e7eb; /* Texte principal clair */
    --text-muted-color: #9ca3af; /* Texte secondaire grisé */
    --header-height: 60px;
    --sidebar-width: 260px;
    --font-family: 'Inter', sans-serif;
}

/* --- BASE ET DISPOSITION --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}
.page-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.app-body {
    display: flex;
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    padding-top: var(--header-height);
}
main {
    flex-grow: 1;
    padding: 2.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* --- HEADER --- */
#app-header {
    height: var(--header-height);
    background-color: var(--bg-light-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 200;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.hamburger-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    cursor: pointer;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    transition: background-color 0.2s;
}
.hamburger-btn:hover { background-color: var(--bg-lighter-color); }
.header-logo a { color: var(--text-color); font-weight: 600; text-decoration: none; font-size: 1.1rem; }
.user-profile span { font-weight: 500; }
.btn { padding: 10px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-family); transition: all 0.2s; }
.btn-primary { background-color: var(--primary-color); color: white; }
.btn-secondary { background-color: var(--bg-light-color); color: var(--text-color); border: 1px solid var(--border-color); }
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- SIDEBAR & VOILE --- */
#app-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background-color: var(--bg-light-color);
    padding: 1.5rem 1rem;
    border-right: 1px solid var(--border-color);
    transform: translateX(calc(-1 * var(--sidebar-width)));
    transition: transform 0.3s ease;
    z-index: 100;
    overflow-y: auto;
}
#sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); z-index: 99; }
body.sidebar-visible #app-sidebar { transform: translateX(0); }
body.sidebar-visible #sidebar-overlay { display: block; }
#app-sidebar ul { list-style: none; }
#app-sidebar ul li a { display: flex; align-items: center; gap: 1rem; padding: 0.8rem; border-radius: 6px; color: var(--text-muted-color); text-decoration: none; transition: color 0.2s, background-color 0.2s; }
#app-sidebar ul li a:hover { background-color: var(--bg-lighter-color); color: var(--text-color); }
#app-sidebar ul li a.active { background-color: var(--primary-color); color: white; }
#app-sidebar ul li a .fas { width: 20px; text-align: center; }

/* --- LAUNCHPAD --- */
.launchpad-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2.5rem;
    padding: 1rem 0;
    margin-top: 2rem;
}
.launchpad-item {
    position: relative;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.launchpad-item a { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    text-align: center; 
    width: 100%; 
    height: 100%; 
    text-decoration: none; 
    color: var(--text-color); 
}
.launchpad-item-icon { 
    width: 65%; 
    height: 65%; 
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)); 
    border-radius: 22%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 0.75rem; 
    transition: all 0.3s ease; 
}
.launchpad-item-icon i { font-size: 2.5rem; color: var(--text-muted-color); transition: color 0.3s ease; }
.launchpad-item-label { font-size: 0.9rem; font-weight: 500; }
.launchpad-item.is-disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Sous-modules au survol pour le dashboard principal --- */
.submodules-container {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background-color: rgba(31, 41, 55, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1rem;
    z-index: 10; width: 280px; opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}
.submodules-list { list-style: none; }
.submodules-list li a { display: block; color: var(--text-color); text-decoration: none; padding: 0.75rem; border-radius: 8px; font-weight: 500; }
.submodules-list li a:hover { background-color: var(--primary-color); }
.submodules-list li a.is-disabled { color: var(--text-muted-color); cursor: not-allowed; }
.submodules-list li a.is-disabled:hover { background-color: transparent; }

/* Effets de survol */
.launchpad-item:hover { transform: scale(1.05); z-index: 20; }
.launchpad-item:not(.is-disabled):hover .launchpad-item-icon { background: linear-gradient(145deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0)); }
.launchpad-item:not(.is-disabled):hover .launchpad-item-icon i { color: var(--primary-color); }
.launchpad-item:hover .submodules-container { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }


/* --- CONTROLS BAR (FILTRES, PAGINATION) --- */
.controls-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 1rem; }
.filters-container { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.search-filter { position: relative; }
.search-filter .fa-search { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted-color); }
.search-filter input { padding-left: 35px; width: 250px; }

/* --- PAGINATION --- */
.pagination-container { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; }
.pagination-container select { width: 80px; }
.pagination-controls button { background: var(--bg-light-color); border: 1px solid var(--border-color); color: var(--text-color); cursor: pointer; padding: 5px 10px; border-radius: 4px; }
.pagination-controls button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination-info { font-weight: 500; }

/* --- TABLE CONTAINER & STICKY HEADER --- */
.table-container {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
    position: sticky;
    top: 0;
    background-color: var(--bg-light-color);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}
.data-table tbody td { padding: 12px 15px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background-color: rgba(255, 255, 255, 0.03); }

/* --- MODALE --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.7); justify-content: center; align-items: center; padding: 2rem; }
.modal-content { background-color: var(--bg-light-color); margin: auto; border: 1px solid var(--border-color); width: 100%; max-width: 750px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); display: flex; flex-direction: column; max-height: 90vh; }
.modal-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 1.25rem; }
.close-btn { color: var(--text-muted-color); font-size: 1.8rem; font-weight: bold; cursor: pointer; background: none; border: none; }
.close-btn:hover, .close-btn:focus { color: var(--text-color); }
.modal-body { padding: 1.5rem; overflow-y: auto; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

/* --- FORMULAIRES DANS LA MODALE --- */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; }
.form-control { width: 100%; padding: 10px; background-color: var(--bg-color); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-color); font-family: var(--font-family); font-size: 0.95rem; }
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3); }
.form-row { display: flex; gap: 1.5rem; }
.form-row .form-group { flex: 1; margin-bottom: 0; }
.form-group small { font-size: 0.8rem; color: var(--text-muted-color); margin-top: 5px; display: block; }
#societes-checkboxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; background: var(--bg-color); padding: 1rem; border-radius: 6px; border: 1px solid var(--border-color); }
#societes-checkboxes div { display: flex; align-items: center; gap: 0.5rem; }

/* --- LISTES DE FICHIERS DANS LA MODALE --- */
.files-list .file-item { background-color: var(--bg-color); padding: 8px 12px; border-radius: 5px; display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 0.9rem; }
.files-list .file-item a { color: var(--text-color); text-decoration: none; }
.files-list .file-item button.btn-delete-file { background: none; border: none; color: var(--danger-color); cursor: pointer; font-size: 1.2rem; padding: 0 5px; }

/* --- BADGES & ICÔNES --- */
.badge-societe { background-color: var(--border-color); padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 500; display: inline-block; margin: 2px; }
.file-icon-link { font-size: 1.5rem; color: var(--text-muted-color); transition: color 0.2s; margin: 0 5px; }
.file-icon-link:hover { color: var(--primary-color); }
.fa-file-pdf { color: #f40f02; }
.fa-file-word { color: #2b579a; }

/* --- BOUTON AVEC CHARGEMENT --- */
.btn.loading .btn-text { display: none; }
.btn .spinner { display: none; }
.btn.loading .spinner { display: inline-block; width: 1.2em; height: 1.2em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spinner-border .75s linear infinite; }
@keyframes spinner-border { to { transform: rotate(360deg); } }

/* --- CLASSES D'ALERTE POUR TABLEAU --- */
td.alert-danger, .alert-danger td { background-color: rgba(239, 68, 68, 0.15) !important; font-weight: bold; }
td.alert-warning, .alert-warning td { background-color: rgba(245, 158, 11, 0.15) !important; }

/* --- NOUVEAUX STYLES POUR LA LISTE DES PERMISSIONS --- */
#pages-checkboxes {
    display: block;
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}
.permission-module {
    margin-bottom: 0.5rem;
}
.permission-module:last-child {
    margin-bottom: 0;
}
.permission-module-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.permission-module-header:hover {
    background-color: var(--bg-lighter-color);
}
.permission-module-header .fa-caret-right {
    transition: transform 0.2s ease-in-out;
    width: 12px;
}
.permission-module-header.expanded .fa-caret-right {
    transform: rotate(90deg);
}
.permission-module-header label {
    margin-bottom: 0; /* Override form-group label style */
    font-weight: 600;
    cursor: pointer;
    flex-grow: 1;
}
.permission-submodules {
    padding-left: 2rem;
    margin-top: 0.75rem;
    display: none; /* Caché par défaut */
}
.permission-submodules.visible {
    display: block; /* Affiché par JS */
}
.permission-submodule-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.permission-submodule-item label {
    font-weight: 400;
    color: var(--text-muted-color);
    margin-bottom: 0;
    cursor: pointer;
}