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

:root {
  --bg: #0a0a0f;
  --bg2: #13131a;
  --bg3: #1c1c28;
  --border: #2a2a3d;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --accent-light: rgba(108, 99, 255, 0.12);
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

/* SIDEBAR */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px 20px;
  gap: 8px;
  z-index: 100;
}

.nav-logo img {
  max-width: 140px;
  max-height: 60px;
  object-fit: contain;
  margin-bottom: 24px;
}

/* NAV MENU */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.nav-spacer {
  flex: 1;
}

.nav-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.nav-actions .btn {
  width: 100%;
  justify-content: flex-start;
}

.nav-bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.nav-bottom-row .btn {
  flex: 1;
}

.lang-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}

.lang-select:focus { border-color: var(--accent); }

/* MAIN CONTENT WITH SIDEBAR */
.with-sidebar {
  margin-left: 220px;
  min-height: 100vh;
}

/* PAGE GÉNÉRIQUE */
.page {
  padding: 40px;
}

.page h1 { font-size: 1.8rem; margin-bottom: 8px; }
.page p.subtitle { color: var(--text-muted); margin-bottom: 32px; }

.page-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.95rem;
  gap: 12px;
}

.page-placeholder span { font-size: 2.5rem; }

/* BUTTONS */
.btn {
  padding: 9px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.18s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

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

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--error);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

/* CARD */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}

/* CENTER LAYOUT */
.center-layout {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 65px);
  padding: 32px 16px;
}

.form-card {
  width: 100%;
}

.form-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 460px;
}

.form-logo {
  max-width: 160px;
  max-height: 80px;
  object-fit: contain;
  margin-bottom: 20px;
}

.form-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-card p.subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 28px;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input.error { border-color: var(--error); }

.form-submit {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  font-size: 1rem;
}

/* PASSWORD STRENGTH */
.password-strength {
  display: flex;
  gap: 6px;
  margin-top: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, max-height 0.2s ease, margin-top 0.2s ease;
  pointer-events: none;
}

.password-strength.visible {
  margin-top: 8px;
  max-height: 20px;
  opacity: 1;
  pointer-events: auto;
}

.strength-segment {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  transition: background 0.3s ease;
}

.strength-segment.weak   { background: #ef4444; }
.strength-segment.medium { background: #f59e0b; }
.strength-segment.strong { background: #22c55e; }

.strength-label {
  font-size: 0.78rem;
  margin-top: 0;
  max-height: 0;
  overflow: hidden;
  color: var(--text-muted);
  transition: color 0.3s, max-height 0.2s ease, margin-top 0.2s ease;
  line-height: 1;
}

.strength-label.visible {
  margin-top: 5px;
  max-height: 20px;
}

/* PASSWORD WRAPPER */
.input-wrapper {
  position: relative;
}

.input-wrapper input {
  padding-right: 42px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.toggle-password:hover { color: var(--text); }

/* CHECKBOX */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: 4px;
}

.checkbox-group label {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.form-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.form-footer a:hover { text-decoration: underline; }

/* ALERT */
.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

/* CONFIRMATION PAGE */
.confirm-card {
  text-align: center;
  max-width: 500px;
}

.confirm-icon {
  width: 72px;
  height: 72px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 2rem;
}

.confirm-card h1 { font-size: 1.5rem; margin-bottom: 12px; }
.confirm-card p { color: var(--text-muted); line-height: 1.6; margin-bottom: 8px; }

/* DASHBOARD */
.dashboard {
  padding: 40px 40px;
}

.dashboard h1 { font-size: 1.8rem; margin-bottom: 8px; }
.dashboard p { color: var(--text-muted); }

/* ADMIN PANEL */
.admin-panel {
  padding: 40px 40px;
}

.admin-panel h1 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.admin-panel .subtitle {
  color: var(--text-muted);
  margin-bottom: 28px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.users-table th {
  text-align: left;
  padding: 14px 18px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.users-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: rgba(255,255,255,0.02); }

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-attente { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-valide  { background: rgba(34,197,94,0.15);  color: var(--success); border: 1px solid rgba(34,197,94,0.3); }
.badge-admin   { background: rgba(108,99,255,0.15); color: var(--accent);  border: 1px solid rgba(108,99,255,0.3); }

/* ROLE SELECT */
.role-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

.role-select:focus { border-color: var(--accent); }

/* SPINNER */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* PAGE TRANSITIONS */
#app { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
