@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --border: #e2e0da;
  --text: #1a1916;
  --muted: #8a8780;
  --accent: #2d5be3;
  --accent-soft: #eef1fc;
  --danger: #e34040;
  --success: #27ae60;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,0.07);
}

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

html { font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ─── CARD ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.card-wide { max-width: 680px; }

/* ─── LOGO / HEADER ─── */
.site-header {
  text-align: center;
  margin-bottom: 36px;
}

.site-logo {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.site-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.site-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

/* ─── FORM ─── */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,91,227,0.12);
  background: var(--surface);
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover { background: #1f48c4; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }

/* ─── ALERTS ─── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error { background: #fef0f0; color: var(--danger); border: 1px solid #fad0d0; }
.alert-success { background: #f0faf4; color: var(--success); border: 1px solid #c3e6cb; }
.alert-info { background: var(--accent-soft); color: var(--accent); border: 1px solid #c7d4f7; }

/* ─── PROGRESS BAR (fun: inversée) ─── */
.progress-wrapper {
  margin-bottom: 24px;
}

.progress-label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* progress inversée = elle DIMINUE quand tu approches du bon mot de passe */
.progress-fill.inverted {
  background: linear-gradient(90deg, var(--success), var(--accent));
  float: right;
}

/* ─── MENU ─── */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 32px;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.18s;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.menu-item .icon {
  font-size: 22px;
  line-height: 1;
}

.menu-item .item-label {
  font-size: 14px;
  font-weight: 600;
}

.menu-item .item-desc {
  font-size: 12px;
  color: var(--muted);
}

.menu-item.admin-only {
  border-color: rgba(227,64,64,0.25);
  background: #fff8f8;
}

.menu-item.admin-only:hover { border-color: var(--danger); }

/* ─── NAV TOP ─── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.topnav-logo {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.topnav-right a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}

.topnav-right a:hover { background: var(--bg); color: var(--text); }

body.has-nav {
  align-items: flex-start;
  padding-top: 80px;
}

/* ─── PAGE CONTENT ─── */
.page-content {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.page-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.page-desc {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 32px;
}

/* ─── TABLE (admin) ─── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge-admin { background: #fef0f0; color: var(--danger); }
.badge-user { background: var(--accent-soft); color: var(--accent); }

/* ─── DIVIDER ─── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ─── FUN ELEMENTS ─── */
.curseur-custom { cursor: crosshair; }

.blink {
  animation: blink 1.2s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 520px) {
  .card { padding: 32px 20px; }
  .menu-grid { grid-template-columns: 1fr; }
}
