/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Page de Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #e74c3c;
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    position: relative;
}

.form-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.form-group input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.login-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.3);
}

.error-message {
    background: #fee;
    color: #c0392b;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    display: none;
}

/* Application principale */
.app-container {
    display: flex;
    min-height: 100vh;
    background: #f8f9fa;
}

/* Navigation */
.main-nav {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    width: 250px;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.nav-brand {
    padding: 0 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.nav-brand i {
    font-size: 2rem;
    color: #e74c3c;
    margin-right: 10px;
}

.nav-brand span {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 10px 120px 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    gap: 15px;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(231, 76, 60, 0.2);
    color: white;
    transform: translateX(5px);
}

.nav-link i {
    font-size: 1.2rem;
    width: 20px;
}

/* Sécurité : Masquer par défaut les onglets admin */
.nav-link[data-role="admin"],
.nav-dropdown[data-role="admin"] {
    display: none;
}

/* Afficher les onglets admin seulement si l'utilisateur est admin */
body.admin-user .nav-link[data-role="admin"],
body.admin-user .nav-dropdown[data-role="admin"] {
    display: flex;
}

/* Masquer les boutons et champs admin pour les utilisateurs non-admin */
body:not(.admin-user) [data-role="admin"] {
    display: none !important;
}

/* Désactiver les champs de formulaire pour les utilisateurs non-admin */
body:not(.admin-user) input[data-role="admin"],
body:not(.admin-user) textarea[data-role="admin"],
body:not(.admin-user) select[data-role="admin"] {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #e9ecef;
}

/* Styles pour les éléments en lecture seule */
.readonly-field {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    border-color: #e9ecef !important;
}

/* Styles pour le menu déroulant */
.nav-dropdown {
    position: relative;
    display: flex;
    flex-direction: column;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    gap: 15px;
    cursor: pointer;
    user-select: none;
}

.nav-dropdown-toggle:hover {
    background: rgba(231, 76, 60, 0.2);
    color: white;
    transform: translateX(5px);
}

.nav-dropdown-toggle.active {
    background: rgba(231, 76, 60, 0.3);
    color: white;
}

.nav-dropdown-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.nav-dropdown.open .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    display: none;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 10px 10px;
    margin: 0 10px;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: flex;
}

.nav-dropdown-link {
    display: flex;
    align-items: center;
    padding: 12px 20px 12px 40px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 12px;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.nav-dropdown-link:hover {
    background: rgba(231, 76, 60, 0.2);
    color: white;
    border-left-color: #e74c3c;
    transform: translateX(5px);
}

.nav-dropdown-link.active {
    background: rgba(231, 76, 60, 0.3);
    color: white;
    border-left-color: #e74c3c;
}

.nav-dropdown-link i {
    font-size: 1rem;
    width: 16px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-user {
    padding: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.15);
    position: fixed;
    bottom: 0;
    left: 0;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    width: 250px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.nav-user span {
    color: white;
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.logout-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Contenu principal */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    margin-left: 250px;
    min-height: 100vh;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    color: #2c3e50;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.page-header h1 i {
    color: #e74c3c;
}

.header-actions {
    display: flex;
    gap: 15px;
}

/* Cartes */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin-bottom: 15px;
}

/* Dashboard spécifique - layout plus compact */
.dashboard-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Contrats Entreprise et Informations sur l'Entreprise côte à côte */
.dashboard-content .card:nth-child(1) {
    grid-column: 1;
}

.dashboard-content .card:nth-child(2) {
    grid-column: 2;
}

/* Effectif et Dernières factures en dessous */
.dashboard-content .card:nth-child(3) {
    grid-column: 1;
}

.dashboard-content .card:nth-child(4) {
    grid-column: 2;
}

@media (max-width: 1200px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    
    .dashboard-content .card:nth-child(1),
    .dashboard-content .card:nth-child(2),
    .dashboard-content .card:nth-child(3),
    .dashboard-content .card:nth-child(4) {
        grid-column: 1;
    }
}

.card-header {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.card-content {
    padding: 16px;
}

/* Statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 200px);
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: white;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-content h3 {
    font-size: 1.6rem;
    color: #2c3e50;
    margin-bottom: 3px;
}

.stat-content p {
    color: #666;
    font-size: 0.85rem;
}

/* Boutons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.3);
}

/* Filtres */
.filters-section {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-group input,
.filter-group select {
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #3498db;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

tr:hover {
    background: #f8f9fa;
}

/* Modales */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 15px 15px 0 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.modal-content {
    padding: 30px;
}

/* Formulaires */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.form-group-modal {
    margin-bottom: 8px;
}

.form-group-modal label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
}

.form-group-modal input,
.form-group-modal select,
.form-group-modal textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.form-group-modal input:focus,
.form-group-modal select:focus,
.form-group-modal textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-group-modal textarea {
    resize: vertical;
    min-height: 100px;
}

/* Champs en lecture seule */
.form-group-modal input[readonly],
.form-group-modal select[disabled],
.form-group-modal textarea[readonly] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
    border-color: #ddd;
}

/* Recherche de client */
.client-search-wrapper {
    position: relative;
}

.client-search-wrapper #factureClientSearch {
    margin-bottom: 10px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><path d="m21 21-4.35-4.35"></path></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px 18px;
    padding-right: 40px;
}

.client-search-wrapper #factureClientSearch:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.client-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #3498db;
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: -10px;
}

.client-search-results::-webkit-scrollbar {
    width: 8px;
}

.client-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.client-search-results::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
}

.client-search-results::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

.client-search-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #ecf0f1;
    transition: all 0.2s ease;
}

.client-search-item:last-child {
    border-bottom: none;
}

.client-search-item:hover {
    background-color: #ecf0f1;
}

.client-search-item.selected {
    background-color: #3498db;
    color: white;
}

.client-search-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.client-search-item-details {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.client-search-item.selected .client-search-item-details {
    color: rgba(255, 255, 255, 0.9);
}

.client-search-no-results {
    padding: 15px;
    text-align: center;
    color: #95a5a6;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .main-nav {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-section {
        flex-direction: column;
    }
    
    .filter-group {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .main-nav {
        width: 60px;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .nav-brand span {
        display: none;
    }
    
    .nav-link {
        justify-content: center;
        padding: 15px 10px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .modal {
        width: 95%;
        margin: 10px;
    }
    
    .modal-content {
        padding: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page {
    animation: fadeIn 0.3s ease-out;
}

/* États de chargement */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #666;
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Messages de statut */
.status-message {
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Styles pour la création de facture */
.factures-view {
    animation: fadeIn 0.3s ease-out;
}

.form-section {
    margin-bottom: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #e74c3c;
}

.form-section h4 {
    color: #2c3e50;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h4 i {
    color: #e74c3c;
}

.services-table-container {
    overflow-x: auto;
    margin-bottom: 10px;
}

.services-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.services-table th {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.services-table td {
    padding: 8px 8px;
    border-bottom: 1px solid #e1e5e9;
}

.services-table tbody tr:hover {
    background: #f8f9fa;
}

.services-table input,
.services-table select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.services-table input:focus,
.services-table select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.services-table .btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.facture-totals {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #e1e5e9;
}

.total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e1e5e9;
}

.total-line:last-child {
    border-bottom: none;
}

.total-line.total-final {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2c3e50;
    background: #f8f9fa;
    margin: 8px -15px -15px -15px;
    padding: 12px 15px;
    border-radius: 0 0 8px 8px;
    border-top: 2px solid #e74c3c;
}

.total-line label {
    font-weight: 600;
    color: #2c3e50;
}

.total-line span {
    font-weight: 600;
    color: #27ae60;
}

.total-line input {
    width: 80px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: right;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e1e5e9;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
}

/* Badges de statut */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-en_attente {
    background: #fff3cd;
    color: #856404;
}

.status-payee {
    background: #d4edda;
    color: #155724;
}

.status-annulee {
    background: #f8d7da;
    color: #721c24;
}

/* Badges de type */
.type-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.type-particulier {
    background: #d1ecf1;
    color: #0c5460;
}

.type-entreprise {
    background: #e2e3e5;
    color: #383d41;
}

/* Animation pour les lignes de facture */
.facture-ligne {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Styles pour la gestion des utilisateurs */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

.confirm-delete {
    padding: 20px;
    text-align: center;
}

.confirm-delete p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.warning-text {
    color: #e74c3c;
    font-weight: 600;
    font-size: 0.9rem !important;
}

.form-group-modal small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

/* Carte du nombre de passages */
.nombre-passages-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 6px 10px;
    margin: 2px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.nombre-passages-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nombre-passages-content i {
    color: #6c757d;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nombre-passages-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nombre-passages-label {
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
}

.nombre-passages-number {
    color: #dc3545;
    font-size: 1.2rem;
    font-weight: bold;
    background: #fff5f5;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #fecaca;
}

.nombre-passages-description {
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 400px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification i {
    font-size: 1.5rem;
}

.notification-success {
    border-left: 4px solid #27ae60;
}

.notification-success i {
    color: #27ae60;
}

.notification-error {
    border-left: 4px solid #e74c3c;
}

.notification-error i {
    color: #e74c3c;
}

.notification-info {
    border-left: 4px solid #3498db;
}

.notification-info i {
    color: #3498db;
}

/* ==================== VUE FACTURE PROFESSIONNELLE ==================== */

/* Vue d'impression de facture */
.invoice-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f5f5;
    z-index: 9999;
    overflow-y: auto;
}

.invoice-actions {
    position: sticky;
    top: 0;
    background: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 10;
}

/* Document de facture */
.invoice-document {
    max-width: 21cm;
    margin: 30px auto;
    background: white;
    padding: 2cm;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    min-height: 29.7cm;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 3px solid #e74c3c;
}

.invoice-logo {
    flex: 1;
}

.invoice-logo h1 {
    color: #e74c3c;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.invoice-logo p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.6;
}

.invoice-number {
    text-align: right;
    flex: 1;
}

.invoice-number h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.invoice-number p {
    color: #666;
    font-size: 0.9rem;
}

.invoice-number .numero {
    font-weight: 700;
    color: #e74c3c;
    font-size: 1.2rem;
}

/* Informations client et facturation */
.invoice-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.invoice-client,
.invoice-info {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.invoice-client h3,
.invoice-info h3 {
    color: #333;
    font-size: 1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    font-weight: 700;
    border-bottom: 2px solid #e74c3c;
    padding-bottom: 8px;
}

.invoice-client p,
.invoice-info p {
    color: #555;
    line-height: 1.8;
    margin: 5px 0;
}

.invoice-client strong,
.invoice-info strong {
    color: #333;
    font-weight: 600;
}

/* Tableau des services */
.invoice-table {
    margin-bottom: 40px;
}

.invoice-table h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.invoice-table table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table thead {
    background: #e74c3c;
    color: white;
}

.invoice-table thead th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.invoice-table thead th:last-child,
.invoice-table thead th:nth-child(3),
.invoice-table thead th:nth-child(2) {
    text-align: right;
}

.invoice-table tbody td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    color: #555;
}

.invoice-table tbody td:last-child,
.invoice-table tbody td:nth-child(3),
.invoice-table tbody td:nth-child(2) {
    text-align: right;
    font-weight: 600;
}

.invoice-table tbody tr:last-child td {
    border-bottom: 2px solid #e74c3c;
}

/* Totaux */
.invoice-totals {
    margin-top: 30px;
    margin-left: auto;
    width: 300px;
}

.invoice-total-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.invoice-total-line.total-ht,
.invoice-total-line.total-tva,
.invoice-total-line.total-ttc {
    font-weight: 600;
}

.invoice-total-line.total-final {
    border-top: 3px solid #e74c3c;
    border-bottom: 3px solid #e74c3c;
    margin-top: 10px;
    padding: 15px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #e74c3c;
}

.invoice-total-line label {
    color: #333;
}

.invoice-total-line span {
    color: #555;
}

.invoice-total-line.total-final span {
    color: #e74c3c;
}

/* Remarques */
.invoice-remarks {
    margin-top: 40px;
    padding: 20px;
    background: #f9f9f9;
    border-left: 4px solid #e74c3c;
    border-radius: 8px;
}

.invoice-remarks h4 {
    color: #333;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.invoice-remarks p {
    color: #555;
    line-height: 1.6;
}

/* Pied de page */
.invoice-footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

.invoice-footer p {
    margin: 5px 0;
}

/* Styles d'impression */
@media print {
    body {
        background: white;
    }

    .no-print {
        display: none !important;
    }

    .invoice-view {
        position: static;
        background: white;
    }

    .invoice-document {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        page-break-after: always;
    }

    .invoice-actions {
        display: none;
    }
}

/* Responsivité */
@media (max-width: 768px) {
    .invoice-document {
        padding: 1cm;
        margin: 15px;
    }

    .invoice-header {
        flex-direction: column;
        gap: 20px;
    }

    .invoice-number {
        text-align: left;
    }

    .invoice-details {
        grid-template-columns: 1fr;
    }

    .invoice-totals {
        width: 100%;
    }

    .invoice-actions {
        flex-direction: column;
    }

    .invoice-actions .btn {
        width: 100%;
    }
}

/* Styles pour les types de clients et ajustements de prix */
.ajustement-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.ajustement-badge.reduction {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.ajustement-badge.augmentation {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.ajustement-badge.neutre {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.info-text {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #e8f4f8;
    border-left: 4px solid #3498db;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.info-text i {
    color: #3498db;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #7f8c8d;
    font-style: italic;
}

.form-hint i {
    color: #3498db;
    margin-right: 4px;
}

.full-width {
    grid-column: 1 / -1;
}

/* Amélioration du type-badge existant pour la cohérence */
.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Les couleurs sont maintenant définies dynamiquement via les attributs style
   mais on garde un style par défaut pour les anciens types */
.type-badge.type-particulier,
.type-badge.type-entreprise,
.type-badge.type-assurance,
.type-badge.type-vip,
.type-badge.type-occasionnel {
    color: white;
}

/* Table des prix par type de véhicule - Version simplifiée */
.prix-vehicule-table-simple {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.prix-vehicule-table-simple th,
.prix-vehicule-table-simple td {
    padding: 15px;
    text-align: left;
    border: 1px solid #e0e0e0;
}

.prix-vehicule-table-simple th {
    background-color: #2c3e50;
    color: white;
    font-weight: bold;
    font-size: 15px;
}

.prix-vehicule-table-simple tbody tr {
    transition: background-color 0.2s;
}

.prix-vehicule-table-simple tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.prix-vehicule-table-simple tbody tr:hover {
    background-color: #f5f5f5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.prix-vehicule-table-simple input[type="number"] {
    border-radius: 4px;
    transition: all 0.2s;
}

.prix-vehicule-table-simple input[type="number"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.prix-vehicule-table-simple input[type="number"]:read-only {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

/* Styles pour le menu déroulant de sélection */
#selectTypeVehicule {
    cursor: pointer;
    transition: all 0.2s;
}

#selectTypeVehicule:hover {
    border-color: #2980b9;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

#selectTypeVehicule:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* ==================== DRAG & DROP POUR SERVICES ==================== */

.draggable-service-row {
    transition: all 0.2s ease;
    background-color: white;
}

.draggable-service-row:hover {
    background-color: #f8f9fa;
}

.draggable-service-row[draggable="true"] {
    cursor: move;
    user-select: none;
}

.draggable-service-row:active {
    cursor: grabbing !important;
}

/* État pendant le drag */
.draggable-service-row.dragging {
    opacity: 0.5;
    background-color: #e3f2fd;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Indicateurs de drop */
.draggable-service-row.drag-over-top {
    border-top: 3px solid #2196f3;
    box-shadow: 0 -2px 8px rgba(33, 150, 243, 0.3);
}

.draggable-service-row.drag-over-bottom {
    border-bottom: 3px solid #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

/* Icône de grip */
.fa-grip-vertical {
    transition: color 0.2s ease;
}

.draggable-service-row:hover .fa-grip-vertical {
    color: #2196f3 !important;
}

/* Animation de réorganisation */
@keyframes reorder {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

.draggable-service-row.reordering {
    animation: reorder 0.3s ease;
}

/* Message d'aide */
.drag-drop-help {
    margin-bottom: 15px;
    padding: 12px;
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #1976d2;
}

.drag-drop-help i {
    font-size: 1.2rem;
}

/* Styles pour les groupes de catégories (modèles de véhicules) */
.category-group {
    margin-bottom: 30px;
}

.category-title {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px 10px 0 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.category-title i {
    font-size: 1.2rem;
}

.category-group .data-table {
    margin-top: 0;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #95a5a6;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #bdc3c7;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.empty-state .btn {
    margin-top: 10px;
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-primary {
    background-color: #667eea;
    color: white;
}

.badge-secondary {
    background-color: #95a5a6;
    color: white;
}

.badge-success {
    background-color: #2ecc71;
    color: white;
}

.badge-warning {
    background-color: #f39c12;
    color: white;
}

.badge-danger {
    background-color: #e74c3c;
    color: white;
}

/* ==================== GESTION DES ÉQUIPEMENTS ==================== */

.equipement-container {
    padding: 20px;
}

.equipement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.equipement-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.equipement-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.equipement-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.equipement-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.equipement-card:hover .equipement-image img {
    transform: scale(1.05);
}

.equipement-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.equipement-card:hover .equipement-overlay {
    opacity: 1;
}

.equipement-overlay .btn {
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.equipement-card:hover .equipement-overlay .btn {
    transform: translateY(0);
}

.equipement-content {
    padding: 25px;
}

.equipement-title {
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #e74c3c;
    padding-bottom: 10px;
}

.equipement-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.equipement-list,
.equipement-description {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #e74c3c;
}

.equipement-list h4,
.equipement-description h4 {
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.equipement-list h4 i,
.equipement-description h4 i {
    color: #e74c3c;
}

.equipement-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.equipement-list li {
    padding: 5px 0;
    color: #555;
    position: relative;
    padding-left: 20px;
}

.equipement-list li:before {
    content: "•";
    color: #e74c3c;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.equipement-description p {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

/* Formulaire d'équipement */
.equipement-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.equipement-form .form-group-modal {
    margin-bottom: 0;
}

.equipement-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* Responsive pour les équipements */
@media (max-width: 768px) {
    .equipement-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .equipement-content {
        padding: 20px;
    }
    
    .equipement-title {
        font-size: 1.2rem;
    }
    
    .equipement-overlay {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .equipement-container {
        padding: 10px;
    }
    
    .equipement-grid {
        gap: 15px;
    }
    
    .equipement-card {
        margin: 0 5px;
    }
    
    .equipement-content {
        padding: 15px;
    }
}

/* ==================== STYLES TAXES À L'ÉTAT ==================== */

/* Résumé des taxes */
.taxes-summary {
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.summary-item.highlight {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
}

.summary-item i {
    font-size: 1.5rem;
    opacity: 0.8;
}

.summary-item.highlight i {
    color: white;
}

.summary-item div {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 1.3rem;
    font-weight: bold;
}

/* Actions des taxes */
.taxes-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Détail des taxes */
.taxe-detail .info-section {
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.taxe-detail .info-section h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.taxe-detail .info-section p {
    color: #7f8c8d;
    margin: 0;
}

/* Confirmation de paiement */
.confirm-payment {
    text-align: center;
}

.payment-details {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.payment-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.payment-detail:last-child {
    border-bottom: none;
}

.payment-detail.highlight {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    margin: 0 -20px;
    padding: 15px 20px;
    border-radius: 10px;
    border: none;
}

.payment-detail .label {
    font-weight: 500;
}

.payment-detail .value {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Historique des taxes */
.historique-taxe-summary {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #e74c3c;
}

/* Badge pour les taxes */
.badge-taxe {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Responsive pour les taxes */
@media (max-width: 768px) {
    .summary-card {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }
    
    .summary-item {
        padding: 12px;
    }
    
    .summary-value {
        font-size: 1.1rem;
    }
    
    .taxes-actions {
        flex-direction: column;
    }
    
    .taxes-actions .btn {
        width: 100%;
    }
}

/* ==================== STYLES DASHBOARD ENTREPRISE ==================== */

/* Tableaux de données */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    font-size: 0.85rem;
}

/* Amélioration des boutons d'édition dans le dashboard */
.dashboard-content .data-table .btn-sm {
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dashboard-content .data-table .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.dashboard-content .data-table .btn-sm:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Boutons d'édition spécifiques */
.dashboard-content .data-table .btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.dashboard-content .data-table .btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
}

.dashboard-content .data-table .btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.dashboard-content .data-table .btn-danger:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
}

/* Amélioration de la colonne Actions */
.dashboard-content .data-table .actions {
    text-align: center;
    vertical-align: middle;
    padding: 8px 12px;
    white-space: nowrap;
}

.dashboard-content .data-table .actions .btn-sm {
    margin: 0 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Conteneurs de tableaux avec scroll pour le dashboard */
.table-container {
    overflow-x: auto;
}

/* Styles spécifiques pour les conteneurs de tableaux du dashboard */
#contratsTable.table-container,
#effectifTable.table-container {
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    contain: layout style;
}

/* Nouvelle structure pour les tableaux avec en-têtes fixes */
#contratsTable,
#effectifTable {
    position: relative;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    overflow: hidden;
}

/* En-têtes fixes séparés du scroll */
#contratsTable .table-header,
#effectifTable .table-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border-bottom: 2px solid #c0392b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Corps du tableau avec scroll */
#contratsTable .table-body,
#effectifTable .table-body {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: auto;
}

/* Styles pour la nouvelle structure de tableau */
.table-header {
    display: flex;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    border-bottom: 2px solid #c0392b;
}

.table-header .header-cell {
    padding: 12px 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-header .header-cell:last-child {
    border-right: none;
}

.table-body {
    background: white;
}

.table-body .table-row {
    display: flex;
    border-bottom: 1px solid #e1e5e9;
    transition: background-color 0.2s ease;
}

.table-body .table-row:hover {
    background: #f8f9fa;
}

.table-body .table-row:last-child {
    border-bottom: none;
}

.table-body .table-cell {
    padding: 12px 8px;
    flex: 1;
    border-right: 1px solid #e1e5e9;
    color: #555;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.table-body .table-cell:last-child {
    border-right: none;
}

/* Largeurs spécifiques pour les colonnes de l'effectif */
#effectifTable .header-cell:nth-child(1),
#effectifTable .table-cell:nth-child(1) {
    flex: 0 0 13%; /* Nom Prénom */
}

#effectifTable .header-cell:nth-child(2),
#effectifTable .table-cell:nth-child(2) {
    flex: 0 0 8%; /* Date entré */
}

#effectifTable .header-cell:nth-child(3),
#effectifTable .table-cell:nth-child(3) {
    flex: 0 0 8%; /* Rang */
}

#effectifTable .header-cell:nth-child(4),
#effectifTable .table-cell:nth-child(4) {
    flex: 0 0 5%; /* Casier */
}

#effectifTable .header-cell:nth-child(5),
#effectifTable .table-cell:nth-child(5) {
    flex: 0 0 38%; /* Texte Carte */
}

#effectifTable .header-cell:nth-child(6),
#effectifTable .table-cell:nth-child(6) {
    flex: 0 0 6%; /* Copier */
}

#effectifTable .header-cell:nth-child(7),
#effectifTable .table-cell:nth-child(7) {
    flex: 0 0 8%; /* Actions */
}

/* Styles pour les boutons dans les cellules */
.table-cell .btn-sm {
    margin: 0 2px;
    padding: 4px 8px;
    font-size: 0.75rem;
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-cell .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.table-cell .btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.table-cell .btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
}

.table-cell .btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.table-cell .btn-danger:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
}

.table-cell .btn-copy {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

.table-cell .btn-copy:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
}

/* Centrer le bouton copier dans sa colonne */
#effectifTable .table-cell:nth-child(6) {
    justify-content: center;
    text-align: center;
}

/* Centrer l'en-tête "Copier" */
#effectifTable .header-cell:nth-child(6) {
    text-align: center;
}

/* En-tête fixe pour les tableaux du dashboard - Solution optimisée */
#contratsTable .data-table thead th,
#effectifTable .data-table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    color: white !important;
    border-bottom: 2px solid #c0392b !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Forcer l'en-tête à rester fixe */
#contratsTable .data-table thead,
#effectifTable .data-table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Largeurs spécifiques pour éviter le décalage - Espacement réduit */
#effectifTable .data-table th:nth-child(1),
#effectifTable .data-table td:nth-child(1) {
    width: 20%; /* Nom Prénom - réduit */
}

#effectifTable .data-table th:nth-child(2),
#effectifTable .data-table td:nth-child(2) {
    width: 12%; /* Date entré - réduit */
}

#effectifTable .data-table th:nth-child(3),
#effectifTable .data-table td:nth-child(3) {
    width: 8%; /* Rang - réduit */
}

#effectifTable .data-table th:nth-child(4),
#effectifTable .data-table td:nth-child(4) {
    width: 8%; /* Casier - réduit */
}

#effectifTable .data-table th:nth-child(5),
#effectifTable .data-table td:nth-child(5) {
    width: 30%; /* Texte Carte - augmenté pour compenser */
}

#effectifTable .data-table th:nth-child(6),
#effectifTable .data-table td:nth-child(6) {
    width: 12%; /* Actions Texte - augmenté */
}

#effectifTable .data-table th:nth-child(7),
#effectifTable .data-table td:nth-child(7) {
    width: 10%; /* Actions - augmenté */
}

/* Réduction du padding pour les colonnes compactes */
#effectifTable .data-table th:nth-child(1),
#effectifTable .data-table td:nth-child(1),
#effectifTable .data-table th:nth-child(2),
#effectifTable .data-table td:nth-child(2),
#effectifTable .data-table th:nth-child(3),
#effectifTable .data-table td:nth-child(3),
#effectifTable .data-table th:nth-child(4),
#effectifTable .data-table td:nth-child(4) {
    padding: 8px 4px; /* Padding réduit pour ces colonnes */
}

/* Conteneur avec isolation pour éviter les conflits */
#contratsTable,
#effectifTable {
    position: relative;
    isolation: isolate;
    contain: layout style;
}

/* S'assurer que l'en-tête n'est pas compté dans le scroll */
#contratsTable .data-table,
#effectifTable .data-table {
    position: relative;
    z-index: 1;
}

/* Table avec contexte de stacking propre */
#contratsTable .data-table,
#effectifTable .data-table {
    position: relative;
    z-index: 1;
    table-layout: fixed;
    width: 100%;
}

/* Règle supplémentaire pour garantir la fixité des en-têtes */
#effectifTable .data-table thead tr th {
    position: sticky !important;
    top: 0 !important;
    z-index: 1001 !important;
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
    color: white !important;
    border-bottom: 2px solid #c0392b !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Fallback pour les navigateurs qui ne supportent pas sticky */
@supports not (position: sticky) {
    #effectifTable .data-table thead tr th {
        position: fixed !important;
        top: 0 !important;
    }
}

/* Amélioration de la performance pour les en-têtes fixes */
#effectifTable .data-table thead {
    contain: layout style paint;
    will-change: transform;
}

/* Styles de scroll personnalisés pour les tableaux du dashboard */
#contratsTable::-webkit-scrollbar,
#effectifTable::-webkit-scrollbar {
    width: 8px;
}

#contratsTable::-webkit-scrollbar-track,
#effectifTable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#contratsTable::-webkit-scrollbar-thumb,
#effectifTable::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#contratsTable::-webkit-scrollbar-thumb:hover,
#effectifTable::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.data-table th {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e1e5e9;
    color: #555;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Boutons d'action dans les tableaux */
.data-table .btn-sm {
    padding: 6px 10px;
    font-size: 0.8rem;
    margin-right: 5px;
    position: relative;
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s ease;
}

.data-table .btn-sm:last-child {
    margin-right: 0;
}

.data-table .btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table .btn-sm:active {
    transform: translateY(0);
}

/* S'assurer que les boutons d'action sont toujours visibles */
.data-table td {
    position: relative;
}

.data-table .actions {
    white-space: nowrap;
    min-width: 120px;
}

/* Messages d'état vide */
.no-data {
    text-align: center;
    padding: 20px;
    color: #95a5a6;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.85rem;
}

/* En-têtes de cartes avec boutons */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.card-header h3 {
    margin: 0;
    font-size: 1rem;
}

/* Formulaires dans les cartes */
.card .form-grid {
    margin-top: 0;
}

.card .form-group-modal {
    margin-bottom: 15px;
}

.card .form-group-modal label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    display: block;
}

.card .form-group-modal input,
.card .form-group-modal textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.card .form-group-modal input:focus,
.card .form-group-modal textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.card .form-group-modal textarea {
    resize: vertical;
    min-height: 80px;
}

/* Responsive pour le dashboard */
@media (max-width: 768px) {
    .dashboard-content {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
    
    .data-table .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }
    
    .data-table .btn-sm {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
    
    .card .form-group-modal input,
    .card .form-group-modal textarea {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
}

/* Styles pour les boutons de copie */
.btn-copy {
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-copy:hover {
    background-color: #138496;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-copy:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-copy i {
    font-size: 0.75rem;
}

/* Animation pour le bouton de copie */
.btn-copy.copied {
    background-color: #28a745;
    animation: copySuccess 0.6s ease;
}

@keyframes copySuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}