/* ============================================================
   STYLE.CSS — Générateur d'appréciations v2
   ============================================================ */

:root {
  --paper:        #FAF7F0;
  --paper-line:   #E5DFD0;
  --ink:          #2D2A26;
  --ink-soft:     #6B6358;
  --pencil:       #8B6F47;
  --pencil-soft:  #E9DFCC;
  --green:        #4A6B5A;
  --green-soft:   #DCE6E0;
  --red:          #C4543C;
  --red-soft:     #F3E0DA;
  --orange:       #C47A3C;
  --orange-soft:  #F3E8DA;
  --radius:       10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Navigation ---- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--paper-line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  font-family: 'Alfa Slab One', serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
}
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--ink); font-weight: 600; }

.nav-user {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.nav-logout {
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 5px 12px;
  border: 1.5px solid var(--paper-line);
  border-radius: 6px;
}
.nav-logout:hover { border-color: var(--pencil); color: var(--ink); }

/* ---- Layout ---- */
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 4px;
}

.page-sub {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}

/* ---- Cards ---- */
.card {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(45,42,38,0.04);
}

/* ---- Auth ---- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
  padding: 24px 20px;
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-brand h1 {
  font-family: 'Alfa Slab One', serif;
  font-size: 38px;
  font-weight: 400;
  margin: 0 0 8px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.auth-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

.auth-card {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(45,42,38,0.06);
  overflow: hidden;
}

.tab-row {
  display: flex;
  border-bottom: 1px solid var(--paper-line);
}

.tab {
  flex: 1;
  text-align: center;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.12s;
}

.tab.active {
  color: var(--ink);
  border-bottom: 2px solid var(--pencil);
  margin-bottom: -1px;
}

.auth-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Champs ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select, textarea {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 10px 12px;
  border: 1.5px solid var(--paper-line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}

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

.row-2 {
  display: flex;
  gap: 14px;
}
.row-2 .field { flex: 1; }

.row-4 {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.row-4 .field { flex: 1; min-width: 120px; }
.row-4 .field-sm { flex: 0 0 100px; }

/* ---- Boutons ---- */
.btn-primary {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn-primary:hover { background: var(--pencil); }

.btn-sm { padding: 8px 16px; font-size: 13px; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--paper-line);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.btn-secondary:hover { border-color: var(--pencil); }

.btn-generate {
  width: 100%;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 15px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s, transform 0.08s;
  margin-bottom: 20px;
}
.btn-generate:hover:not(:disabled) { background: var(--pencil); }
.btn-generate:active:not(:disabled) { transform: scale(0.99); }
.btn-generate:disabled {
  background: var(--paper-line);
  color: var(--ink-soft);
  cursor: not-allowed;
}

.btn-delete {
  background: transparent;
  border: none;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}
.btn-delete:hover { text-decoration: underline; }

.add-btn {
  background: var(--paper);
  border: 1.5px solid var(--paper-line);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.add-btn:hover { border-color: var(--pencil); color: var(--ink); }

/* ---- Labels / Hints ---- */
.section-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  display: block;
  margin-bottom: 14px;
}

.hint {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 400;
}

code {
  font-family: monospace;
  background: var(--pencil-soft);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* ---- Adjectifs ---- */
.adj-group {
  margin-bottom: 14px;
}

.adj-group-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.adjectives {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.chip {
  display: inline-flex;
  border: 1.5px solid var(--paper-line);
  background: var(--paper);
  color: var(--ink-soft);
  padding: 7px 14px;
  margin: 3px 4px 3px 0;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
}
.chip:hover { border-color: var(--pencil); color: var(--ink); }
.chip.active {
  background: var(--pencil);
  border-color: var(--pencil);
  color: #fff;
}

.custom-adj {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.custom-adj input { flex: 1; }

/* ---- Sélecteur de ton ---- */
.tone-options {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-top: 4px;
}

.tone-options::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 13px;
  right: 13px;
  height: 2px;
  background: var(--paper-line);
}

.tone-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  flex: 1;
}

.tone-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--paper-line);
  transition: all 0.15s;
}

.tone-opt span {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.3;
}

.tone-opt.active span { color: var(--ink); font-weight: 700; }

.tone-opt[data-tone="tres-encourageant"].active .tone-dot { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.tone-opt[data-tone="encourageant"].active .tone-dot { border-color: #6B9A7A; background: #6B9A7A; box-shadow: 0 0 0 4px #ddeee4; }
.tone-opt[data-tone="neutre"].active .tone-dot { border-color: var(--pencil); background: var(--pencil); box-shadow: 0 0 0 4px var(--pencil-soft); }
.tone-opt[data-tone="ferme"].active .tone-dot { border-color: var(--orange); background: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.tone-opt[data-tone="exigeant"].active .tone-dot { border-color: var(--red); background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

/* ---- Résultat ---- */
.result-card {
  border: 1.5px solid var(--pencil-soft);
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  display: none;
  position: relative;
  overflow: hidden;
}
.result-card.visible { display: block; }

.result-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
}

.result-card.tone-tres-encourageant::before { background: var(--green); }
.result-card.tone-encourageant::before      { background: #6B9A7A; }
.result-card.tone-neutre::before            { background: var(--pencil); }
.result-card.tone-ferme::before             { background: var(--orange); }
.result-card.tone-exigeant::before          { background: var(--red); }

.result-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 14px;
}

.result-text {
  font-family: 'Fraunces', serif;
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 20px;
  min-height: 60px;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-btn {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s;
}
.copy-btn:hover { background: #a8442f; }

.regen-btn {
  background: transparent;
  border: 1.5px solid var(--paper-line);
  color: var(--ink-soft);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.regen-btn:hover { border-color: var(--pencil); color: var(--ink); }

.copy-confirm {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s;
}
.copy-confirm.show { opacity: 1; }

/* ---- Alertes ---- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
}
.alert-error   { background: var(--red-soft); color: var(--red); }
.alert-success { background: var(--green-soft); color: var(--green); }

/* ---- Tableau élèves ---- */
.eleves-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.eleves-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 10px 10px 0;
  border-bottom: 1.5px solid var(--paper-line);
}

.eleves-table td {
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid var(--paper-line);
  vertical-align: middle;
}

.eleves-table tr:last-child td { border-bottom: none; }

.notes-cell {
  color: var(--ink-soft);
  font-size: 13px;
  max-width: 200px;
}

/* ---- Import CSV ---- */
.csv-form {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.link-dl {
  display: inline-block;
  font-size: 13px;
  color: var(--pencil);
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 10px;
}
.link-dl:hover { text-decoration: underline; }

/* ---- Inline form ---- */
.inline-form { display: flex; flex-direction: column; gap: 0; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-soft);
}
.empty-state p { margin: 0 0 20px; font-size: 15px; }

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .topnav { padding: 0 16px; }
  .wrap { padding: 24px 16px 60px; }
  .row-2, .row-4 { flex-direction: column; }
  .tone-opt span { font-size: 11px; }
  .result-text { font-size: 17px; }
  .page-header { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

:focus-visible {
  outline: 2px solid var(--pencil);
  outline-offset: 2px;
}
