* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
}

/* App container hidden until login */
#app {
    width: 100%;
    height: 100vh;
    display: none; /* L'app est cachée par défaut */
    background-color: var(--bg);
}

#app.visible {
    display: flex;
}

/* Login Page Styles */
        /* Enhanced Login Page Styles */
#login-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #ffffff 0%, #625eb617 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow: hidden;
}

/* Enhanced animated background particles */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.particle {
    position: absolute;
    background: rgba(128, 127, 127, 0.1);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

.particle:nth-child(1) {
    width: 80px;
    height: 80px;
    left: 10%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    width: 120px;
    height: 120px;
    left: 20%;
    animation-delay: 2s;
}

.particle:nth-child(3) {
    width: 60px;
    height: 60px;
    left: 70%;
    animation-delay: 4s;
}

.particle:nth-child(4) {
    width: 100px;
    height: 100px;
    left: 80%;
    animation-delay: 1s;
}

.particle:nth-child(5) {
    width: 90px;
    height: 90px;
    left: 50%;
    animation-delay: 3s;
}

.particle:nth-child(6) {
    width: 70px;
    height: 70px;
    left: 85%;
    animation-delay: 5s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10%, 90% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.8;
    }
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    padding: 50px 40px;
    width: 100%;
    max-width: 450px;
    position: relative;
    z-index: 2;
    animation: slideUp 1s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
    from {
        transform: translateY(60px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.logo_lgn{
    text-align: center;
    margin-bottom: 40px;
}

.logo_lgn h1 {
    color: #667eea;
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #e07e0e, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo_lgn p {
    color: #666;
    font-size: 1rem;
    font-weight: 500;
}

.form-group {
    margin-bottom: 30px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
}

.input-wrapper {
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 18px 55px 18px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 16px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    outline: none;
    font-weight: 500;
}

.form-group input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.form-group input:hover:not(:focus) {
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.input-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #999;
    pointer-events: none;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.password-toggle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-50%) scale(1.1);
}

input[type="password"]::-ms-reveal,
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none;
}

.login-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #e07e0e, #764ba2);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.login-btn:active {
    transform: translateY(-1px);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.login-btn:hover::before {
    left: 100%;
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.success-message {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
    display: none;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.error-message {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
    display: none;
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Loading animation */
.loading-spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced ripple effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Form validation styles */
.form-group input:invalid {
    border-color: #ef4444;
}

.form-group input:valid {
    border-color: #10b981;
}

/* Focus ring enhancement */
.login-btn:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}


/* Sidebar */
.sidebar {
    width: 300px;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e1e5e9;
}

.logo-section {
    display: flex;
    align-items: center;
    padding: 20px 15px;
    border-bottom: 1px solid #e1e5e9;
}

.logo {
    color: #667eea;
    font-size: 3rem;
    font-weight: 800;
    width: 250px;
    height: 80px;
    border-radius: 8px;
    margin-right: 12px;
    background: linear-gradient(135deg, #e07e0e, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.menu-section {
    flex: 1;
    padding: 20px 0;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    color: #6c757d;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    margin: 2px 8px;
    border-radius: 6px;
}

.menu-item-content {
    display: flex;
    align-items: center;
    gap: 12px; /* Espace entre l'icône et le texte */
}

.menu-item svg {
    stroke: #6c757d; /* Couleur de l'icône par défaut */
    transition: stroke 0.2s ease;
    flex-shrink: 0; /* Empêche l'icône de se déformer */
}

.menu-item:hover {
    background: #f8f9fa;
    color: #495057;
}

.menu-item:hover svg {
    stroke: #495057; /* Couleur de l'icône au survol */
}

.menu-item.active {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

.menu-item.active svg {
    stroke: #1976d2; /* Couleur de l'icône quand actif */
}

.menu-badge {
    background: #adb5bd;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.menu-item.active .menu-badge {
    background: #1976d2;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-image: url('/static/background.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;;
}

/* Header */
.header {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
}

.header-controls {
    display: flex;
    align-items: center; 
    gap: 15px;
}

.search-box {
    padding: 10px 40px 10px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    width: 650px;
    font-size: 14px;
    background: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>') no-repeat right 12px center;
    background-size: 16px;
    position: relative;
}

.search-box:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.filter-dropdown {
    padding: 10px 30px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    background: white;
    font-size: 14px;
    min-width: 140px;
    cursor: pointer;
    position: relative;
}

.filter-dropdown:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.add-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s ease;
}

.add-btn:hover {
    background: #d32f2f;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    max-width: 1200px;
}

/* Tool Cards */
.tool-card {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e1e5e9;
    transition: all 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}


.tool-created-date {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.7rem;
    color: #999;
    font-style: italic;
}   
.tool-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.tool-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 14px;
    color: white;
}

.tool-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.status-label {
    font-size: 12px;
    font-weight: 500;
    margin-left: auto;
}

.status-label.running { color: #4caf50; }
.status-label.starting { color: #ff9800; }
.status-label.stopped { color: #f44336; }

.tool-description {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.tool-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-actions {
    display: flex;
    gap: 12px;
}

.status-label.starting { color: #ff9800; }
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #ff9800;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 6px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* modal overlay */
#details-modal {
display: none;
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
background: rgba(0,0,0,0.5);
justify-content: center;
align-items: center;
z-index: 1000;
}

/* modal box */
#details-modal .modal-content {
background: #fff;
padding: 20px;
border-radius: 8px;
max-width: 500px;
width: 90%;
position: relative;
box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* close “×” */
#details-modal .close-btn {
position: absolute;
top: 10px; right: 10px;
font-size: 20px;
cursor: pointer;
color: #888;
}
#details-modal .close-btn:hover {
color: #333;
}

/* title/body */
#details-modal .modal-title {
margin-top: 0;
font-size: 1.25em;
}
#details-modal .modal-body {
white-space: pre-wrap; /* preserve newlines */
}


.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-outline {
    background: white;
    border: 1px solid #ddd;
    color: #6c757d;
}

.btn-outline:hover:not([disabled]) {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover:not([disabled]) {
    background: #1565c0;
}

.construction-message {
    display: none;
    text-align: center;
    padding: 100px 20px;
    color: #6c757d;
}

.construction-message h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #495057;
}

.construction-message p {
    font-size: 1.1rem;
}

.login-loading {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: #666;
    display: none;
}

/* ===============================
   STYLES DU BOUTON DE DÉCONNEXION
   =============================== */
.btn-delogout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px; /* Espace entre l'icône et le texte */
    padding: 12px;
    width: 100%;
    border: none;
    border-radius: 8px;
    background-color: #2c3543; /* Couleur de fond plus foncée, assortie à la sidebar */
    color: #aeb9c9; /* Couleur du texte plus douce */
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.btn-delogout:hover {
    background-color: #e63946; /* Couleur d'accentuation au survol (rouge) */
    color: #ffffff; /* Texte blanc au survol */
}

.btn-delogout svg {
    transition: stroke 0.3s ease;
}

.btn-delogout:hover svg {
    stroke: #ffffff; /* Icône blanche au survol */
}

/* ===============================
   STYLES DE LA SECTION ADMINISTRATION (VERSION FINALE CORRIGÉE)
   =============================== */

.admin-table {
    display: none;
    padding: 0;
    animation: fadeIn 0.5s ease-out;
    width: 100%;
    max-width: 1500px;
    margin-left: auto;
    margin-right: auto;
}

/* --- STYLES POUR LE TITRE ET L'INDICATION DE LA SECTION ADMIN --- */
.admin-table .title {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937; /* Un noir doux et professionnel */
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.admin-table .hint {
    font-size: 15px;
    color: #6b7280; /* Un gris moyen pour être moins proéminent */
    margin-bottom: 24px; /* Plus d'espace avant le tableau */
    font-style: italic;
}


@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-table .page {
    max-width: none;
    padding: 0;
}

.table-wrap {
    overflow: auto; /* Défilement horizontal et vertical */
    max-height: 70vh;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.06);
    margin-top: 0;
    margin-bottom: 20px;
}

#top-scrollbar-container {
    overflow-x: auto;
    overflow-y: hidden;
    height: 20px;
    margin-top: 20px;
}

#top-scrollbar-content {
    height: 1px;
}

.table-wrap::-webkit-scrollbar { display: none; }
.table-wrap { -ms-overflow-style: none; scrollbar-width: none; }

#permissions-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* --- Hiérarchie des couches (Z-INDEX) pour les éléments "sticky" --- */

/* Règle de base pour TOUS les en-têtes (y compris les fixes) */
#permissions-table th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    color: #4b5563;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    border-bottom: 1px solid #e1e5e9;
    /* AJOUT: Ajoute un séparateur vertical à droite de chaque en-tête */
    border-right: 1px solid #dde1e6;
    z-index: 2; /* Couche 2 : Tous les en-têtes */
}

/* Enlève la bordure du tout dernier en-tête pour un rendu plus propre */
#permissions-table th:last-child {
    border-right: none;
}

/* Règle de base pour TOUTES les cellules de données */
#permissions-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    white-space: nowrap;
    background: #fff;
    font-size: 14px;
}

#permissions-table tbody tr:hover td {
    background: #f9fafb;
}

/* --- SPÉCIFICITÉS POUR LES COLONNES FIXES --- */

/* Définition des largeurs */
.col-group { width: 180px; min-width: 180px; }
.col-user { width: 220px; min-width: 220px; }

/* Cellules de données fixes (colonne GROUPE et UTILISATEUR) */
td.frozen, td.frozen-2 {
    position: sticky;
    left: 0;
    background: #fff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    z-index: 1; /* Couche 1 : Cellules de données fixes */
}

td.frozen-2 {
    left: 180px;
}

/* --- STYLE POUR LA LIGNE DE GESTION DE GROUPE (PAR COULEUR) --- */

/* Style de base pour les cellules de la ligne de gestion */
.group-master-row td {
    font-weight: 500;
    transition: background-color 0.2s ease;
}

/* Définition des couleurs de fond et de texte pour chaque groupe */
.group-color-blue td { background-color: #eff6ff; color: #1d4ed8; }
.group-color-purple td { background-color: #f5f3ff; color: #5b21b6; }
.group-color-orange td { background-color: #fff7ed; color: #9a3412; }
.group-color-green td { background-color: #f0fdf4; color: #15803d; }
.group-color-gray td { background-color: #f8f9fa; color: #374151; }

/* S'assurer que le fond s'applique aussi aux cellules fixes (redondant mais sûr) */
.group-color-blue td.frozen, .group-color-blue td.frozen-2 { background-color: #eff6ff; }
.group-color-purple td.frozen, .group-color-purple td.frozen-2 { background-color: #f5f3ff; }
.group-color-orange td.frozen, .group-color-orange td.frozen-2 { background-color: #fff7ed; }
.group-color-green td.frozen, .group-color-green td.frozen-2 { background-color: #f0fdf4; }
.group-color-gray td.frozen, .group-color-gray td.frozen-2 { background-color: #f8f9fa; }

/* Effet de survol pour chaque couleur */
.group-color-blue:hover td { background-color: #dbeafe; }
.group-color-purple:hover td { background-color: #ede9fe; }
.group-color-orange:hover td { background-color: #ffedd5; }
.group-color-green:hover td { background-color: #dcfce7; }
.group-color-gray:hover td { background-color: #f3f4f6; }


/* Cellule pour les badges */
.cell-status {
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.badge.active {
    background: #ecfdf5;
    border-color: #059669;
    color: #059669;
}

.group-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Couleurs des groupes */
.dot.blue { background: #3b82f6; }
.dot.purple { background: #8b5cf6; }
.dot.orange { background: #f97316; }
.dot.green { background: #10b981; }
.dot.gray { background: #6b7280; }

/* Loading state */
#loader {
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

/* Tooltip pour les actions */
.badge[role="button"] {
    position: relative;
}

.badge[role="button"]:hover::before {
    content: "Cliquez pour modifier l'accès";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1f2937;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
}



.admin-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #fff8e1; /* Jaune clair */
    border: 1px solid #ffecb3;
    border-radius: 8px;
    margin-bottom: 15px;
}

.admin-actions-bar span {
    font-weight: 500;
    color: #6d4c41;
}

.admin-actions-bar .action-buttons {
    display: flex;
    gap: 10px;
}

.badge.pending {
    background-color: #f39c12 !important; /* Orange */
    color: white !important;
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.7);
    transform: scale(1.05);
}

.badge.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* --- Styles pour la pagination --- */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #e1e5e9;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

#page-info {
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
}

.pagination-controls .btn {
    flex: 0 1 auto; /* Empêche les boutons de s'étirer */
    min-width: 110px;
}

/* Responsive */
@media (max-width: 1024px) {
    .table-wrap {
        margin: 0 -20px;
        border-radius: 0;
    }
    
    #permissions-table th,
    #permissions-table td {
        padding: 8px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .header-controls {
        justify-content: space-between;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* ==============================================================================
   --- SECTION GESTION DES UTILISATEURS ---
   ============================================================================== */

/* Conteneur principal de la page de gestion des utilisateurs */
.user-management-page {
    display: none; /* Caché par défaut */
    
    animation: fadeIn 0.5s ease-out;
    width: 100%;
    max-width: 1500px; /* Limite la largeur pour une meilleure lisibilité */
    margin: 0 auto; /* Centre la page */
}

/* En-tête de la page (Titre + Bouton Ajouter) */
.user-management-page .page-header {
    display: flex;
    flex-direction: column; /* MODIFIÉ : Aligne les éléments verticalement */
    align-items: flex-start; /* MODIFIÉ : Aligne les éléments à gauche */
    margin-bottom: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e5e9;
}
.user-management-page .hint {
    font-size: 15px;
    color: #6b7280; /* Un gris moyen pour être moins proéminent */
    margin-bottom: 24px; /* Plus d'espace avant le tableau */
    font-style: italic;
}

.user-management-page .page-header h2 {
    font-size: 28px; /* MODIFIÉ : Identique au titre admin */
    font-weight: 700; /* MODIFIÉ : Identique au titre admin */
    color: #1f2937; /* MODIFIÉ : Identique au titre admin */
    letter-spacing: -0.5px; /* MODIFIÉ : Identique au titre admin */
    margin-bottom: 16px; /* AJOUT : Espace entre le titre et le bouton */
}

/* Style pour le bouton "Ajouter un utilisateur" */
.user-management-page .page-header .btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Conteneur du tableau */
.user-management-page .table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: auto; /* Pour que le radius s'applique aux coins du tableau */
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    position: relative;
    max-height: calc(100vh - 250px);
}

/* Tableau des utilisateurs */
#user-management-table {
    width: 100%;
    border-collapse: collapse;
}

#user-management-table thead th {
    position: sticky; /* Rend l'en-tête collant */
    top: 0; /* Le colle en haut du conteneur scrollable */
    background-color: #f8f9fa; /* Couleur de fond pour masquer le contenu qui défile dessous */
    z-index: 10; /* S'assure que l'en-tête est au-dessus du contenu */
    border-bottom: 2px solid #dee2e6;
}

#user-management-table th,
#user-management-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

#user-management-table th {
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#user-management-table tbody tr:last-child td {
    border-bottom: none;
}

#user-management-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Colonne des actions */
#user-management-table .actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Style pour les boutons d'icône (Modifier, Activer/Désactiver) */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.btn-icon:hover {
    background-color: #e9ecef;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    stroke: #6c757d;
    transition: stroke 0.2s ease;
}

.btn-icon:hover svg {
    stroke: #1976d2;
}

/* Style spécifique pour l'icône de désactivation */
.btn-icon svg.deactivated {
    stroke: #f44336;
}
.btn-icon:hover svg.deactivated {
    stroke: #d32f2f;
}


/* Loader pour le tableau */
#user-management-loader {
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

/* ==============================================================================
   --- MODALE DU FORMULAIRE UTILISATEUR ---
   ============================================================================== */

/* MODIFIÉ : Le sélecteur est maintenant une classe */
.user-modal-style .modal-content {
    width: 100%;
    max-width: 500px;
}

/* MODIFIÉ : Le sélecteur est maintenant une classe */
.user-modal-style h2 {
    margin-bottom: 24px;
    font-size: 22px;
    color: #2c3e50;
}

#user-form .form-group {
    margin-bottom: 20px;
}

#user-form .form-group label {
    display: block;
    margin-bottom: 8px;
    color: #495057;
    font-weight: 500;
    font-size: 14px;
}

#user-form input[type="email"],
#user-form input[type="password"],
#user-form select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#user-form input:focus,
#user-form select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* NOUVEAU : Style pour les textarea dans les modales */
.modal-content textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: vertical; /* Permet le redimensionnement vertical uniquement */
}

.modal-content textarea:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}


/* NOUVEAUX STYLES pour l'icône du mot de passe */
.password-wrapper {
    position: relative;
}

.toggle-password-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: #6c757d;
    display: flex;
    align-items: center;
}

.toggle-password-icon:hover svg {
    stroke: #343a40;
}

/* CORRECTION : Rendre ce sélecteur plus général pour toutes les modales */
.modal-content .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* MODIFIÉ : Le sélecteur est maintenant une classe */
.user-modal-style .form-actions .btn {
    flex: none; /* Empêche les boutons de s'étirer */
    min-width: 100px;
}

/* Modal Styles */
.modal {
    display: none; /* MODIFIÉ : Assurez-vous que c'est la seule propriété 'display' ici */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    /* La propriété 'display: flex' a été déplacée dans la classe .visible ci-dessous */
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

/* NOUVELLE CLASSE pour afficher la modale via JS */
.modal.visible {
    display: flex;
}

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    color: #888;
}

.close-btn:hover {
    color: #333;
}

.modal-title {
    margin-top: 0;
    font-size: 1.25em;
}

.modal-body {
    white-space: pre-wrap; /* preserve newlines */
}

/* --- Styles pour la validation du mot de passe en temps réel --- */
.password-rules-container {
    font-size: 0.8em;
    margin-top: 8px;
    display: none; /* Caché par défaut, affiché par JS */
    flex-direction: column;
    gap: 4px;
}

.password-rule {
    margin: 0;
    transition: color 0.3s ease;
    color: #d9534f; /* Rouge par défaut (invalide) */
    display: flex;
    align-items: center;
}

.password-rule::before {
    content: '✕'; /* Croix par défaut */
    margin-right: 8px;
    font-weight: bold;
}

.password-rule.valid {
    color: #5cb85c; /* Vert si la règle est validée */
}

.password-rule.valid::before {
    content: '✓'; /* Coche si valide */
}

#password-input.invalid {
    border-color: #d9534f;
    box-shadow: 0 0 0 2px rgba(217, 83, 79, 0.2);
}

/* --- Barre de filtres pour la gestion des utilisateurs --- */
.user-filter-controls {
    display: flex;
    gap: 16px;
    align-items: flex-end; /* Aligne les filtres et le bouton sur leur ligne de base */
    padding: 16px;
    margin-bottom: 24px;
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 15px;
}

/* Pousse le bouton "Ajouter" complètement à droite */
.user-filter-controls .btn-primary {
    margin-left: auto;
    flex: 0 0 auto;
}

/* AJOUT : Style pour les inputs texte dans les barres de filtre */
.user-filter-controls input[type="text"] {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    background-color: #fff;
    font-size: 14px;
    min-width: 220px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 4px;
}

.filter-group select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    background-color: #fff;
    font-size: 14px;
    min-width: 180px;
}

/* ==============================================================================
   --- SECTION GESTION DES GROUPES ---
   ============================================================================== */

.group-management-page {
    display: none;
    animation: fadeIn 0.5s ease-out;
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

.modal-content.large {
    max-width: 950px; /* Modale plus large pour les groupes */
}

.form-columns {
    display: flex;
    gap: 24px;
    margin-top: 20px;
}

.form-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-column h4 {
    font-size: 16px;
    font-weight: 600;
    color: #344054;
    margin-bottom: 12px;
    border-bottom: 1px solid #eaecf0;
    padding-bottom: 8px;
}

.multi-select-list {
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    height: 280px;
    overflow-y: auto;
    padding: 8px;
    background-color: #f9fafb;
}

.multi-select-list .item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.multi-select-list .item:hover {
    background-color: #f0f2f5;
}

.multi-select-list .item input[type="checkbox"] {
    margin-right: 12px;
    width: 16px;
    height: 16px;
    accent-color: #1976d2;
}

.multi-select-list .item label {
    font-weight: 500;
    color: #344054;
    flex-grow: 1;
    cursor: pointer;
}

/* NOUVEAUX STYLES POUR LE TABLEAU DES GROUPES */
#group-management-table {
    width: 100%;
    border-collapse: collapse;
}

/* En-tête de la page (Titre + Bouton Ajouter) */
.group-management-page .page-header {
    display: flex;
    flex-direction: column; /* MODIFIÉ : Aligne les éléments verticalement */
    align-items: flex-start; /* MODIFIÉ : Aligne les éléments à gauche */
    margin-bottom: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e5e9;
}
.group-management-page .page-header h2 {
    font-size: 28px; /* MODIFIÉ : Identique au titre admin */
    font-weight: 700; /* MODIFIÉ : Identique au titre admin */
    color: #1f2937; /* MODIFIÉ : Identique au titre admin */
    letter-spacing: -0.5px; /* MODIFIÉ : Identique au titre admin */
    margin-bottom: 16px; /* AJOUT : Espace entre le titre et le bouton */
}
.group-management-page .hint {
    font-size: 15px;
    color: #6b7280; /* Un gris moyen pour être moins proéminent */
    margin-bottom: 24px; /* Plus d'espace avant le tableau */
    font-style: italic;
}
/* Conteneur du tableau */
.group-management-page .table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: auto; /* Pour que le radius s'applique aux coins du tableau */
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    position: relative;
    max-height: calc(100vh - 250px);
}

#group-management-table thead th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    border-bottom: 2px solid #dee2e6;
}

#group-management-table th,
#group-management-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

#group-management-table th {
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#group-management-table tbody tr:last-child td {
    border-bottom: none;
}

#group-management-table tbody tr:hover {
    background-color: #f8f9fa;
}

#group-management-table .actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

#group-management-table .count-badge {
    display: inline-block;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    color: #fff;
    margin: 0 2px;
}

#group-management-table .user-count {
    background-color: #0d6efd;
}

#group-management-table .tool-count {
    background-color: #6c757d;
}

/* ==============================================================================
   --- SECTION JOURNAL D'AUDIT ---
   ============================================================================== */

/* NOUVEAU : Conteneur de la page */
.audit-log-page {
    display: none;
    animation: fadeIn 0.5s ease-out;
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

/* NOUVEAU : En-tête de la page */
.audit-log-page .page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e5e9;
}
.audit-log-page .page-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.audit-log-page .hint {
    font-size: 15px;
    color: #6b7280;
    font-style: italic;
}

/* NOUVEAU : Conteneur du tableau */
.audit-log-page .table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    position: relative;
    max-height: calc(100vh - 280px); /* Ajustement de la hauteur */
}

/* NOUVEAU : Styles de base du tableau d'audit */
#audit-log-table {
    width: 100%;
    border-collapse: collapse;
}

#audit-log-table thead th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    border-bottom: 2px solid #dee2e6;
}

#audit-log-table th,
#audit-log-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
    border-right: 1px solid #f0f2f5;
}

#audit-log-table th {
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#audit-log-table tbody tr:last-child td {
    border-bottom: none;
}

#audit-log-table tbody tr:hover {
    background-color: #f8f9fa;
}

.audit-log-page .filter-group input[type="text"] {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    background-color: #fff;
    font-size: 14px;
    min-width: 220px;
}

#audit-log-table .action-tag {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    background-color: #e9ecef;
    color: #495057;
    font-family: 'Courier New', Courier, monospace;
}

#audit-log-table .details-cell pre {
    margin: 0;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 150px;
    overflow-y: auto;
}


/* ==============================================================================
   --- STYLES POUR LA BARRE DE DÉFILEMENT PERSONNALISÉE ---
   ============================================================================== */

/* Cible les barres de défilement dans les conteneurs de tableau de la page admin */
.table-wrap::-webkit-scrollbar,
#top-scrollbar-container::-webkit-scrollbar {
    height: 14px; /* Hauteur de la barre de défilement horizontale */
}

/* Style de la "piste" (le fond de la barre) */
.table-wrap::-webkit-scrollbar-track,
#top-scrollbar-container::-webkit-scrollbar-track {
    background: #e9ecef; /* Couleur de fond de la piste */
    border-radius: 10px;
    border: 6px solid #e9ecef;
}

/* Style du "pouce" (la partie mobile et cliquable) */
.table-wrap::-webkit-scrollbar-thumb,
#top-scrollbar-container::-webkit-scrollbar-thumb {
    background-color: #adb5bd; /* Couleur du pouce */
    border-radius: 10px;
    border: 3px solid #e9ecef; /* Crée un effet de padding autour du pouce */
}

/* Style du pouce au survol de la souris */
.table-wrap::-webkit-scrollbar-thumb:hover,
#top-scrollbar-container::-webkit-scrollbar-thumb:hover {
    background-color: #6c757d; /* Couleur plus foncée au survol */
}
/* === Header "Tout sélectionner" réutilisable (utilisateur + groupe) === */
.user-modal-style .multi-select-header,
.group-modal-style .multi-select-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    position: sticky; 
    top: 0;
    z-index: 5;
    box-shadow: 0 1px 0 rgba(16,24,40,0.04);
}
.user-modal-style .multi-select-header:focus-within,
.group-modal-style .multi-select-header:focus-within {
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25,118,210,0.12);
}

/* === Checkbox maître (les deux modales) === */
#user-groups-select-all,
#group-tools-select-all {
    width: 18px;
    height: 18px;
    accent-color: #1976d2;
    cursor: pointer;
    flex-shrink: 0;
}

/* État indéterminé (partiel) — utile quand certaines cases sont cochées */
#user-groups-select-all:indeterminate,
#group-tools-select-all:indeterminate {
    accent-color: #f59e0b; /* orange quand partiel */
}

/* Libellés cliquables */
#user-groups-select-all-label,
#group-tools-select-all-label {
    cursor: pointer;
    font-weight: 600;
    color: #344054;
    font-size: 14px;
    user-select: none;
}

/* Harmonisation des cases internes des listes */
.user-modal-style .multi-select-list .item input[type="checkbox"],
.group-modal-style .multi-select-list .item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #1976d2;
}

/* (optionnel) petits écrans */
@media (max-width: 420px) {
    .user-modal-style .multi-select-header,
    .group-modal-style .multi-select-header {
        padding: 8px 10px;
        gap: 8px;
    }
    #user-groups-select-all-label,
    #group-tools-select-all-label { font-size: 13px; }
}


/* ========== FIX OVERLAP COLONNES GELÉES ========== */

/* Optionnel : variable pour éviter de répéter 180px */
:root {
  --col-group-w: 180px;      /* = .col-group width */
}

/* Largeurs inchangées, mais en variable */
.col-group { width: var(--col-group-w); min-width: var(--col-group-w); }
.col-user  { width: 220px; min-width: 220px; }

/* Tous les th “normaux” (déjà sticky top) restent en couche 2 */
#permissions-table th { z-index: 2; }

/* th gelé 1 (GROUPE) : au-dessus des th normaux */
th.frozen {
  position: sticky;
  left: 0;
  z-index: 3;                 /* > 2 */
  background: #f9fafb;        /* masque ce qui défile dessous */
  box-shadow: 2px 0 5px rgba(0,0,0,.05);
}

/* th gelé 2 (UTILISATEUR) : au-dessus de tout le reste */
th.frozen-2 {
  position: sticky;
  left: var(--col-group-w);   /* 180px chez toi */
  z-index: 4;                 /* > th.frozen (3) et > autres th (2) */
  background: #f9fafb;
  box-shadow: 2px 0 5px rgba(0,0,0,.06);
}

/* td gelés (lignes) doivent rester sous les th → couche 1 */
td.frozen,
td.frozen-2 {
  position: sticky;
  left: 0;
  z-index: 1;                 /* < th (2/3/4) pour éviter de recouvrir les headers */
  background: #fff;           /* ou la couleur de ligne si tu en as */
  box-shadow: 2px 0 5px rgba(0,0,0,.04);
}
td.frozen-2 { left: var(--col-group-w); }

/* Astuce bordure : le trait vertical du header UTILISATEUR doit rester visible */
th.frozen, th.frozen-2 { border-right: 1px solid #dde1e6; }

/* === FIX: colonnes GELÉES qui se font recouvrir === */

/* 1) Source de vérité pour la largeur de GROUPE */
:root { --col-group-w: 180px; }            /* = .col-group */

/* 2) Largeurs (inchangées) */
.col-group { width: var(--col-group-w); min-width: var(--col-group-w); }
.col-user  { width: 220px; min-width: 220px; }

/* 3) Tous les th normaux (déjà sticky top) => couche 2 */
#permissions-table th {
  z-index: 2 !important;
  background: #f9fafb; /* masque le contenu qui passe dessous */
}

/* 4) th gelé 1 (GROUPE) — au-dessus des th normaux */
#permissions-table thead th.frozen {
  position: sticky;
  left: 0;
  z-index: 3 !important;
  background: #f9fafb;
  box-shadow: 2px 0 5px rgba(0,0,0,.05);
  border-right: 1px solid #dde1e6;
}

/* 5) th gelé 2 (UTILISATEUR) — top de la pile */
#permissions-table thead th.frozen-2 {
  position: sticky;
  left: var(--col-group-w); /* évite l’overlap + tient compte de la vraie largeur */
  z-index: 4 !important;
  background: #f9fafb;
  box-shadow: 2px 0 5px rgba(0,0,0,.06);
  border-right: 1px solid #dde1e6;
}

/* 6) td gelés (lignes) — en-dessous des th */
#permissions-table td.frozen,
#permissions-table td.frozen-2 {
  position: sticky;
  left: 0;
  z-index: 1 !important;         /* < th (2/3/4) */
  background: #fff;
  box-shadow: 2px 0 5px rgba(0,0,0,.04);
}
#permissions-table td.frozen-2 { left: var(--col-group-w); }

/* 7) (petit détail) empêche un pixel qui “mord” : pas de bordure droite côté table */
#permissions-table th:last-child { border-right: none; }

/* ==============================================================================
   SECTION GESTION DES OUTILS
   ============================================================================== */

.tool-management-page {
    display: none;
    animation: fadeIn 0.5s ease-out;
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

.tool-management-page .page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e5e9;
}

.tool-management-page .page-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.tool-management-page .hint {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 24px;
    font-style: italic;
}

.tool-management-page .table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    position: relative;
    max-height: calc(100vh - 250px);
}

#tool-management-table {
    width: 100%;
    border-collapse: collapse;
}

#tool-management-table thead th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    border-bottom: 2px solid #dee2e6;
}

#tool-management-table th,
#tool-management-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

#tool-management-table th {
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tool-management-table tbody tr:last-child td {
    border-bottom: none;
}

#tool-management-table tbody tr:hover {
    background-color: #f8f9fa;
}

#tool-management-table .actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: white;
    margin: 2px;
}

/* ==============================================================================
   TOGGLE SWITCH STYLES
   ============================================================================== */

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:focus + .slider {
    box-shadow: 0 0 1px #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-label input[type="checkbox"] + span {
    position: relative;
    padding-left: 60px;
}

.toggle-label input[type="checkbox"] + span:before {
    content: '';
    display: inline-block;
    width: 48px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    transition: background-color 0.3s;
}

.toggle-label input[type="checkbox"] + span:after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: white;
    border-radius: 50%;
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

.toggle-label input[type="checkbox"]:checked + span:before {
    background-color: #4CAF50;
}

.toggle-label input[type="checkbox"]:checked + span:after {
    transform: translateY(-50%) translateX(24px);
}

/* ==============================================================================
   MODALE MODERNE POUR GESTION DES GROUPES UNIQUEMENT
   ============================================================================== */

.group-modal-style {
    display: none;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.group-modal-style.visible {
    display: flex;
}

.group-modal-content {
    max-width: 1200px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: groupSlideDown 0.3s ease-out;
}

@keyframes groupSlideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.group-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
}

.group-modal-header h2 {
    color: white;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.group-modal-header .close-btn {
    color: white;
    font-size: 32px;
    opacity: 0.8;
    transition: opacity 0.2s;
    cursor: pointer;
    line-height: 1;
    margin-left: 16px;
    flex-shrink: 0;
}

.group-modal-header .close-btn:hover {
    opacity: 1;
}

.group-form-sections {
    padding: 32px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.group-form-section {
    background: #f9fafb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
}

.group-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.group-section-header svg {
    color: #43cea2;
}

.group-section-header h4 {
    color: #1f2937;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.group-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.group-form-group {
    display: flex;
    flex-direction: column;
}

.group-form-group.full-width {
    grid-column: 1 / -1;
}

.group-form-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.group-label-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.group-required {
    color: #ef4444;
    font-weight: 600;
}

.group-form-group input,
.group-form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background-color: white;
}

.group-form-group input:focus,
.group-form-group textarea:focus {
    outline: none;
    border-color: #43cea2;
    box-shadow: 0 0 0 3px rgba(67, 206, 162, 0.1);
}

.group-form-group input::placeholder,
.group-form-group textarea::placeholder {
    color: #9ca3af;
}

.group-form-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.group-members-container,
.group-tools-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.group-members-list,
.group-tools-list {
    max-height: 280px;
    overflow-y: auto;
}

.group-members-list .item,
.group-tools-list .item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.group-members-list .item:hover,
.group-tools-list .item:hover {
    background-color: #f3f4f6;
}

.group-members-list .item input[type="checkbox"],
.group-tools-list .item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #43cea2;
}

.group-members-list .item label,
.group-tools-list .item label {
    cursor: pointer;
    flex: 1;
    font-size: 14px;
}

.group-tools-header {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.group-select-all-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.group-select-all-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #43cea2;
}

.group-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 32px;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.group-btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.group-btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.group-btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(67, 206, 162, 0.3);
}

.group-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(67, 206, 162, 0.4);
}

.group-btn-primary svg,
.group-btn-secondary svg {
    width: 16px;
    height: 16px;
}

/* ==============================================================================
   MODALE MODERNE POUR GESTION DES OUTILS UNIQUEMENT
   ============================================================================== */

.tool-modal-style {
    display: none;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.tool-modal-style.visible {
    display: flex;
}

.tool-modal-content {
    max-width: 1000px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: toolSlideDown 0.3s ease-out;
}

@keyframes toolSlideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.tool-modal-header h2 {
    color: white;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.tool-modal-header .close-btn {
    color: white;
    font-size: 32px;
    opacity: 0.8;
    transition: opacity 0.2s;
    cursor: pointer;
    line-height: 1;
    margin-left: 16px;
    flex-shrink: 0;
}

.tool-modal-header .close-btn:hover {
    opacity: 1;
}

.tool-form-sections {
    padding: 32px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.tool-form-section {
    background: #f9fafb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
}

.tool-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.tool-section-header svg {
    color: #667eea;
}

.tool-section-header h4 {
    color: #1f2937;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.tool-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.tool-form-group {
    display: flex;
    flex-direction: column;
}

.tool-form-group.full-width {
    grid-column: 1 / -1;
}

.tool-form-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.tool-label-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.tool-required {
    color: #ef4444;
    font-weight: 600;
}

.tool-form-group input,
.tool-form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background-color: white;
}

.tool-form-group input:focus,
.tool-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tool-form-group input::placeholder,
.tool-form-group textarea::placeholder {
    color: #9ca3af;
}

.tool-form-row-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.tool-tags-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.tool-tags-list {
    max-height: 220px;
    overflow-y: auto;
}

.tool-tags-list .item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tool-tags-list .item:hover {
    background-color: #f3f4f6;
}

.tool-tags-list .item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #667eea;
}

.tool-tags-list .item label {
    cursor: pointer;
    flex: 1;
}

.tool-options-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}

.tool-option-item {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.tool-option-item:last-child {
    border-bottom: none;
}

.tool-modern-toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
}

.tool-modern-toggle input[type="checkbox"] {
    display: none;
}

.tool-toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background-color: #d1d5db;
    border-radius: 26px;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.tool-toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: white;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tool-modern-toggle input[type="checkbox"]:checked + .tool-toggle-switch {
    background-color: #667eea;
}

.tool-modern-toggle input[type="checkbox"]:checked + .tool-toggle-switch::after {
    transform: translateX(22px);
}

.tool-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tool-toggle-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.tool-toggle-desc {
    font-size: 12px;
    color: #6b7280;
}

.tool-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 32px;
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.tool-btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.tool-btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tool-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.tool-btn-primary svg,
.tool-btn-secondary svg {
    width: 16px;
    height: 16px;
}

/* Style spécifique pour les boutons "Ajouter" (outil, groupe, utilisateur, tag) */
#add-tool-btn,
#add-group-btn,
#add-user-btn,
#add-tag-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

#add-tool-btn:hover,
#add-group-btn:hover,
#add-user-btn:hover,
#add-tag-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #65398b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}
/* ==============================================================================
   --- SECTION GESTION DES TAGS ---
   ============================================================================== */

.tag-management-page {
    display: none;
    animation: fadeIn 0.5s ease-out;
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

.tag-management-page .page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e1e5e9;
}

.tag-management-page .page-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.tag-management-page .hint {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 24px;
    font-style: italic;
}

/* Conteneur du tableau */
.tag-management-page .table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    position: relative;
    max-height: calc(100vh - 250px);
}

/* Tableau des tags */
#tag-management-table {
    width: 100%;
    border-collapse: collapse;
}

#tag-management-table thead th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    border-bottom: 2px solid #dee2e6;
}

#tag-management-table th,
#tag-management-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

#tag-management-table th {
    background: #f8f9fa;
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tag-management-table tbody tr:last-child td {
    border-bottom: none;
}

#tag-management-table tbody tr:hover {
    background-color: #f8f9fa;
}

#tag-management-table .actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Badge de compteur */
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    font-weight: 600;
    font-size: 13px;
}

/* Style pour l'aperçu du tag dans le tableau */
#tag-management-table .tag-preview {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Style pour le bloc de couleur */
.color-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* ==============================================================================
   --- MODALE TAG (USER FRIENDLY) ---
   ============================================================================== */

.tag-modal-style {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.tag-modal-style.visible {
    display: flex;
}

.tag-modal-content {
    background-color: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: tagSlideDown 0.3s ease-out;
}

@keyframes tagSlideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tag-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px 32px;
    position: relative;
}

.tag-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.tag-modal-header .close-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.tag-modal-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tag-modal-body {
    padding: 32px;
}

.tag-form-group {
    margin-bottom: 24px;
}

.tag-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #344054;
    font-weight: 600;
    font-size: 14px;
}

.tag-form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
}

.tag-form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Groupe de sélection de couleur */
.color-picker-group {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.color-picker-visual {
    width: 80px;
    flex-shrink: 0;
}

.color-picker-visual input[type="color"] {
    width: 100%;
    height: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-picker-visual input[type="color"]:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.color-picker-input {
    flex: 1;
}

.color-hint {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
    font-style: italic;
}

/* Aperçu du tag */
.tag-preview-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    border: 2px dashed #dee2e6;
}

.tag-preview-label {
    display: block;
    margin-bottom: 12px;
    color: #6b7280;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#tag-preview {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 24px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

#tag-preview:hover {
    transform: scale(1.05);
}

/* Footer de la modale */
.tag-modal-footer {
    padding: 20px 32px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #e5e7eb;
}

.tag-btn-secondary {
    background: white;
    border: 2px solid #e5e7eb;
    color: #344054;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-btn-secondary:hover {
    background: #f8f9fa;
    border-color: #d1d5db;
}

.tag-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tag-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* ==============================================================================
   --- FIN SECTION GESTION DES TAGS ---
   ============================================================================== */