/* ============================================================
   style.css — WebApp Grand Oral
   Charte visuelle : Syne / DM Sans / Arizonia
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&family=Arizonia&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg        : #f6f6f6;
  --surface   : #ffffff;
  --surface2  : #ebebeb;

  /* Accent élève (bleu) */
  --accent        : #1a5c96;
  --accent-hover  : #154d80;
  --accent-light  : #e8f0fa;

  /* Admin (violet) */
  --admin         : #2d1a6e;
  --admin-hover   : #1e1050;
  --admin-light   : #f0ebff;
  --admin-gold    : #f0b060;

  /* Danger */
  --danger        : #c8401a;
  --danger-hover  : #a03015;

  /* Texte */
  --text          : #18181b;
  --muted         : #6b6860;

  /* Bordure */
  --border        : #d4cfc6;

  /* Succès */
  --success       : #1e7a4a;
  --success-bg    : #e6f5ee;
  --success-border: #9ed8b8;

  /* Erreur */
  --error         : #8a1a1a;
  --error-bg      : #fdeaea;
  --error-border  : #f0aaaa;

  /* Avertissement */
  --warn          : #7a5000;
  --warn-bg       : #fff8e6;
  --warn-border   : #f0d88a;

  /* Info élève */
  --info-text     : #1a3a5c;
  --info-bg       : #e8f0fa;
  --info-border   : #b8d4f0;

  /* Info admin violette */
  --info-admin-text   : #2d1a6e;
  --info-admin-bg     : #f5f0ff;
  --info-admin-border : #c8b8f0;

  /* Rayons */
  --radius-card   : 16px;
  --radius-card-sm: 12px;
  --radius-btn    : 10px;
  --radius-input  : 10px;
  --radius-badge  : 20px;
  --radius-tab    : 8px 8px 0 0;

  /* Ombres */
  --shadow-card   : 0 1px 4px rgba(0,0,0,.04);
  --shadow-header : 0 2px 12px rgba(0,0,0,.18);
  --shadow-modal  : 0 8px 40px rgba(0,0,0,.22);
}

/* ── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Typographie ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: white;
  text-decoration: none;
}
.logo span { color: var(--admin-gold); }

.card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.stat-num {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--accent);
}

.muted { color: var(--muted); font-size: 0.88rem; }
.small  { font-size: 0.82rem; color: var(--muted); }

/* ── Layout principal ───────────────────────────────────────── */
.page-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}

.page-wrapper--wide {
  max-width: 1200px;
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  background: var(--accent);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-header);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header--admin {
  background: var(--admin);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-info {
  font-size: 0.85rem;
  opacity: .85;
}

/* ── Bouton header (glass) ──────────────────────────────────── */
.btn-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,.15);
  color: white;
  border: none;
  border-radius: 8px;
  padding: .45rem .9rem;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-header:hover {
  background: rgba(255,255,255,.28);
  text-decoration: none;
  color: white;
}

/* ── Boutons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-btn);
  padding: .75rem 1.5rem;
  cursor: pointer;
  transition: background .18s, box-shadow .18s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(26,92,150,.3);
  text-decoration: none;
  color: white;
}

.btn-admin {
  background: var(--admin);
  color: white;
}
.btn-admin:hover {
  background: var(--admin-hover);
  box-shadow: 0 4px 14px rgba(45,26,110,.3);
  text-decoration: none;
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: var(--danger-hover);
  text-decoration: none;
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #175e38;
  text-decoration: none;
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn-sm {
  font-size: 0.82rem;
  padding: .45rem .9rem;
  border-radius: 8px;
}

.btn-lg {
  font-size: 1.05rem;
  padding: 1rem 2.2rem;
}

.btn:disabled, .btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Cartes ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.card + .card { margin-top: 1.5rem; }

.card-sm {
  border-radius: var(--radius-card-sm);
  padding: 1.25rem 1.5rem;
}

/* ── Inputs / Selects / Textarea ────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-group + .form-group { margin-top: 1rem; }

label {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  padding: .75rem 1rem;
  width: 100%;
  transition: border-color .18s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.input-counter {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  margin-top: 0.25rem;
}
.input-counter.over { color: var(--danger); font-weight: 600; }

/* ── Toggle spécialités ─────────────────────────────────────── */
.eds-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.eds-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-badge);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all .18s;
  user-select: none;
}
.eds-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.eds-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.eds-toggle .eds-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}
.eds-toggle.active .eds-check::after {
  content: '✓';
}

/* ── Badges statut ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: var(--radius-badge);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-attente {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}
.badge-valide {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.badge-refuse {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}
.badge-admin {
  background: var(--admin-gold);
  color: var(--admin);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Alertes / Bandeaux ─────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-card-sm);
  font-size: 0.9rem;
  line-height: 1.5;
  border: 1px solid;
}
.alert + .alert,
.alert + .card,
.card + .alert { margin-top: 1rem; }

.alert-error   { background: var(--error-bg);   border-color: var(--error-border);   color: var(--error); }
.alert-success { background: var(--success-bg);  border-color: var(--success-border); color: var(--success); }
.alert-warn    { background: var(--warn-bg);     border-color: var(--warn-border);    color: var(--warn); }
.alert-info    { background: var(--info-bg);     border-color: var(--info-border);    color: var(--info-text); }
.alert-admin   { background: var(--info-admin-bg); border-color: var(--info-admin-border); color: var(--info-admin-text); }

/* ── Tableau historique ─────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--radius-card-sm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  white-space: nowrap;
  background: var(--surface2);
  padding: .65rem 1rem;
  text-align: left;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.45;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-light); }

/* ── Numéro de question ─────────────────────────────────────── */
.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.question-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

/* ── Icône admin (accueil) ──────────────────────────────────── */
.admin-icon-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.1rem;
  transition: all .18s;
  box-shadow: var(--shadow-card);
  text-decoration: none;
  z-index: 50;
}
.admin-icon-btn:hover {
  background: var(--admin);
  border-color: var(--admin);
  color: white;
  text-decoration: none;
}

/* ── Force de mot de passe ──────────────────────────────────── */
.pwd-strength {
  display: flex;
  gap: .3rem;
  margin-top: .4rem;
}
.pwd-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--surface2);
  transition: background .25s;
}
.pwd-strength-bar.active-1 { background: var(--danger); }
.pwd-strength-bar.active-2 { background: var(--warn); }
.pwd-strength-bar.active-3 { background: #e6a800; }
.pwd-strength-bar.active-4 { background: var(--success); }

.pwd-rules {
  margin-top: .5rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.pwd-rules li {
  list-style: none;
  padding: .1rem 0;
}
.pwd-rules li.ok  { color: var(--success); }
.pwd-rules li.ok::before  { content: '✓ '; }
.pwd-rules li::before { content: '○ '; }

/* ── Section titres ─────────────────────────────────────────── */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
}

/* ── Séparateur ─────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── Texte de présentation ──────────────────────────────────── */
.presentation-text {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-card-sm);
  padding: 1rem 1.25rem;
  color: var(--info-text);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Bandeau période fermée ─────────────────────────────────── */
.periode-fermee {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-card-sm);
  padding: 1rem 1.25rem;
  color: var(--warn);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ── Validation details ─────────────────────────────────────── */
.validation-detail {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: 0.85rem;
}
.validation-detail .prof-name {
  font-weight: 500;
}
.validation-detail .commentaire {
  color: var(--muted);
  font-style: italic;
}
.validation-detail .date-val {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Formulaire de validation prof ─────────────────────────── */
.validation-form {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: .75rem;
  background: var(--surface2);
  border-radius: var(--radius-card-sm);
  margin-top: .5rem;
}
.validation-form .btn-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.validation-form textarea {
  min-height: 60px;
  font-size: 0.88rem;
}

/* ── Stats admin ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.stat-box .stat-num {
  font-size: 1.8rem;
  display: block;
}
.stat-box .stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: .25rem;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.site-footer .signature {
  font-family: 'Arizonia', cursive;
  font-size: 20px;
  letter-spacing: 0.05em;
  display: block;
  margin-top: .5rem;
}

/* ── Accueil ────────────────────────────────────────────────── */
.home-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}
.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-card);
  max-width: 500px;
  width: 100%;
  text-align: center;
}
.home-card h1 {
  font-size: 1.6rem;
  margin-bottom: .5rem;
}
.home-card .subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 2.5rem;
}
.home-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.home-buttons .btn {
  min-width: 160px;
  font-size: 1.05rem;
  padding: 1rem 1.5rem;
}

/* ── Connexion ──────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-card);
  max-width: 440px;
  width: 100%;
}
.login-card h1 {
  font-size: 1.3rem;
  margin-bottom: .25rem;
}
.login-card .login-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
}

/* ── Filtre admin ───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.filter-bar select {
  width: auto;
  font-size: 0.88rem;
  padding: .45rem .75rem;
}

/* ============================================================
   RESPONSIVE — max-width: 768px
   ============================================================ */
@media (max-width: 768px) {
  .logo { font-size: 1rem; }

  .site-header { padding: .75rem 1rem; }

  .page-wrapper { padding: 1.25rem 1rem; }

  .card { padding: 1.25rem; }

  .home-card { padding: 2rem 1.25rem; }
  .home-buttons { flex-direction: column; }
  .home-buttons .btn { min-width: unset; width: 100%; }

  .login-card { padding: 1.75rem 1.25rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-box .stat-num { font-size: 1.3rem; }

  table { font-size: 0.82rem; }
  th, td { padding: .5rem .65rem; }

  .eds-toggle { font-size: 0.82rem; padding: .45rem .85rem; }

  .filter-bar { gap: .4rem; }

  .badge-admin { font-size: 0.68rem; }
}
