/* =====================================================================
   JCI Kélibia — Base partagée (site public, admin, espace membres)

   Direction : « Kélibia, côté port ». Les couleurs viennent de la ville :
   le blanc froid des murs à la chaux, le bleu profond des barques,
   le turquoise de la plage de Mansoura, le jaune des coques de pêche
   (réservé à l'action principale). Pas de dégradés, pas de verre dépoli,
   pas d'ombres décoratives.
   Typo : Plus Jakarta Sans (police officielle JCI) pour le latin,
   Reem Kufi (coufique géométrique) pour l'arabe et le grand mot قليبية.
   ===================================================================== */
:root {
  /* Palette */
  --chaux: #fbfcfc;        /* fond : blanc froid, pas crème */
  --brume: #e9f1f4;        /* sections alternées : brume de mer */
  --port: #0d3b66;         /* bleu des barques : titres, fonds forts */
  --port-2: #0a2e50;
  --jci: #0097d7;          /* bleu JCI : liens */
  --mansoura: #13a09a;     /* turquoise : états positifs, détails */
  --barque: #f2a93b;       /* or des projecteurs du fort : bouton principal uniquement */
  --nuit: #0b2a4a;         /* bleu nuit : le ciel au-dessus du fort */
  --encre: #13263a;        /* texte courant */
  --gris: #5b6b7a;         /* texte secondaire */
  --trait: #d5e0e6;        /* bordures */
  --ok: #13a09a;
  --warn: #c98a00;
  --danger: #c8372d;

  /* Anciennes variables conservées pour compatibilité */
  --ink: var(--port); --ink-2: var(--port-2); --ink-3: #164a7c;
  --blue: var(--jci); --blue-2: #3fb0e0; --teal: var(--mansoura);
  --ice: var(--brume); --paper: var(--chaux); --white: #fff;
  --text: var(--encre); --muted: var(--gris);
  --line: var(--trait); --line-dark: rgba(255, 255, 255, 0.18);
  --grad: var(--port);

  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 0 var(--trait);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Arabe : texte courant lisible (IBM Plex Sans Arabic), titres en coufique géométrique (Reem Kufi) */
  --font-ar: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-ar-display: "Reem Kufi", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--encre); background: var(--chaux); line-height: 1.6; font-size: 1.0625rem; -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { font-family: var(--font-ar); line-height: 1.8; }
/* L'arabe ne supporte pas l'espacement entre lettres (les lettres se détachent) */
[lang="ar"], [lang="ar"] * { letter-spacing: 0 !important; }
span[lang="ar"], p[lang="ar"], div[lang="ar"], [dir="rtl"] input, [dir="rtl"] textarea { font-family: var(--font-ar); }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--barque); color: var(--port); }
:focus-visible { outline: 3px solid var(--jci); outline-offset: 2px; }

h1, h2, h3, h4 { color: var(--port); line-height: 1.15; letter-spacing: -0.015em; font-weight: 700; }

/* ---------- Logo ---------- */
/* Logo officiel JCI (fichier vectoriel de jci.cc) + nom de l'organisation locale
   en dessous, aligné à gauche, en bleu JCI, comme le générateur officiel. */
.brand { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; line-height: 1; text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-lo { font-weight: 800; font-size: 0.92rem; color: var(--jci); letter-spacing: 0; padding-inline-start: 1px; }
.brand-lo-light { color: #3fb6ea; }
/* anciennes classes conservées pour compatibilité */




/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.8em 1.4em; border-radius: var(--radius); border: 2px solid var(--port);
  background: var(--port); color: #fff; font-weight: 700; font-size: 0.98rem;
  cursor: pointer; text-decoration: none; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--port-2); border-color: var(--port-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--barque); border-color: var(--barque); color: var(--port); }
.btn-primary:hover { background: #ffbe55; border-color: #ffbe55; }
.btn-ghost { background: transparent; color: var(--port); }
.btn-ghost:hover { background: var(--port); color: #fff; }



.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a92c23; border-color: #a92c23; }
.btn-sm { padding: 0.45em 0.9em; font-size: 0.86rem; }
  /* plus de flèches décoratives dans les boutons */

/* ---------- Champs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > label { font-size: 0.9rem; font-weight: 600; color: var(--encre); }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 0.75em 0.9em; border-radius: var(--radius-sm);
  border: 1.5px solid var(--trait); background: #fff; color: var(--encre); font-size: 1rem;
}
.field textarea { resize: vertical; min-height: 110px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--jci); box-shadow: 0 0 0 3px rgba(0, 151, 215, 0.18); }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
.field-err { display: block; margin-top: 5px; font-size: .82rem; line-height: 1.4; font-weight: 600; color: var(--danger); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 0.15em 0.6em; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 700; background: var(--brume); color: var(--port); }
.badge-ok { background: #dff3f1; color: #0b6f6a; }
.badge-warn { background: #fdf0c8; color: #7a5600; }
.badge-danger { background: #f9e0dd; color: #9c2a22; }
.badge-muted { background: #eef1f3; color: var(--gris); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 9999; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { padding: 13px 16px; border-radius: var(--radius); background: var(--port); color: #fff; font-weight: 600; font-size: 0.95rem; border-inline-start: 5px solid var(--mansoura); }
.toast-err { background: #fff; color: var(--danger); border: 1.5px solid var(--danger); border-inline-start-width: 5px; }
.toast.out { opacity: 0; transition: opacity 0.3s; }

/* ---------- Avatar ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brume); color: var(--port); display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Utilitaires ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--trait); border-top-color: var(--port); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Écran « Supabase non configuré » ---------- */
.setup-notice { max-width: 560px; margin: 12vh auto; padding: 32px; background: #fff; border: 1.5px solid var(--trait); border-radius: var(--radius); }
.setup-notice h2 { margin-bottom: 10px; }
.setup-notice code { background: var(--brume); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
