/* Style général de la page */
body {
  font-family: "Arial", sans-serif;
  background: linear-gradient(135deg, #000000, #8b0000);
  color: #f8f9fa;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Conteneur principal */
.dashboard-container {
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* En-tête du dashboard */
.dashboard-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.dashboard-header h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  color: #fff;
  margin: 0 0 1rem 0;
  text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

.user-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.user-info span {
  font-weight: bold;
  font-size: 1.1rem;
}

/* Bouton de déconnexion */
#logout-btn {
  padding: 0.5rem 1rem;
  background-color: #8b0000;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
  font-size: 1rem;
  min-width: 120px;
}

#logout-btn:hover {
  background-color: #ff0000;
  transform: translateY(-2px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Grille du dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

/* Cartes de statistiques */
.stat-card {
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  text-align: center;
  transition: transform 0.3s ease;
  border-left: 4px solid #8b0000;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(139, 0, 0, 0.4);
}

.stat-card h3 {
  margin: 0;
  color: #ff4d4d;
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin-bottom: 1rem;
}

.stat-value {
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: bold;
  color: #fff;
  margin: 0.5rem 0;
  text-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
  line-height: 1;
}

/* Conteneurs de graphiques */
.chart-container {
  background-color: rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  border-left: 4px solid #8b0000;
  display: flex;
  flex-direction: column;
}

.chart-container h3 {
  margin: 0 0 1rem 0;
  color: #ff4d4d;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

/* Conteneurs de tableaux */
.table-container {
  background-color: rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  grid-column: 1 / -1;
  border-left: 4px solid #8b0000;
  overflow-x: auto;
}

.table-container h3 {
  margin: 0 0 1rem 0;
  color: #ff4d4d;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

/* Styles des tableaux */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  min-width: 600px;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.data-table th {
  background-color: rgba(139, 0, 0, 0.2);
  color: #ff4d4d;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.data-table tr:hover {
  background-color: rgba(139, 0, 0, 0.1);
}

/* Personnalisation des graphiques */
canvas {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  padding: 10px;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16/9;
}

/* Conteneur élargi pour les notes */
.ratings-container {
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 0 15px rgba(139, 0, 0, 0.6);
  border-left: 4px solid #ff4d4d;
  grid-column: 1 / -1;
  margin: 0 auto;
  width: 100%;
  max-width: 1000px;
}

/* Ajustement du canvas */
#ratings-chart {
  background-color: rgba(20, 20, 20, 0.5);
  border-radius: 8px;
  padding: 1rem;
  margin: 0 auto;
  width: 100% !important;
  height: auto !important;
  min-height: 300px;
  aspect-ratio: 1.5;
}

/* Légende améliorée */
.chart-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 0 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  background: rgba(30, 30, 30, 0.7);
  padding: 0.75rem;
  border-radius: 5px;
  border-left: 3px solid #ff4d4d;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  margin-right: 0.75rem;
  background-color: #ff4d4d;
  flex-shrink: 0;
}

.legend-label {
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: #f8f9fa;
  font-weight: 500;
}

/* Étoiles pour la notation */
.rating-stars {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.star {
  color: #ffcc00;
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin: 0 2px;
}

/* Tooltip personnalisé */
.chartjs-tooltip {
  background: rgba(0, 0, 0, 0.9) !important;
  border: 1px solid #8b0000 !important;
  border-radius: 5px !important;
  color: white !important;
  padding: 0.5rem !important;
  font-family: Arial, sans-serif !important;
  font-size: 0.9rem !important;
  backdrop-filter: blur(2px);
}

/* Animation pour les cartes */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card,
.chart-container,
.table-container,
.ratings-container {
  animation: fadeIn 0.5s ease-out forwards;
}

/* Délai d'animation pour chaque élément */
.stat-card:nth-child(1) {
  animation-delay: 0.1s;
}
.stat-card:nth-child(2) {
  animation-delay: 0.2s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.3s;
}
.stat-card:nth-child(4) {
  animation-delay: 0.4s;
}
.chart-container:nth-child(5) {
  animation-delay: 0.5s;
}
.chart-container:nth-child(6) {
  animation-delay: 0.6s;
}
.chart-container:nth-child(7) {
  animation-delay: 0.7s;
}
.chart-container:nth-child(8) {
  animation-delay: 0.8s;
}
.table-container:nth-child(9) {
  animation-delay: 0.9s;
}
.ratings-container {
  animation-delay: 0.5s;
}

/* Media Queries pour le responsive */
@media (min-width: 768px) {
  .dashboard-header {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  .dashboard-header h1 {
    margin-bottom: 0;
  }

  .user-info {
    justify-content: flex-end;
    width: auto;
  }

  .ratings-container {
    padding: 2rem;
  }

  #ratings-chart {
    min-height: 400px;
  }
}

@media (max-width: 600px) {
  .dashboard-container {
    padding: 1rem;
  }

  .stat-card {
    min-height: 120px;
    padding: 1rem;
  }

  .chart-container,
  .table-container,
  .ratings-container {
    padding: 1rem;
  }

  .chart-legend {
    grid-template-columns: 1fr;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem;
  }
}

@media (max-width: 400px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stat-value {
    font-size: 1.8rem;
  }

  #ratings-chart {
    aspect-ratio: 1;
  }
}
