/** Base styles */
body {
    background: url('https://www.transparenttextures.com/patterns/white-diamond.png') repeat;
    background-size: 200px 200px;
    font-family: 'Roboto', sans-serif;
    color: #2c3e50;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

body.dark-mode {
    background: url('https://www.transparenttextures.com/patterns/dark-mosaic.png') repeat;
    background-size: 200px 200px;
    color: #e0e0e0;
}

/* Loading Overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#loadingOverlay .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    border: 0.2em solid;
    border-right-color: transparent;
    border-color:linear-gradient(45deg, #1e40af, #3b82f6);
    animation: spin 1s linear infinite;
}

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

/* Toast Styles */
.toast-container { z-index: 1555; }
.toast { min-width: 260px; border: none; box-shadow: 0 3px 6px rgba(0,0,0,0.2); animation: fadeIn 0.3s ease-in; }
.toast-header { background-color: rgba(0,0,0,0.1); color: white; font-size: 0.7rem; }
.toast-body { font-size: 0.8rem; }
.bg-success { background-color: #28a745 !important; }
.bg-danger { background-color: #dc3545 !important; }
.bg-warning { background-color: #f28c38 !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Navbar */
.custom-navbar {
     background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    position: fixed;
    top: 10px;
    width: 95%;
    max-width: 1200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    transition: all 0.3s ease;
}

.custom-navbar.dark-mode {
    background: linear-gradient(90deg, #1a2a6c, #4a4a8c);
}

.custom-navbar .brand {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.emk-red {
    font-family: 'Poppins', sans-serif;
    color: #dc3545; /* Rouge pour E.M.K */
    font-weight: bold;
   
}

#logo-img {
    height: 40px;
    width: auto;
    margin-right: 10px;
    display: block;
    border-radius: 12px;
}

body.dark-mode #logo-img {
    content: url('img/logo_sombre.png');
    border-radius: 12px;
}

body:not(.dark-mode) #logo-img {
    content: url('img/logo_clair.png');
    border-radius: 12px;
}

.custom-navbar .dropdown-btn {
    font-size: 0.9rem;
    color: #fff;
    padding: 5px 12px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.custom-navbar .dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.custom-navbar .dropdown-content {
    min-width: 160px;
    border-radius: 6px;
    background: #fefefe;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
    animation: slideDown 0.3s ease-out;
}

.custom-navbar .dropdown-content a {
    padding: 6px 12px;
    font-size: 0.8rem;
    color: #2c3e50;
    transition: all 0.2s ease;
}

.custom-navbar .dropdown-content a.no-underline {
    text-decoration: none;
}

.custom-navbar .dropdown-content a:hover {
    background: linear-gradient(45deg, #1e40af, #3b82f6);
    color: #fff;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Container */
.container {
    max-width: 1400px;
    margin: 70px auto 10px;
    padding: 10px;
}

/* Content */
#content {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    animation: fadeIn 0.5s ease-in;
}

.dark-mode #content {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.97), rgba(44, 62, 80, 0.95));
}

/* Headings */
h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem; /* Taille réduite */
    font-weight: 700; /* Gras */
    text-transform: uppercase; /* Majuscules */
    color: #1e40af;
    animation: slideInLeft 0.5s ease-out;
}

.dark-mode h1 {
    color: #60a5fa;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Filter Menu */
#filterMenuContainer .dropdown-menu {
    min-width: 240px;
    padding: 6px;
    background: #fefefe;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transform: translateY(0);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: slideDown 0.3s ease-out;
}

#filterMenuContainer .dropdown-menu.show {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

#filterMenuContainer .form-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 2px;
}

#filterMenuContainer .form-control,
#filterMenuContainer .form-select {
    font-size: 0.65rem;
    padding: 3px 5px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    transition: all 0.3s ease;
}

#filterMenuContainer .form-control:focus,
#filterMenuContainer .form-select:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.2);
    transform: scale(1.02);
}

#filterMenuContainer .btn-filter {
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 4px;
    margin-right: 5px;
    border: none;
    transition: all 0.2s ease;
}

#filterMenuContainer .btn-apply-filters {
    background: #10b981;
    color: #fff;
}

#filterMenuContainer .btn-apply-filters:hover {
    background: #059669;
    transform: scale(1.05);
}

#filterMenuContainer .btn-reset-filters {
    background: #ef4444;
    color: #fff;
}

#filterMenuContainer .btn-reset-filters:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Table Container */
#tableContainer {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 450px;
    max-width: 100%;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #1e40af #f1f5f9;
    border-radius: 6px;
}

#tableContainer::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

#tableContainer::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}

#tableContainer::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #1e40af, #3b82f6);
    border-radius: 8px;
}

#tableContainer::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #10b981, #34d399);
}

/* Table */
.excel-table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    border-radius: 6px;
    animation: fadeIn 0.5s ease-in;
}

.dark-mode .excel-table {
    background: linear-gradient(135deg, #2b2b2b, #3a3a3a);
}

.excel-table th {
    background: linear-gradient(45deg, #1e40af, #3b82f6);
    color: #fff;
    font-weight: 600;
    font-size: 0.6rem;
    padding: 6px;
    text-align: center;
    border-bottom: 1px solid #10b981;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dark-mode .excel-table th {
    background: linear-gradient(45deg, #1a2a6c, #4a4a8c);
}

.excel-table td {
    background: #f9fafc;
    color: #2c3e50;
    font-size: 0.6rem;
    padding: 5px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s ease;
}

.dark-mode .excel-table td {
    background: #4a4a4a;
    color: #e0e0e0;
}

.excel-table tr:hover {
    background: #f1f5f9;
    transform: scale(1.01);
}

.dark-mode .excel-table tr:hover {
    background: #5a5a5a;
}

/* Status Dot */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 auto;
}

.status-dot.connected {
    background-color: #10b981;
}

.status-dot.disconnected {
    background-color: #ef4444;
}

/* Password Toggle Button */
.btn-toggle-password {
    background: transparent;
    color: #2c3e50;
    border: none;
    padding: 0;
    margin-left: 5px;
}

.dark-mode .btn-toggle-password {
    color: #e0e0e0;
}

.btn-toggle-password:hover {
    color: #1e40af;
    transform: scale(1.1);
}

.dark-mode .btn-toggle-password:hover {
    color: #60a5fa;
}

/* Buttons */
.btn {
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: scale(1.05);
}

.btn-sm {
    padding: 2px 5px;
    font-size: 0.55rem;
}

.btn-save { 
    background: #dc3545; /* Rouge pour le bouton Filtres */
    color: #fff; 
}
.btn-save:hover { 
    background: #c82333; 
}

.btn-cancel { 
    background: #6b7280; 
    color: #fff; 
}
.btn-cancel:hover { 
    background: linear-gradient(45deg, #4b5563, #6b7280); 
}

.btn-edit { 
    background: #3b82f6; 
    color: #fff; 
}
.btn-edit:hover { 
    background: linear-gradient(45deg, #1e40af, #3b82f6); 
}

.btn-delete { 
    background: #ef4444; 
    color: #fff; 
}
.btn-delete:hover { 
    background: linear-gradient(45deg, #dc2626, #ef4444); 
}

.btn-print { 
    background: #f59e0b; 
    color: #fff; 
}
.btn-print:hover { 
    background: linear-gradient(45deg, #d97706, #f59e0b); 
}

.btn-export { 
    background: #8b5cf6; 
    color: #fff; 
}
.btn-export:hover { 
    background: linear-gradient(45deg, #7c3aed, #8b5cf6); 
}

/* Custom button colors for action-buttons */
.btn-add-user { 
    background: #007bff; 
    color: #fff; 
}
.btn-add-user:hover { 
    background: linear-gradient(45deg, #0056b3, #007bff); 
}

.btn-add-bureau { 
    background: #22c55e;
    color: #fff; 
}
.btn-add-bureau:hover { 
    background: linear-gradient(45deg, #16a34a, #22c55e);
}

.btn-add-frais { 
    background: #fd7e14;
    color: #fff; 
}
.btn-add-frais:hover { 
    background: linear-gradient(45deg, #e06c12, #fd7e14);
}

.btn-add-taux { 
    background: #6f42c1;
    color: #fff; 
}
.btn-add-taux:hover { 
    background: linear-gradient(45deg, #5a32a3, #6f42c1);
}

.btn-add-transporteur { 
    background: #17a2b8;
    color: #fff; 
}
.btn-add-transporteur:hover { 
    background: linear-gradient(45deg, #138496, #17a2b8);
}

.btn-add-session { 
    background: #6c757d;
    color: #fff; 
}
.btn-add-session:hover { 
    background: linear-gradient(45deg, #5a6268, #6c757d);
}

.btn-add-devises { 
    background: #8b5cf6;
    color: #fff; 
}
.btn-add-devises:hover { 
    background: linear-gradient(45deg, #7c3aed, #8b5cf6);
}

.btn-print-table { 
    background: #eab308;
    color: #fff; 
}
.btn-print-table:hover { 
    background: linear-gradient(45deg, #ca8a04, #eab308);
}

.btn-export-excel { 
    background: #a78bfa;
    color: #fff; 
}
.btn-export-excel:hover { 
    background: linear-gradient(45deg, #9333ea, #a78bfa);
}

.btn-nav-users { 
    background: #007bff; 
    color: #fff; 
}
.btn-nav-users:hover { 
    background: linear-gradient(45deg, #0056b3, #007bff); 
}

.btn-nav-bureaux { 
    background: #28a745; 
    color: #fff; 
}
.btn-nav-bureaux:hover { 
    background: linear-gradient(45deg, #218838, #28a745); 
}

.btn-nav-frais { 
    background: #fd7e14; 
    color: #fff; 
}
.btn-nav-frais:hover { 
    background: linear-gradient(45deg, #e06c12, #fd7e14); 
}

.btn-nav-taux { 
    background: #6f42c1; 
    color: #fff; 
}
.btn-nav-taux:hover { 
    background: linear-gradient(45deg, #5a32a3, #6f42c1); 
}

.btn-nav-transporteurs { 
    background: #17a2b8; 
    color: #fff; 
}
.btn-nav-transporteurs:hover { 
    background: linear-gradient(45deg, #138496, #17a2b8); 
}

.btn-nav-sessions { 
    background: #6c757d; 
    color: #fff; 
}
.btn-nav-sessions:hover { 
    background: linear-gradient(45deg, #5a6268, #6c757d); 
}

.btn-nav-devises { 
    background: #8b5cf6; 
    color: #fff; 
}
.btn-nav-devises:hover { 
    background: linear-gradient(45deg, #7c3aed, #8b5cf6); 
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

/* Filter Input */
.filter-input {
    border-radius: 5px;
    padding: 5px;
    font-size: 0.65rem;
    border: 1px solid #d1d5db;
    transition: all 0.3s ease;
}

.filter-input:focus {
    border-color: #1e40af;
    box-shadow: 0 0 4px rgba(30, 64, 175, 0.2);
    transform: scale(1.02);
}

.dark-mode .filter-input {
    background: #4a4a6a;
    border-color: #6b7280;
    color: #e0e0e0;
}

/* Modals */
.modal-content {
    border-radius: 8px;
    background: #fff;
    animation: zoomIn 0.3s ease-out;
}

.dark-mode .modal-content {
    background: linear-gradient(135deg, #2a2a4a, #3a3a5a);
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    background: linear-gradient(45deg, #1e40af, #3b82f6);
    color: #fff;
    border-radius: 8px 8px 0 0;
}

.dark-mode .modal-header {
    background: linear-gradient(45deg, #1a2a6c, #4a4a8c);
}

.modal-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
}

.modal-body {
    max-height: 75vh;
    overflow-y: auto;
    background: #f9fafb;
}

.dark-mode .modal-body {
    background: #3a3a5a;
}

.modal-body .form-group {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 5px;
    padding: 3px 6px;
    margin-bottom: 6px;
    animation: fadeIn 0.5s ease-in;
}

.modal-body .form-label {
    font-size: 0.65rem;
    color: #2c3e50;
}

.dark-mode .modal-body .form-label {
    color: #60a5fa;
}

.modal-body .form-control, .modal-body .form-select {
    border-radius: 4px;
    font-size: 0.65rem;
    padding: 3px 5px;
    transition: all 0.3s ease;
}

.modal-body .form-control:focus, .modal-body .form-select:focus {
    border-color: #1e40af;
    box-shadow: 0 0 4px rgba(30, 64, 175, 0.2);
    transform: scale(1.02);
}

.dark-mode .modal-body .form-control, .dark-mode .modal-body .form-select {
    background: #4a4a6a;
    color: #e0e0e0;
    border-color: #6b7280;
}

.modal-body .form-control:invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.2);
}

/* Print Styles */
@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }
    body {
        background: none;
        border: none;
        color: #000;
        font-family: Arial, sans-serif;
        font-size: 8pt;
        margin: 0;
    }
    .custom-navbar, .action-buttons, .modal-body, #loadingOverlay, .toast-container, .no-print, #filterMenuContainer {
        display: none;
    }
    .hide-on-print {
        display: none !important;
    }
    .container {
        margin: 0;
        padding: 0;
        width: 100%;
    }
    #content {
        box-shadow: none;
        border: none;
        padding: 0;
        background: none;
    }
    #tableContainer {
        max-height: none;
        overflow: none !important;
    }
    .excel-table {
        width: 100%;
        table-layout: fixed;
        border-collapse: collapse;
        border-spacing: 0;
        font-size: 7pt;
    }
    .excel-table th, .excel-table td {
        border: 0.5px solid black;
        padding: 2px;
        text-align: left;
    }
    .excel-table th {
        background: #2c3e50;
        color: #fff;
        font-weight: bold;
    }
    .excel-table td {
        background: #fff;
        color: #000 !important;
        font-size: 7pt !important;
    }
    .excel-table tr:nth-child(even) td {
        background: #f9f9f9;
    }
    .excel-table th:nth-child(1), .excel-table td:nth-child(1) { width: 7%; }
    .excel-table th:nth-child(2), .excel-table td:nth-child(2) { width: 15%; }
    .excel-table th:nth-child(3), .excel-table td:nth-child(3) { width: 15%; }
    .excel-table th:nth-child(4), .excel-table td:nth-child(4) { width: 15%; }
    .excel-table th:nth-child(5), .excel-table td:nth-child(5) { width: 10%; }
    .excel-table th:nth-child(6), .excel-table td:nth-child(6) { width: 15%; }
    .excel-table th:nth-child(7), .excel-table td:nth-child(7) { width: 7%; }
    .excel-table th:nth-child(8), .excel-table td:nth-child(8) { width: 7%; }
    .excel-table th:nth-child(9), .excel-table td:nth-child(9) { width: 15%; }
    .status-dot {
        display: none;
    }
    .btn-toggle-password {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .custom-navbar { width: 98%; padding: 6px; }
    .container { margin-top: 60px; padding: 8px; }
    h1 { font-size: 0.9rem; } /* Taille encore plus petite sur mobile */
    .excel-table th, .excel-table td { font-size: 0.55rem; padding: 4px; }
    .btn { padding: 2px 5px; font-size: 0.55rem; }
    .filter-input { font-size: 0.6rem; padding: 4px; }
    .modal-body .form-group { grid-template-columns: 1fr; }
    .modal-body .form-label, .modal-body .form-control, .modal-body .form-select { font-size: 0.6rem; }
    #tableContainer { max-height: 180px; }
    #loadingOverlay .spinner-border { width: 2rem; height: 2rem; }
    #filterMenuContainer .dropdown-menu { min-width: 220px; }
}

/* Denomination link styles */
.denomination-link {
    color: #1e40af;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
}

.denomination-label {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    position: relative;
    transition: color 0.3s ease, transform 0.3s ease;
}

.denomination-label::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #f59e0b;
    transition: width 0.4s ease;
}

.denomination-link:hover .denomination-label {
    color: #ef4444;
    transform: translateY(-2px);
}

.denomination-link:hover .denomination-label::after {
    width: 100%;
}

.dark-mode .denomination-link {
    color: #60a5fa;
}

.dark-mode .denomination-link:hover .denomination-label {
    color: #f87171;
}

.dark-mode .denomination-label::after {
    background-color: #facc15;
}

@media print {
    .denomination-link, .denomination-label {
        color: black !important;
        text-decoration: none !important;
    }
    .denomination-label::after {
        display: none !important;
    }
}

.navbar-nav .nav-link {
    color: white !important;
    font-size: 1.1rem;
}

.navbar-nav .nav-link:hover {
    color: #adb5bd !important;
}

.dropdown-item {
    color: white !important;
}

.dropdown-item:hover {
    background-color: #495057;
}
.filter-search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}
.search-box {
    position: relative;
    display: inline-block;
}
.search-box input {
    padding-left: 30px;
    border-radius: 20px;
    border: 1px solid #ced4da;
    height: 38px;
    width: 150px;
    transition: border-color 0.3s ease;
}
.search-box input:focus {
    outline: none;
    border-color: #dc3545;
}
.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}