/* Variables CSS pour les thèmes */
:root {
    --primary-color: #4a6bff;
    --secondary-color: #6c5ce7;
    --success-color: #00cec9;
    --danger-color: #ff4757;
    --warning-color: #ffa502;
    --info-color: #1e90ff;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --text-color: #212529;
    --text-light: #f8f9fa;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --sidebar-width: 250px;
    --transition-speed: 0.3s;
}

/* Thème sombre */
[data-theme="dark"] {
    --primary-color: #5a7dff;
    --secondary-color: #7c6ce7;
    --success-color: #00cec9;
    --danger-color: #ff4757;
    --warning-color: #ffa502;
    --info-color: #1e90ff;
    --light-color: #121212;
    --dark-color: #1e1e1e;
    --text-color: #e0e0e0;
    --text-light: #ffffff;
    --border-color: #495057;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --card-bg: #1e1e1e;
    --table-bg: #1e1e1e;
    --table-header-bg: #2d2d2d;
    --input-bg: #2d2d2d;
    --input-border: #495057;
    --input-color: #e0e0e0;
}

/* Styles spécifiques pour le thème sombre */
[data-theme="dark"] .card {
    background-color: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] .table {
    background-color: var(--table-bg);
    color: var(--text-color);
}

[data-theme="dark"] .table th {
    background-color: var(--table-header-bg);
}

[data-theme="dark"] .form-control {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--input-color);
}

[data-theme="dark"] .btn-primary {
    background-color: var(--primary-color);
}

[data-theme="dark"] .alert-danger {
    background-color: #4a1b21;
    color: #ffb7c3;
}

[data-theme="dark"] .alert-success {
    background-color: #1b3a1b;
    color: #b7ffb7;
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* Appliquer le thème à tous les éléments */
body[data-theme="dark"] {
    background-color: var(--light-color);
    color: var(--text-color);
}

/* Sidebar responsive */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--dark-color);
    color: var(--text-light);
    height: calc(100vh - 60px);
    position: fixed;
    top: 60px;
    left: 0;
    transition: transform var(--transition-speed) ease;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.5rem;
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    padding: 0.5rem 1rem;
}

.sidebar-menu a {
    color: var(--text-light);
    text-decoration: none;
    display: block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color var(--transition-speed) ease;
}

.sidebar-menu a:hover {
    background-color: var(--primary-color);
}

.sidebar-menu a.active {
    background-color: var(--primary-color);
    font-weight: bold;
}

/* Ancien switch pour le thème (à supprimer) */
/* .theme-switch {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-switch input[type="checkbox"] {
    height: 0;
    width: 0;
    visibility: hidden;
}

.theme-switch label {
    cursor: pointer;
    text-indent: -9999px;
    width: 50px;
    height: 25px;
    background: var(--border-color);
    display: block;
    border-radius: 25px;
    position: relative;
}

.theme-switch label:after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background: var(--light-color);
    border-radius: 50%;
    transition: var(--transition-speed);
}

.theme-switch input:checked + label {
    background: var(--primary-color);
}

.theme-switch input:checked + label:after {
    left: calc(100% - 2px);
    transform: translateX(-100%);
} */

/* Animations CSS */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn var(--transition-speed) ease-in;
}

/* Mobile-first */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-speed) ease;
    }

    .sidebar.active {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0;
    }

    /* Afficher le bouton de toggle uniquement sur mobile */
    #new-sidebar-toggle {
        display: block;
    }
}

@media (min-width: 769px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }

    /* Masquer le bouton de toggle sur les écrans larges */
    #new-sidebar-toggle {
        display: none;
    }
}

/* Header */
.header {
    background-color: var(--dark-color);
    box-shadow: 0 2px 4px var(--shadow-color);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1001;
    color: var(--text-light);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* Bouton de toggle */
#new-sidebar-toggle {
    z-index: 1002;
    position: relative;
}

/* Bouton de basculement de thème */
.theme-switch {
    display: flex;
    align-items: center;
}

.theme-switch input[type="checkbox"] {
    height: 0;
    width: 0;
    visibility: hidden;
}

.theme-switch-label {
    cursor: pointer;
    text-indent: -9999px;
    width: 50px;
    height: 25px;
    background: var(--border-color);
    display: block;
    border-radius: 25px;
    position: relative;
}

.theme-switch-label i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: var(--transition-speed);
    color: var(--text-light);
}

.theme-switch-label .fa-sun {
    left: 5px;
}

.theme-switch-label .fa-moon {
    right: 5px;
    opacity: 0;
}

.theme-switch input:checked + .theme-switch-label {
    background: var(--primary-color);
}

.theme-switch input:checked + .theme-switch-label .fa-sun {
    opacity: 0;
}

.theme-switch input:checked + .theme-switch-label .fa-moon {
    opacity: 1;
}

/* Boutons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
}

/* Cartes */
.card {
    background-color: var(--light-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    margin-bottom: 1rem;
    transition: transform var(--transition-speed) ease;
    color: var(--text-color);
}

.card:hover {
    transform: translateY(-5px);
}

/* Tableau */
.table {
    width: 100%;
    margin-bottom: 1rem;
    background-color: var(--light-color);
    color: var(--text-color);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--primary-color);
    color: white;
}

.table tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Formulaires */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    background-color: var(--light-color);
    color: var(--text-color);
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(74, 107, 255, 0.25);
}

/* Alertes */
.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
}

.pagination li {
    margin: 0 0.25rem;
}

.pagination a {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary-color);
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Conteneur */
.container {
    width: 100%;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Grille */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem;
}

.col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 0 0.5rem;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    
    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* Utilitaires */
.mt-4 {
    margin-top: 1.5rem;
}

.text-center {
    text-align: center;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}