* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #104480 0%, #1a5ba0 100%);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Fond combiné pour la page d'accueil */
body.home-page {
  background: none;
  background-image: 
    url('../images/acceuil2_gauche.png'),
    url('../images/acceuil1_droite.jpg');
  background-position: 
    left center,
    right center;
  background-repeat: no-repeat;
  background-size: 
    50% auto,
    50% auto;
  background-attachment: fixed;
}

/* Style spécifique pour le tableau de bord d'administration */
body.admin-dashboard {
  background-image: url('../images/administration.png.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.container {
  max-width: 1200px;
  margin: 40px auto;
  background: #f5f0d8;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Style pour le conteneur du tableau de bord d'administration */
body.admin-dashboard .container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Logo en arrière-plan dans la zone rouge */
.background-logo {
  position: fixed;
  top: 100px;
  right: 120px;
  z-index: 10;
  pointer-events: none;
}

.main-logo {
  height: 300px;
  width: auto;
  max-width: 400px;
  object-fit: contain;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  background: transparent;
  padding: 0;
  backdrop-filter: none;
  border: none;
  /* Filtre pour essayer de rendre le blanc transparent */
  mix-blend-mode: multiply;
  filter: contrast(1.2) brightness(1.1);
}

h1 { 
  text-align: center; 
  color: #333;
  margin-bottom: 10px;
  font-size: 2.5em;
}

.container > p {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1em;
}

/* Grid pour les cartes de quiz */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.quiz-card {
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #e1e5e9;
  position: relative;
  overflow: hidden;
  min-height: 400px;
}

/* Par défaut, fond blanc si pas d'image */
.quiz-card:not([style*="background-image"]) {
  background-color: #fff;
}

.quiz-card:not([style*="background-image"]) .quiz-info {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  text-shadow: none;
}

.quiz-card:not([style*="background-image"]) .description {
  color: #666;
  text-shadow: none;
}

/* Si une image de fond est définie, elle doit être visible */
.quiz-card[style*="background-image"] {
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-color: rgba(255, 255, 255, 0.3) !important;
}

/* Le contenu doit être au-dessus de l'image */
.quiz-card > * {
  position: relative;
  z-index: 1;
}

.quiz-card .quiz-info {
  background: transparent;
  padding: 15px;
  border-radius: 8px;
  margin-top: 10px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.quiz-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.qr-code {
  text-align: center;
  margin-bottom: 15px;
}

.qr-code img {
  border-radius: 8px;
  border: 2px solid #f0f0f0;
}

.quiz-info h3 {
  color: #fff;
  margin-bottom: 10px;
  font-size: 1.3em;
}

.description {
  color: #f5f5f5;
  margin-bottom: 15px;
  font-size: 0.9em;
  line-height: 1.4;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.quiz-link {
  display: inline-block;
  background: linear-gradient(135deg, #f7b733, #f4a020);
  color: #333;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 25px;
  transition: background 0.3s ease;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.quiz-link:hover {
  background: linear-gradient(135deg, #fbc948, #f7b733);
  color: #000;
}

.admin-link {
  text-align: center;
  margin-top: 30px;
}

.admin-btn {
  display: inline-block;
  background: linear-gradient(135deg, #fbc948, #f7b733);
  color: #333;
  padding: 12px 25px;
  text-decoration: none;
  border-radius: 25px;
  transition: background 0.3s ease;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.admin-btn:hover {
  background: linear-gradient(135deg, #ffd863, #fbc948);
  color: #000;
}

/* Tableau pour le dashboard */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e1e5e9;
}

th {
  background: #104480;
  color: white;
  font-weight: 600;
}

tr:hover {
  background: #f8f9fa;
}

.logout-btn {
  float: right;
  background: #d9534f;
  color: white;
  padding: 8px 12px;
  text-decoration: none;
  border-radius: 4px;
}

.login-container {
  width: 320px;
  margin: 100px auto;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  text-align: center;
}

.login-container input {
  width: 90%;
  margin: 8px 0;
  padding: 10px;
}

.login-container button {
  background: #104480;
  color: white;
  padding: 10px 15px;
  border: none;
  cursor: pointer;
  width: 100%;
}

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, #f7b733 0%, #f4a020 100%);
  color: #333;
  padding: 15px;
  border: none;
  border-radius: 10px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
  box-shadow: 0 8px 18px rgba(247, 183, 51, 0.35);
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(247, 183, 51, 0.4);
}

/* Styles pour les statistiques */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.stat-card {
  background: linear-gradient(135deg, #104480 0%, #1a5ba0 100%);
  color: white;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-card h3 {
  font-size: 2.5em;
  margin-bottom: 10px;
  font-weight: bold;
}

.stat-card p {
  font-size: 1.1em;
  opacity: 0.9;
}

/* Styles pour les scores */
.score-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 0.9em;
}

.score-excellent {
  background: #d4edda;
  color: #155724;
}

.score-good {
  background: #fff3cd;
  color: #856404;
}

.score-poor {
  background: #f8d7da;
  color: #721c24;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  gap: 5px;
}

.pagination a {
  padding: 8px 12px;
  background: #f8f9fa;
  color: #104480;
  text-decoration: none;
  border-radius: 5px;
  transition: background 0.3s ease;
}

.pagination a:hover,
.pagination a.active {
  background: #104480;
  color: white;
}

/* Table container */
.table-container {
  margin-top: 30px;
}

.table-container h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.5em;
}

/* Responsive */
@media (max-width: 768px) {
  .quiz-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .container {
    margin: 20px;
    padding: 20px;
  }
  
  h1 {
    font-size: 2em;
  }
  
  /* Logo responsive */
  .background-logo {
    top: 80px;
    right: 60px;
  }
  
  .main-logo {
    height: 180px;
    max-width: 250px;
    padding: 0;
  }
}