/* base.css : variables, reset et composants génériques partagés par toutes les pages. */

:root {
  --bg: #1b1b1d;
  --panel: #232326;
  --red: #e3242b;
  --red-dark: #a81c22;
  --white: #f2f2f2;
  --muted: #8a8a8e;
  --border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--white);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Fond anime (canvas), utilise seulement sur les pages qui le chargent */
#network-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem;
}

.page-main {
  padding: 3rem 0;
  flex: 1;
}

.page-main h1 {
  margin: 0 0 0.75rem;
  font-size: 1.6rem;
}

/* --- Boutons / liens génériques --- */
.btn-outline {
  border: 1px solid rgba(227, 36, 43, 0.7);
  border-radius: 999px;
  padding: 0.55rem 1.4rem;
  font-size: 0.9rem;
  transition: background 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  cursor: pointer;
  color: var(--white);
  font-family: inherit;
}

.btn-outline:hover {
  background: rgba(227, 36, 43, 0.1);
}

.btn-primary {
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-primary:hover {
  background: var(--red-dark);
}

.btn-danger {
  border: 1px solid rgba(227, 36, 43, 0.5);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  background: none;
  color: var(--red);
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-danger:hover {
  background: rgba(227, 36, 43, 0.12);
}

/* --- Panneau / carte générique --- */
.card {
  background: rgba(35, 35, 38, 0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
}

.center-page {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

/* --- Badges / alertes --- */
.badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(227, 36, 43, 0.5);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.flash-error,
.flash-success {
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.flash-error {
  background: rgba(227, 36, 43, 0.12);
  border: 1px solid rgba(227, 36, 43, 0.4);
  color: var(--white);
}

.flash-success {
  background: rgba(60, 180, 100, 0.12);
  border: 1px solid rgba(60, 180, 100, 0.4);
  color: var(--white);
}

/* --- Composants partages entre modules (table, meta, grille de permissions/roles) : definis
   ici pour que toute page les utilisant s'affiche correctement meme sans charger staff.css ou
   rapports.css en plus de son propre fichier ($pageCss). --- */
.staff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.staff-table th,
.staff-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.staff-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.staff-table .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dept-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.dept-empty {
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
}

.permission-item {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem !important;
  color: var(--white) !important;
  cursor: help;
  margin-bottom: 0 !important;
}

.permission-item:has(input:disabled) {
  color: var(--muted) !important;
}

.rapport-choix-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.rapport-choix-item {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400 !important;
  font-size: 0.88rem !important;
}

.rapport-echelle {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.rapport-echelle-item {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-weight: 400 !important;
  font-size: 0.85rem !important;
}

.required {
  color: var(--red);
}

.back-link {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.75rem;
}

.back-link a {
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--muted);
}

/* --- Formulaires génériques (staff, futurs modules) --- */
.field {
  margin-bottom: 1.1rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--white);
  font-size: 0.85rem;
}

.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  color: var(--white);
  font-size: 0.9rem;
  font-family: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(227, 36, 43, 0.6);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.field-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.field-row .field {
  flex: 1 1 200px;
}
