/* global.css */

:root {
  /* Couleurs de base */
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Textes & Fonds */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-page: #f8fafc;
  --bg-panel: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-soft: #eff6ff;
  --bg-danger-soft: #fef2f2;
  --bg-overlay: rgba(15, 23, 42, 0.6);
  --text-on-primary: #ffffff;
  --text-danger-soft: #f87171;
  --border-strong: #cbd5e1;
  --border-danger-soft: #fecaca;
  --focus-ring: rgba(37, 99, 235, 0.1);

  /* Bordures, Arrondis & Ombres */
  --border-light: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Alertes / badges (clair) — paramètres & blocs similaires */
  --alert-success-bg: #dcfce7;
  --alert-success-border: #86efac;
  --alert-success-text: #166534;
  --alert-error-bg: #fee2e2;
  --alert-error-border: #fca5a5;
  --alert-error-text: #991b1b;
  --invite-code-color: #1d4ed8;
  --badge-admin-bg: #dbeafe;
  --badge-admin-text: #1d4ed8;
}

/* 🛡️ RESET MOBILE UNIVERSEL */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}
body.no-scroll {
  overflow: hidden !important;
  height: 100vh !important;
}

/* === HEADER & NAVIGATION === */
.pf-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-light);
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.pf-logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.03em;
}
.pf-nav {
  display: flex;
  gap: 8px;
}
.pf-nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}
.pf-nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}
.pf-nav-link--active {
  background: var(--bg-soft);
  color: var(--primary);
}
.pf-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.pf-user-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pf-logout-btn {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.pf-logout-btn:hover {
  background: var(--bg-danger-soft);
  border-color: var(--border-danger-soft);
}
.pf-burger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-main);
}

/* === MENU MOBILE (Sidebar "Off-Canvas") === */
.pf-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.pf-mobile-overlay.is-visible {
  display: block;
  opacity: 1;
}

.pf-mobile-menu {
  position: fixed;
  top: 0;
  right: -300px;
  width: 280px;
  height: 100vh; /* Fallback (sécurité) */
  height: 100dvh;
  background: var(--bg-panel);
  box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
  z-index: 999;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 0;
  color: var(--text-main);
}

.pf-mobile-menu.is-open {
  right: 0; /* Le menu glisse dans l'écran */
}

.pf-mobile-menu-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-page);
}

.pf-mobile-close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.pf-mobile-menu-body {
  padding: 20px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
}

.pf-mobile-nav-link {
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-main);
  padding: 14px 16px; /* Plus large pour le tactile */
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.2s;
}

.pf-mobile-nav-link:active {
  background: var(--bg-subtle);
}

.pf-mobile-logout {
  color: var(--danger);
  background: var(--bg-danger-soft);
  margin-top: 10px;
}

.pf-mobile-menu-header .pf-logo,
body.pf-home .pf-mobile-menu-header .pf-logo {
  color: var(--primary);
}

/* Force la croix en gris, MÊME sur la page d'accueil */
.pf-mobile-close-btn,
body.pf-home .pf-mobile-close-btn {
  color: var(--text-muted);
}

.pf-mobile-close-btn:hover {
  color: var(--danger); /* Touche de rouge au survol */
}

/* === MAIN CONTENT & TYPOGRAPHY === */
.pf-main {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 20px;
}
.pf-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Bloc type « carte » (ex. paramètres) — suit le thème light/dark */
.pf-panel-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

/* ═══ Paramètres & petits blocs réutilisables ═══ */
.pf-settings-page {
  max-width: 680px;
  margin: 32px auto;
  padding: 0 16px;
}
.pf-settings-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--text-main);
}
.pf-card-h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-main);
}
.pf-card-h2--tight {
  margin-bottom: 6px;
}
.pf-muted-note {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.pf-muted-note.pf-muted-note--tight {
  margin-bottom: 8px;
}
.pf-muted-tiny {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.pf-muted-inline {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 6px;
}

.pf-alert {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 24px;
}
.pf-alert--success {
  background: var(--alert-success-bg);
  border: 1px solid var(--alert-success-border);
  color: var(--alert-success-text);
}
.pf-alert--error {
  background: var(--alert-error-bg);
  border: 1px solid var(--alert-error-border);
  color: var(--alert-error-text);
}

.pf-lang-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.pf-btn--current-lang {
  pointer-events: none;
}

.pf-stack-md {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.pf-stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- SÉLECTEUR DE COULEUR THÉMATIQUE (SETTINGS) --- */
.pf-color-picker-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.pf-input-color {
  /* On réduit la taille pour le rendre plus subtil */
  width: 36px;
  height: 36px;
  /* On enlève les marges/paddings par défaut */
  padding: 0;
  cursor: pointer;
  /* On le rend complètement rond, c'est plus moderne */
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  /* On cache le fond par défaut du navigateur */
  background: transparent;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
  transition: all 0.2s ease;
  /* Optionnel : masquer la bordure interne sur Chrome/Safari */
  -webkit-appearance: none;
}

/* On s'assure que le carré de couleur interne (Webkit) remplit tout et est rond */
.pf-input-color::-webkit-color-swatch-wrapper {
  padding: 0;
}
.pf-input-color::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Même chose pour Firefox */
.pf-input-color::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.pf-input-color:hover {
  border-color: #94a3b8;
  transform: scale(1.05);
}

.pf-color-picker-group .pf-muted-note {
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
  line-height: 1.4;
}

/* Tuile module (checkbox) — état coché via :has(), compatible thème */
.pf-module-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 2px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  background: var(--bg-page);
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.pf-module-tile:has(input:checked) {
  border-color: var(--primary);
  background: var(--bg-soft);
}

.pf-checkbox-lg {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.pf-tile-icon {
  font-size: 1.3rem;
  line-height: 1;
}
.pf-tile-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

/* Encadré pointillé (code d’invitation, etc.) */
.pf-dashed-panel {
  background: var(--bg-page);
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  padding: 20px;
}

.pf-home-bg-preview {
  margin-bottom: 16px;
  border-radius: 10px;
  overflow: hidden;
  max-height: 160px;
  position: relative;
}
.pf-home-bg-preview img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.pf-badge-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-overlay);
  color: var(--text-on-primary);
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
}

.pf-inline-form-end {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.pf-inline-form-end .pf-form-group {
  flex: 1;
  min-width: 200px;
}
.pf-shrink-0 {
  flex-shrink: 0;
}
.pf-mt-sm {
  margin-top: 10px;
}
.pf-btn-sm-text {
  font-size: 0.85rem;
}
.pf-mb-section {
  margin-bottom: 20px;
}

.pf-invite-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pf-invite-code {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--invite-code-color);
  cursor: pointer;
}
.pf-copy-msg {
  color: var(--success);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
}
.pf-copy-msg.is-visible {
  opacity: 1;
}
.pf-ml-auto {
  margin-left: auto;
}
.pf-invite-footnote {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pf-member-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-page);
  border-radius: 8px;
}
.pf-admin-badge {
  background: var(--badge-admin-bg);
  color: var(--badge-admin-text);
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 6px;
}
.pf-members-heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 20px 0 12px;
  color: var(--text-main);
}
.pf-settings-admin-link {
  text-align: center;
  margin-top: 8px;
}
.pf-settings-admin-link a {
  color: var(--primary);
  font-size: 0.9rem;
}

.pf-input--disabled-muted:disabled {
  background: var(--bg-page);
  color: var(--text-muted);
}

.pf-flag-inline {
  vertical-align: middle;
  border-radius: 2px;
  margin-right: 5px;
}

.pf-flex-gap-8 {
  display: flex;
  gap: 8px;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-main);
  line-height: 1.2;
}
p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* === COMPOSANTS GLOBAUX === */
.pf-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 32px;
}
.pf-module-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pf-module-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.pf-card-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}
.pf-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
.pf-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  flex: 1;
}
.pf-card-cta {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Boutons Standards */
.pf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: var(--text-on-primary);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  padding: 12px 24px;
  text-decoration: none;
}
.pf-btn:hover {
  background: var(--primary-dark);
}
.pf-btn.btn-secondary {
  background: var(--bg-panel);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}
.pf-btn.btn-secondary:hover {
  background: var(--bg-page);
  color: var(--text-main);
  border-color: var(--border-strong);
}

/* Formulaires & Inputs Standards */
.pf-form-group {
  margin-bottom: 20px;
}
.pf-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.pf-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg-page);
  color: var(--text-main);
  transition: all 0.2s;
  font-family: inherit;
  box-sizing: border-box;
}
.pf-input:focus {
  background: var(--bg-panel);
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Tableaux Standards */
.pf-table {
  width: 100%;
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.pf-table th {
  background: var(--bg-page);
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
.pf-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--bg-page);
  vertical-align: middle;
  font-size: 0.95rem;
}
.pf-table tbody tr:last-child td {
  border-bottom: none;
}
.pf-table tbody tr:hover {
  background-color: var(--bg-page);
}

/* === 🪟 LE DESIGN SYSTEM DES MODALES (Applicable partout) === */
.pf-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pf-modal.is-active,
.pf-modal.open {
  display: flex;
} /* Supporte tes deux syntaxes JS */

.pf-modal-content {
  background: var(--bg-panel);
  width: 100%;
  max-width: 500px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: pfModalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto;
}
.pf-modal-title {
  margin-top: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 15px;
  margin-bottom: 8px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  width: 100%;
  box-sizing: border-box;
}
.modal-footer .pf-btn {
  width: auto;
  min-width: 100px;
  padding: 10px 20px;
} /* Ajustement pour modale */

@keyframes pfModalPop {
  from {
    transform: scale(0.95) translateY(10px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* === FOOTER & TOASTS === */
.pf-footer {
  border-top: 1px solid var(--border-light);
  background: var(--bg-panel);
  padding: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}
.pf-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 24px;
  background: var(--bg-panel);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border-left: 5px solid var(--primary);
  z-index: 10000;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-weight: 600;
  color: var(--text-main);
}
.pf-toast.is-visible {
  transform: translateX(0);
}

/* === RESPONSIVE MOBILE === */
@media (max-width: 768px) {
  .pf-header {
    padding: 0 16px;
  }
  .pf-nav,
  .pf-header-actions {
    display: none;
  }
  .pf-burger-btn {
    display: block;
  }
  .pf-main {
    padding: 16px 10px;
  }
  .pf-mobile-nav-link {
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-main);
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
  }

  /* 📱 BOTTOM SHEET MODALES MOBILE */
  .pf-modal {
    align-items: center !important; /* On remet au centre */
    padding: 20px;
  }
  .pf-modal-content {
    width: 100% !important;
    max-width: none !important;
    border-radius: 20px !important; /* On garde les arrondis partout */
    transform: none !important;
    animation: pfModalPop 0.3s ease !important; /* On remet l'animation desktop */
    margin: auto !important;
  }
  .pf-modal-content::before {
    content: "";
    display: block;
    width: 40px;
    height: 5px;
    background: var(--border-strong);
    border-radius: 10px;
    margin: -10px auto 20px auto;
  }
  .modal-footer {
    flex-direction: column-reverse;
  }
  .modal-footer .pf-btn {
    width: 100%;
    margin-top: 8px;
  }

  @keyframes slideUpSheet {
    to {
      transform: translateY(0);
    }
  }
}

/* === BOUTONS D'ACTION ICÔNES UNIVERSELS (Édition / Suppression) === */
.btn-icon-action {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}
.btn-icon-action.edit {
  color: var(--primary);
}
.btn-icon-action.edit:hover {
  background: var(--bg-soft); /* Fond bleu très clair au survol */
}
.btn-icon-action.delete {
  color: var(--danger);
}
.btn-icon-action.delete:hover {
  background: var(--bg-danger-soft); /* Fond rouge très clair au survol */
}

/* === 13. PAGE DE CONNEXION (LOGIN) === */
.pf-login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 200px);
  padding: 20px;
}

.pf-login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  background: var(--bg-panel);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.pf-login-header {
  text-align: center;
  margin-bottom: 24px;
}

.pf-login-header .pf-login-icon {
  width: 60px; /* Tu peux ajuster cette valeur selon le rendu voulu */
  height: auto;
  margin-bottom: 15px;
  border-radius: 12px; /* Optionnel : ajoute un léger arrondi si ton favicon est carré */
}

.pf-login-header h1 {
  font-size: 1.8rem;
  margin: 0;
  color: var(--text-main);
}

.pf-login-header p {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 0.95rem;
}

.pf-login-error {
  background: var(--bg-danger-soft);
  color: var(--danger);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-danger-soft);
  margin-bottom: 20px;
  font-size: 0.9rem;
  text-align: center;
  font-weight: 600;
}

.pf-btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
  padding: 14px;
  font-size: 1.05rem;
}

/* --- Optimisation Login Mobile --- */
@media (max-width: 480px) {
  .pf-login-wrapper {
    padding: 0;
    align-items: flex-start; /* Aligné en haut pour laisser de la place au clavier */
    background: var(--bg-panel);
  }

  .pf-login-card {
    border-radius: 0; /* Supprime les arrondis pour un look plein écran */
    border: none;
    box-shadow: none;
    padding: 60px 24px;
    min-height: 100vh;
  }
}

/* ⚠️ IMPORTANT : Éviter le zoom auto sur iOS */
.pf-login-card .pf-input {
  font-size: 16px; /* En dessous de 16px, Safari iOS zoome automatiquement sur le champ */
  padding: 14px; /* Zone de clic plus large pour les doigts */
}

.pf-btn-block {
  padding: 16px; /* Bouton plus haut pour un appui facile au pouce */
  font-size: 1.1rem;
}

/* ══════════════════════════════════════════════════════════════
   DARK MODE — [data-theme="dark"] sur <html>
   ══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --text-main: #e6edf3;
  --text-muted: #8b949e;
  --bg-page: #0d1117;
  --bg-panel: #161b22;
  --border-light: #30363d;
  --shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --bg-subtle: rgba(255, 255, 255, 0.06);
  --bg-soft: rgba(59, 130, 246, 0.15);
  --bg-danger-soft: rgba(239, 68, 68, 0.1);
  --bg-overlay: rgba(0, 0, 0, 0.55);
  --text-danger-soft: #f87171;
  --border-strong: #484f58;
  --border-danger-soft: rgba(239, 68, 68, 0.3);
  --focus-ring: rgba(59, 130, 246, 0.25);
  --alert-success-bg: rgba(34, 197, 94, 0.12);
  --alert-success-border: rgba(34, 197, 94, 0.45);
  --alert-success-text: #86efac;
  --alert-error-bg: rgba(239, 68, 68, 0.12);
  --alert-error-border: rgba(248, 113, 113, 0.45);
  --alert-error-text: #fca5a5;
  --invite-code-color: #93c5fd;
  --badge-admin-bg: rgba(59, 130, 246, 0.2);
  --badge-admin-text: #93c5fd;
}
[data-theme="dark"] body {
  background: var(--bg-page);
  color: var(--text-main);
}
[data-theme="dark"] .pf-header {
  background: var(--bg-panel);
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-logo {
  color: var(--primary);
}
[data-theme="dark"] .pf-nav-link {
  color: var(--text-muted);
}
[data-theme="dark"] .pf-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}
[data-theme="dark"] .pf-nav-link--active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}
[data-theme="dark"] .pf-user-badge {
  color: var(--text-muted);
}
[data-theme="dark"] .pf-logout-btn {
  color: #f87171;
}
[data-theme="dark"] .pf-logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}
[data-theme="dark"] .pf-burger-btn {
  color: var(--text-main);
}
[data-theme="dark"] .pf-mobile-menu {
  background: var(--bg-panel);
  color: var(--text-main);
}
[data-theme="dark"] .pf-mobile-menu-header {
  background: var(--bg-page);
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-mobile-nav-link {
  color: var(--text-main);
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-mobile-nav-link:active {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .pf-module-card {
  background: var(--bg-panel);
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-module-card:hover {
  border-color: #484f58;
  box-shadow: var(--shadow);
}
[data-theme="dark"] .pf-card-title {
  color: var(--text-main);
}
[data-theme="dark"] .pf-card-desc {
  color: var(--text-muted);
}
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
  color: var(--text-main);
}
[data-theme="dark"] p {
  color: var(--text-muted);
}
[data-theme="dark"] .pf-btn.btn-secondary {
  background: var(--bg-panel);
  color: var(--text-muted);
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-btn.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: #484f58;
}
[data-theme="dark"] .pf-input {
  background: #1c2128;
  border-color: var(--border-light);
  color: var(--text-main);
}
[data-theme="dark"] .pf-input::placeholder {
  color: #484f58;
}
[data-theme="dark"] .pf-input:focus {
  background: #1c2128;
  border-color: var(--primary);
}
[data-theme="dark"] .pf-table {
  background: var(--bg-panel);
}
[data-theme="dark"] .pf-table th {
  background: #1c2128;
  color: var(--text-muted);
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-table td {
  border-color: rgba(48, 54, 61, 0.5);
  color: var(--text-main);
}
[data-theme="dark"] .pf-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}
[data-theme="dark"] .pf-modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
}
[data-theme="dark"] .pf-modal-title {
  border-color: var(--border-light);
  color: var(--text-main);
}
[data-theme="dark"] .modal-footer {
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-footer {
  background: var(--bg-panel);
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-toast {
  background: var(--bg-panel);
  color: var(--text-main);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .pf-login-card {
  background: var(--bg-panel);
  border-color: var(--border-light);
}
[data-theme="dark"] .pf-login-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}
[data-theme="dark"] .btn-icon-action.edit:hover {
  background: rgba(59, 130, 246, 0.15);
}
[data-theme="dark"] .btn-icon-action.delete:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ─── Pill toggle thème ────────────────────────────────────── */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 8px;
  transition: background 0.15s;
}
.theme-switch:hover {
  background: #f1f5f9;
}
[data-theme="dark"] .theme-switch:hover {
  background: rgba(255, 255, 255, 0.08);
}
.ts-sun,
.ts-moon {
  font-size: 0.85rem;
  line-height: 1;
  transition: opacity 0.2s;
  user-select: none;
}
[data-theme="dark"] .ts-sun {
  opacity: 0.3;
}
.ts-moon {
  opacity: 0.3;
}
[data-theme="dark"] .ts-moon {
  opacity: 1;
}
.ts-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: #cbd5e1;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 0.25s;
}
[data-theme="dark"] .ts-track {
  background: #2563eb;
}
.ts-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="dark"] .ts-thumb {
  transform: translateX(16px);
}

/* === ACCORDÉONS NATIFS (DETAILS/SUMMARY) === */
.pf-accordion {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}
.pf-accordion-summary {
  padding: 14px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none; /* Masque la flèche native Firefox/Chrome */
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-page);
  transition:
    background 0.2s,
    color 0.2s;
}
.pf-accordion-summary::-webkit-details-marker {
  display: none; /* Masque la flèche native Safari */
}
.pf-accordion-summary:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}
.pf-accordion-summary::after {
  content: "▼";
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}
details[open].pf-accordion > .pf-accordion-summary {
  border-bottom: 1px solid var(--border-light);
  color: var(--primary);
}
details[open].pf-accordion > .pf-accordion-summary::after {
  transform: rotate(-180deg);
}
.pf-accordion-content {
  padding: 16px;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Bouton Paramètres avec icône rotative (Roue crantée) */
.btn-settings-gear {
  background: transparent;
  border: none;
  box-shadow: none;
  outline: none;
  font-size: 1.4rem;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  line-height: 1;
  color: inherit;
}

.btn-settings-gear:hover {
  transform: rotate(
    90deg
  ); /* 90deg rend mieux sur une roue crantée qu'un 45deg ! */
}
