:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #0dcaf0;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  --border-radius: 8px;
}

[data-bs-theme="dark"] {
  --primary-color: #0d6efd;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #0dcaf0;
  --light-color: #212529;
  --dark-color: #f8f9fa;
  --border-radius: 8px;
}

/* Styles généraux */
body {
  background-color: #f8f9fa;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

[data-bs-theme="dark"] body {
  background-color: #121212;
  color: #e0e0e0;
}

.container-fluid {
  padding: 0 15px;
}

.navbar {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .navbar {
  background-color: #1a1a1a !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Cartes */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 1rem;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

[data-bs-theme="dark"] .card {
  background-color: #2d2d2d;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  color: #e0e0e0;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
  font-weight: 600;
}

[data-bs-theme="dark"] .card-header {
  border-bottom: 1px solid #444;
  background-color: #363636;
}

.list-group-item {
  border: none;
  border-radius: 0 !important;
  padding: 0.75rem 1rem;
  transition: background-color 0.2s;
}

.list-group-item:hover {
  background-color: rgba(0, 123, 255, 0.05);
}

[data-bs-theme="dark"] .list-group-item {
  background-color: #2d2d2d;
  color: #e0e0e0;
}

[data-bs-theme="dark"] .list-group-item:hover {
  background-color: rgba(13, 110, 253, 0.1);
}

.projet-item.active {
  background-color: rgba(0, 123, 255, 0.1);
  border-left: 3px solid var(--primary-color);
  font-weight: 600;
}

[data-bs-theme="dark"] .projet-item.active {
  background-color: rgba(13, 110, 253, 0.2);
}

.task-card {
  background-color: white;
  border: 1px solid #e9ecef;
  border-left: 4px solid var(--primary-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
}

[data-bs-theme="dark"] .task-card {
  background-color: #363636;
  border-color: #444;
  color: #e0e0e0;
}

.task-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.task-card.retard {
  border-left-color: var(--danger-color);
  background-color: rgba(220, 53, 69, 0.05);
}

[data-bs-theme="dark"] .task-card.retard {
  background-color: rgba(220, 53, 69, 0.1);
}

.task-card.termine {
  opacity: 0.7;
}

.task-card .task-actions {
  opacity: 0;
  transition: opacity 0.2s;
}

.task-card:hover .task-actions {
  opacity: 1;
}

.badge-priorite {
  padding: 0.25em 0.6em;
  font-size: 0.75em;
  font-weight: 600;
  border-radius: 10px;
}

.badge-haute {
  background-color: var(--danger-color);
  color: white;
}

.badge-normale {
  background-color: var(--warning-color);
  color: #000;
}

.badge-basse {
  background-color: var(--secondary-color);
  color: white;
}

.etiquette-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  margin: 0.1em;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: 500;
  color: white;
}

.kanban-col {
  min-height: 500px;
  border-radius: var(--border-radius);
  background-color: rgba(248, 249, 250, 0.5);
  transition: all 0.3s;
  padding: 0.5rem;
}

[data-bs-theme="dark"] .kanban-col {
  background-color: rgba(45, 45, 45, 0.5);
}

.kanban-col[data-statut="a_faire"] {
  border-top: 4px solid #0d6efd;
}

.kanban-col[data-statut="en_cours"] {
  border-top: 4px solid #ffc107;
}

.kanban-col[data-statut="termine"] {
  border-top: 4px solid #198754;
}

.kanban-item {
  cursor: move;
  user-select: none;
  animation: fadeIn 0.3s ease-out;
  margin-bottom: 0.75rem;
}

.kanban-item:last-child {
  margin-bottom: 0;
}

.kanban-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* États du drag & drop */
.kanban-ghost {
  opacity: 0.4;
  background-color: #f8f9fa;
}

.kanban-chosen {
  transform: rotate(2deg);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2) !important;
}

.kanban-drag {
  cursor: grabbing !important;
}

/* Animation d'apparition */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Colonnes vides */
.kanban-col:empty::after {
  content: "Déposez les tâches ici";
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  color: #6c757d;
  font-style: italic;
  border: 2px dashed #dee2e6;
  border-radius: var(--border-radius);
  margin: 1rem;
  text-align: center;
}

[data-bs-theme="dark"] .kanban-col:empty::after {
  color: #adb5bd;
  border-color: #495057;
}

/* Sortable pour la liste */
.sortable-list {
  min-height: 100px;
}

.sortable-item {
  cursor: move;
  transition: transform 0.2s;
}

.sortable-item:hover {
  transform: translateX(5px);
}

.sortable-chosen {
  background-color: rgba(0, 123, 255, 0.1) !important;
}

/* Statistiques */
.stats-card {
  transition: all 0.3s;
}

.stats-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1) !important;
}

/* Graphiques */
canvas {
  max-width: 100%;
}

/* Formulaires */
.form-control,
.form-select {
  border-radius: var(--border-radius);
  border: 1px solid #ced4da;
  padding: 0.5rem 0.75rem;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: #363636;
  border-color: #495057;
  color: #e0e0e0;
}

.form-control:focus,
.form-select:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: #363636;
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Boutons */
.btn {
  border-radius: var(--border-radius);
  padding: 0.375rem 0.75rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Modals */
.modal-content {
  border-radius: var(--border-radius);
  border: none;
}

[data-bs-theme="dark"] .modal-content {
  background-color: #2d2d2d;
  color: #e0e0e0;
}

[data-bs-theme="dark"] .modal-header {
  border-bottom: 1px solid #444;
}

[data-bs-theme="dark"] .modal-footer {
  border-top: 1px solid #444;
}

/* Alertes */
.alert {
  border-radius: var(--border-radius);
  border: none;
  padding: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .container-fluid {
    padding: 0 10px;
  }

  .kanban-col {
    min-height: 300px;
    margin-bottom: 1rem;
  }

  .row {
    margin-left: -5px;
    margin-right: -5px;
  }

  .col-md-3,
  .col-md-4,
  .col-md-6,
  .col-md-9,
  .col-md-12 {
    padding-left: 5px;
    padding-right: 5px;
  }

  .card {
    margin-bottom: 0.5rem;
  }

  .task-card {
    padding: 0.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .display-4 {
    font-size: 2.5rem;
  }
}

@media (max-width: 576px) {
  .navbar-brand {
    font-size: 1rem;
  }

  .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }

  .kanban-col {
    min-height: 250px;
  }

  .task-card .task-actions {
    opacity: 1; /* Toujours visible sur mobile */
  }
}

/* Utilitaires */
.text-muted {
  opacity: 0.8;
}

[data-bs-theme="dark"] .text-muted {
  color: #adb5bd !important;
}

.border {
  border-color: #dee2e6 !important;
}

[data-bs-theme="dark"] .border {
  border-color: #495057 !important;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
  background: #2d2d2d;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #555;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* Loader */
.spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Icônes */
.bi {
  vertical-align: middle;
}

/* Espacements */
.mt-4 {
  margin-top: 1.5rem !important;
}

.mb-4 {
  margin-bottom: 1.5rem !important;
}

.py-5 {
  padding-top: 3rem !important;
  padding-bottom: 3rem !important;
}

/* Ombres */
.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Transitions */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Animation pour les notifications */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.position-fixed {
  animation: slideIn 0.3s ease-out;
}

/* Responsive design pour les notifications */
@media (max-width: 768px) {
  .position-fixed {
    left: 10px;
    right: 10px;
    min-width: unset;
  }
}
