/* ============================================================
   Feuille de style du socle
   Reprise du design de List & Go (DM Sans, gris neutres, barre
   latérale sombre), sans les couleurs propres à ses modules.

   Pour personnaliser un nouveau projet, commencer par --accent.
   ============================================================ */

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

:root {
  /* Couleur principale du projet : boutons, liens, élément actif */
  --accent:      #3B82F6;
  --accent-deep: #1D4ED8;
  --accent-soft: #DBEAFE;

  --gray-50:  #FAFAFA;
  --gray-100: #F4F4F5;
  --gray-200: #E4E4E7;
  --gray-300: #D1D1D6;
  --gray-400: #A1A1AA;
  --gray-500: #71717A;
  --gray-600: #52525B;
  --gray-700: #3F3F46;
  --gray-800: #27272A;
  --gray-900: #18181B;

  --green-50:  #F0FDF4;
  --green-600: #16A34A;
  --amber-50:  #FFFBEB;
  --amber-600: #D97706;
  --red-50:  #FEF2F2;
  --red-200: #FECACA;
  --red-500: #EF4444;
  --red-600: #DC2626;

  --font-sans:  'DM Sans', system-ui, sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;

  --radius:    10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);

  --sidebar-width: 64px;
  --bottom-bar-height: 64px;
}

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

body {
  font-family: var(--font-sans);
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
h1, h2, h3 { font-weight: 600; }

/* ── Icônes SVG (fichiers de app/static/icons/ui) ─────────────────────────── */
.icon { width: 20px; height: 20px; display: block; flex-shrink: 0; }

/* ── Structure générale ───────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0;
  z-index: 100;
}
.sidebar-brand {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: white; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  margin-bottom: 14px;
}
.sidebar-divider { width: 32px; height: 1px; background: rgba(255,255,255,.08); margin-bottom: 14px; }
.sidebar-spacer { flex: 1; }
.sidebar-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06); width: 48px;
}
.sidebar-item {
  position: relative;
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
  background: none; border: none; cursor: pointer;
  text-decoration: none;
  transition: background var(--t, .15s);
}
.sidebar-item .icon { filter: invert(1); opacity: .5; transition: opacity .15s; }
.sidebar-item:hover { background: rgba(255,255,255,.06); }
.sidebar-item:hover .icon { opacity: .85; }
.sidebar-item.active { background: rgba(255,255,255,.10); box-shadow: inset 2px 0 0 var(--accent); }
.sidebar-item.active .icon { opacity: 1; }
.sidebar-tooltip {
  position: absolute; left: 52px; top: 50%; transform: translateY(-50%);
  background: var(--gray-800); color: white;
  font-size: 11px; font-weight: 500; white-space: nowrap;
  padding: 5px 10px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
  box-shadow: var(--shadow-md); z-index: 200;
}
.sidebar-item:hover .sidebar-tooltip { opacity: 1; }

.main { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: var(--font-serif); font-size: 19px; font-weight: 400; }
.topbar-subtitle { font-size: 11px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.notif-bell {
  position: relative;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.notif-bell:hover { background: var(--gray-200); }
.notif-bell .icon { opacity: .6; }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red-500); border: 1.5px solid white;
}

.content { flex: 1; padding: 24px; }
.container { max-width: 640px; margin: 0 auto; }
.container-wide { max-width: 960px; margin: 0 auto; }

/* ── Barre du bas (mobile) ────────────────────────────────────────────────── */
.bottom-bar { display: none; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom)); }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .bottom-bar {
    display: flex; justify-content: space-around; align-items: center;
    position: fixed; inset: auto 0 0 0;
    height: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: white; border-top: 1px solid var(--gray-200);
    z-index: 100;
  }
}
.bottom-bar-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 14px;
  color: var(--gray-400); text-decoration: none;
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
}
.bottom-bar-item .icon { width: 22px; height: 22px; opacity: .45; }
/* Raccourcis choisis : un emoji à la place de l'icône dessinée */
.nav-emoji { display: inline-flex; align-items: center; justify-content: center; font-size: 19px; line-height: 1; filter: grayscale(1); }
.active > .nav-emoji { filter: none; }
/* Les libellés de raccourcis peuvent être longs (« Cotisations du club ») */
.bottom-bar-item { flex: 1 1 0; min-width: 0; padding-left: 4px; padding-right: 4px; }
.bottom-bar-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-bar-item.active { color: var(--gray-900); }
.bottom-bar-item.active .icon { opacity: 1; }
.bottom-bar-item.active::before {
  content: ''; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}

/* ── Boutons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: none;
  font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-dark    { background: var(--gray-900); color: white; }
.btn-dark:hover { background: var(--gray-700); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-outline { background: white; color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-danger  { background: var(--red-500); color: white; }
.btn-danger:hover { background: var(--red-600); }
.btn-ghost-danger { background: white; color: var(--red-500); border: 1.5px solid var(--red-200); }
.btn-ghost-danger:hover { background: var(--red-50); }
.btn-link { background: none; border: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.btn-sm   { padding: 6px 12px; font-size: 12px; }
.btn-lg   { padding: 12px 22px; font-size: 14px; }
.btn-full { width: 100%; }

/* ── Cartes ───────────────────────────────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 24px; }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.card-title { font-family: var(--font-serif); font-size: 18px; font-weight: 400; }
.card-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.stack > * + * { margin-top: 16px; }

/* ── Formulaires ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.form-hint  { font-size: 12px; color: var(--gray-400); margin-top: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  background: white; color: var(--gray-900);
  font-family: var(--font-sans);
  font-size: 16px;  /* 16px minimum : sinon iOS zoome sur le champ */
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-textarea { resize: vertical; min-height: 96px; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-input::placeholder { color: var(--gray-300); }
.form-input-code { font-size: 26px; letter-spacing: 10px; text-align: center; font-weight: 600; }
.form-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--gray-600); line-height: 1.5; cursor: pointer; }
.form-check input { margin-top: 3px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row > .form-input { flex: 1; min-width: 180px; }

/* ── Messages ─────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }
.alert-error   { background: var(--red-50);   color: #991B1B; border: 1px solid var(--red-200); }
.alert-success { background: var(--green-50); color: #166534; border: 1px solid #BBF7D0; }
.alert-info    { background: #EFF6FF;         color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-warning { background: var(--amber-50); color: #92400E; border: 1px solid #FDE68A; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  white-space: nowrap;
}
.badge-accent  { background: var(--accent-soft); color: var(--accent-deep); }
.badge-neutral { background: var(--gray-100);    color: var(--gray-600); }
.badge-success { background: var(--green-50);    color: var(--green-600); }
.badge-danger  { background: var(--red-50);      color: var(--red-600); }

/* ── Listes de lignes (membres, notifications, utilisateurs...) ───────────── */
.row-list > .row { border-bottom: 1px solid var(--gray-100); }
.row-list > .row:last-child { border-bottom: none; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 500; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; }
.row-meta  { font-size: 12px; color: var(--gray-400); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Logo d'une structure : carré arrondi (les personnes sont rondes) */
.avatar.entity-logo { border-radius: 22%; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
/* Fiche publique : coordonnées, une par ligne, l'adresse garde ses retours à la ligne */
.contact-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; margin: 0; }
.contact-list dt { font-size: 18px; line-height: 1.4; }
.contact-list dd { margin: 0; overflow-wrap: anywhere; }
.contact-list .address { white-space: pre-line; }
.welcome-avatar { display: flex; justify-content: center; margin-bottom: 16px; }
/* Champ fichier invisible mais accessible au clavier : c'est son <label>,
   stylé en bouton, que l'on voit. */
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-input:focus-visible + .btn { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Titres de section ────────────────────────────────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 700; color: var(--gray-500);
  letter-spacing: .07em; text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── Onglets ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--gray-200); border-radius: var(--radius); margin-bottom: 16px; overflow-x: auto; }
.tab {
  flex: 1; white-space: nowrap;
  padding: 8px 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--gray-500);
  font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  text-align: center; text-decoration: none; cursor: pointer;
}
.tab.active { background: white; color: var(--gray-900); box-shadow: var(--shadow-sm); }
@media (max-width: 480px) {
  .tabs { flex-wrap: wrap; overflow: visible; }
  .tab  { flex: 1 1 30%; }
}

/* ── Interrupteur (préférences) ───────────────────────────────────────────── */
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--gray-300); border-radius: 26px; transition: background .2s;
}
.switch-slider::before {
  content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: white; border-radius: 50%; transition: transform .2s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch-slider { background: var(--green-600); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.switch input:disabled + .switch-slider { opacity: .5; cursor: not-allowed; }

/* ── État vide ────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--gray-400); }
.empty-state-icon  { font-size: 40px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-state-text  { font-size: 13px; }

/* ── Pages de connexion / inscription ─────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-box  { width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 14px; background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
}
.auth-title    { font-family: var(--font-serif); font-size: 26px; font-weight: 400; }
.auth-subtitle { font-size: 14px; color: var(--gray-500); margin-top: 6px; line-height: 1.5; }
.auth-footer   { text-align: center; margin-top: 18px; font-size: 13px; color: var(--gray-500); }
.auth-footer a { font-weight: 600; text-decoration: none; }

/* Arbre des entités : chaque niveau décalé, un trait relie les enfants au parent */
.entity-tree { list-style: none; margin: 0; padding: 0; }
.entity-tree .entity-tree { margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--gray-200); }
.entity-node { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 0; color: inherit; text-decoration: none; }
.entity-node:hover .entity-name { text-decoration: underline; }
.entity-node.is-pending { opacity: .65; }
.entity-name { font-weight: 600; }

/* Registre : tableau qui défile horizontalement sur petit écran */
.table-scroll { overflow-x: auto; }
.registry-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.registry-table th, .registry-table td { text-align: left; padding: 9px 14px; border-top: 1px solid var(--gray-100); white-space: nowrap; }
.registry-table th { font-size: 12px; font-weight: 600; color: var(--gray-500); border-top: none; }
.registry-table td a { font-weight: 600; text-decoration: none; }

/* Fiche membre : un bloc par club, séparés par un trait */
.link-form + .link-form { border-top: 1px solid var(--gray-100); padding-top: 16px; }

/* <summary> sans triangle : en bouton (« + Ajouter un grade ») ou en lien discret (« Modifier ») */
summary.btn, summary.summary-link { list-style: none; cursor: pointer; }
summary.btn::-webkit-details-marker, summary.summary-link::-webkit-details-marker { display: none; }
summary.btn { display: inline-flex; }
.summary-link { font-size: 12px; color: var(--gray-500); text-decoration: underline; }
details[open] > summary.summary-link { color: var(--gray-900); }

/* Sélecteur de langue : la langue active est grisée, les autres sont des liens */
.lang-switcher { display: inline-flex; gap: 12px; font-size: 13px; }
.lang-switcher .btn-link { color: var(--gray-500); font-weight: 500; }
.lang-switcher .btn-link.active { color: var(--gray-900); font-weight: 700; cursor: default; }

.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.icon-option { position: relative; }
.icon-option input { position: absolute; opacity: 0; }
.icon-option span {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 20px; border-radius: 8px; border: 2px solid var(--gray-200); cursor: pointer;
}
.icon-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.icon-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Accueil : grille de modules ──────────────────────────────────────────── */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.module-card {
  display: block; padding: 18px;
  background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--gray-300); }
.module-icon {
  width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: var(--accent-soft);
}
.module-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.module-desc { font-size: 12px; color: var(--gray-500); line-height: 1.45; }

/* ── Pages publiques (mentions légales...) ────────────────────────────────── */
.prose { font-size: 15px; line-height: 1.7; color: var(--gray-700); }
.prose h1 { font-family: var(--font-serif); font-weight: 400; font-size: 30px; color: var(--gray-900); margin-bottom: 8px; }
.prose h2 { font-size: 18px; color: var(--gray-900); margin: 28px 0 8px; }
.prose p, .prose ul { margin-bottom: 12px; }
.prose ul { padding-left: 22px; }
.todo-marker { background: #FEF9C3; padding: 0 4px; border-radius: 4px; }

/* ── HTMX ─────────────────────────────────────────────────────────────────── */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-swapping { opacity: 0; transition: opacity .2s; }

/* ── Utilitaires ──────────────────────────────────────────────────────────── */
.text-muted { color: var(--gray-500); }
.text-small { font-size: 12px; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.inline { display: inline; }
.hidden { display: none !important; }

/* ── Agenda : pavé de date à gauche d'un événement ────────────────────────── */
.date-block {
  width: 44px; flex-shrink: 0; align-self: flex-start; text-align: center;
  border-radius: 10px; background: var(--gray-100); padding: 6px 0; line-height: 1.1;
}
.date-block-day { display: block; font-size: 18px; font-weight: 700; color: var(--gray-900); }
.date-block-month { display: block; font-size: 11px; text-transform: uppercase; color: var(--gray-500); }
/* Stages auxquels la personne a répondu : liseré à gauche */
.row-mine { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; margin-left: -10px; border-radius: 4px; }
