:root {
  --bg: #050816;
  --card-bg: #0e1220;
  --accent: #7b5cff;
  --accent2: #00e0ff;
  --text: #f5f5f5;
  --danger: #ff4b81;
}

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

/* ===== BODY + BACKGROUND ANIMÉ ===== */

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top, #191b3a 0, #050816 45%, #000 100%);
  background-size: 200% 200%;
  animation: bg-move 22s ease-in-out infinite;
}

@keyframes bg-move {
  0% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 100% 100%;
  }
  100% {
    background-position: 0% 0%;
  }
}

/* ===== HEADER ===== */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(5, 8, 22, 0.9);
  border-bottom: 1px solid rgba(123, 92, 255, 0.3);
  backdrop-filter: blur(10px);
}

.logo {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
}

.logo-main {
  color: var(--accent2);
}

.logo-sub {
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-size: 0.8rem;
}

.header nav a {
  color: #cfd2ff;
  text-decoration: none;
  margin-left: 16px;
  font-size: 0.95rem;
  position: relative;
}

.header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.2s ease;
}

.header nav a:hover::after {
  width: 100%;
}

/* ===== LAYOUT PRINCIPAL ===== */

.container {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 32px 16px 64px;
}

/* Carte principale (questionnaire / admin / login) */
.card {
  background:
    radial-gradient(circle at top left, rgba(123, 92, 255, 0.35), transparent 55%),
    radial-gradient(circle at bottom right, rgba(0, 224, 255, 0.25), transparent 55%),
    var(--card-bg);
  border-radius: 18px;
  padding: 24px 24px 28px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(123, 92, 255, 0.35);
}

.card.small {
  max-width: 420px;
}

h2 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 0.95rem;
  color: #c1c5ff;
  margin-bottom: 18px;
}

/* ===== FORMULAIRES ===== */

form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Groupes de champs pour une meilleure mise en page */
.form-group {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  margin-bottom: 4px;
}

label {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
select {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 9px 11px;
  background: rgba(10, 13, 30, 0.9);
  color: var(--text);
  outline: none;
  font-size: 0.95rem;
  width: 100%;
  appearance: none;
}

/* Petite flèche custom pour les select (simple) */
select {
  background-image: linear-gradient(45deg, transparent 50%, #ffffff 50%),
                    linear-gradient(135deg, #ffffff 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px rgba(0, 224, 255, 0.35);
}

/* Bouton principal */
button {
  margin-top: 14px;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #050816;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
  box-shadow: 0 10px 24px rgba(8, 187, 255, 0.3);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(8, 187, 255, 0.4);
  opacity: 0.96;
}

button:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(8, 187, 255, 0.25);
  opacity: 0.9;
}

/* Sections de questions (élève/prof) */

.questions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.questions h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

/* Visible / caché */
.hidden {
  display: none;
}

/* Messages d'erreur */
.error {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 75, 129, 0.12);
  border: 1px solid rgba(255, 75, 129, 0.6);
  color: #ffd6e4;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.note {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #b0b6ff;
}

/* ===== FOOTER ===== */

.footer {
  text-align: center;
  padding: 10px 16px 14px;
  font-size: 0.8rem;
  color: #8b8fff;
  border-top: 1px solid rgba(123, 92, 255, 0.3);
  background: rgba(5, 8, 22, 0.9);
}

/* ===== ADMIN : STATS & TABLE ===== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.stats-grid h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.stats-grid ul {
  list-style: none;
  font-size: 0.9rem;
}

.stats-grid li {
  margin-bottom: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.86rem;
}

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 8px;
  text-align: left;
}

th {
  background: rgba(10, 13, 30, 0.9);
  font-weight: 600;
}

tr:nth-child(even) td {
  background: rgba(10, 13, 30, 0.4);
}

/* ===== RESPONSIVE MOBILE ===== */

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }

  .header nav a {
    margin-left: 0;
    margin-right: 12px;
  }

  .container {
    padding: 20px 10px 36px;
  }

  .card {
    padding: 18px 14px 22px;
    max-width: 480px;
  }

  h2 {
    font-size: 1.4rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  label {
    font-size: 0.9rem;
  }

  input[type="text"],
  input[type="password"],
  select {
    font-size: 0.9rem;
    padding: 9px 10px;
  }

  button {
    font-size: 0.95rem;
    padding: 11px 16px;
  }
}
