/* ══════════════════════════════════════════════════════
   css/style.css — Styles principaux MKA Burkina Faso
   Portail Officiel — Compatible Cloudflare Pages
   ══════════════════════════════════════════════════════ */

/* ── Variables CSS ───────────────────────────────────── */
:root {
  --gold:       #c6973f;
  --gold-d:     #a87830;
  --gold-l:     #e8c87a;
  --ink:        #1a1a2e;
  --ink-l:      #2d2d4e;
  --bg:         #f8f7f2;
  --bg-card:    #ffffff;
  --border:     #e8e4d8;
  --text-m:     #555566;
  --text-l:     #888899;
  --red:        #8b1a1a;
  --green:      #1a5c2e;
  --shadow:     0 2px 12px rgba(26,26,46,.08);
  --shadow-lg:  0 8px 32px rgba(26,26,46,.14);
  --radius:     12px;
  --radius-sm:  8px;
}

/* ── Reset & Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Utilitaires ─────────────────────────────────────── */
.hidden { display: none !important; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text-l); }

.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Boutons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: 1px solid transparent;
  transition: all .18s;
}
.btn-primary  { background: var(--ink); color: var(--gold); border-color: var(--ink); }
.btn-primary:hover { background: var(--gold); color: var(--ink); }
.btn-gold     { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: var(--gold-d); }
.btn-outline  { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-sm       { padding: 5px 10px; font-size: 11px; }

/* ── Formulaires ─────────────────────────────────────── */
.fg { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.fg label { font-size: 11px; font-weight: 600; color: var(--text-m); text-transform: uppercase; letter-spacing: .04em; }
.fg input, .fg select, .fg textarea {
  padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  background: var(--bg); color: var(--ink);
  transition: border .18s;
  width: 100%;
}
.fg input:focus, .fg select:focus, .fg textarea:focus {
  outline: none; border-color: var(--gold);
}
.fr2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Messages ─── */
.err-box {
  background: rgba(139,26,26,.06); border: 1px solid rgba(139,26,26,.15);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12px; color: var(--red);
}
.ok-box {
  background: rgba(26,92,46,.06); border: 1px solid rgba(26,92,46,.15);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12px; color: var(--green);
}
.info-box {
  background: rgba(198,151,63,.08); border: 1px solid rgba(198,151,63,.2);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12px; color: var(--gold-d);
}

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff;
  padding: 10px 20px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  transition: transform .25s; z-index: 9999;
  pointer-events: none; white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Overlay / Modal générique ───────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1000;
  align-items: center; justify-content: center;
}
.overlay.open { display: flex; }
.modal {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 24px; max-width: 560px; width: 92%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

/* ══════════════════════════════════════════════════════
   PAGE PUBLIQUE
   ══════════════════════════════════════════════════════ */

/* ── Navbar publique ────────────────────────────────── */
.pub-nav {
  position: sticky; top: 0; z-index: 200;
  background: var(--ink); border-bottom: 1px solid rgba(198,151,63,.2);
}
.pub-nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 20px;
}
.pub-brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.pub-brand-monogram {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gold); display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--ink); font-weight: 700; overflow: hidden;
}
.pub-brand-name   { font-family: 'Cormorant Garamond', serif; font-size: 1rem; font-weight: 700; color: #fff; }
.pub-brand-sub    { font-size: 9px; color: rgba(255,255,255,.45); letter-spacing: .04em; }
.pub-nav-links    { display: flex; gap: 4px; margin-left: auto; }
.pnl {
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,.65);
  cursor: pointer; transition: all .18s;
}
.pnl:hover, .pnl.active { color: var(--gold); background: rgba(198,151,63,.12); }
.pub-nav-actions  { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.btn-signin { background: transparent; border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.8); padding: 6px 14px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; transition: all .18s; }
.btn-signin:hover { border-color: var(--gold); color: var(--gold); }
.btn-join   { background: var(--gold); border: none; color: var(--ink); padding: 6px 14px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; transition: all .18s; }
.btn-join:hover { background: var(--gold-d); }

/* Burger public */
.pub-burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 4px; cursor: pointer;
}
.pub-burger span { display: block; width: 22px; height: 2px; background: rgba(255,255,255,.7); border-radius: 2px; }

/* Menu overlay mobile */
.pub-menu-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300; }
.pub-menu-overlay.open { display: block; }
.pub-menu-panel {
  position: fixed; top: 0; right: -280px; width: 280px; height: 100%;
  background: var(--ink); z-index: 301; transition: right .25s;
  border-left: 1px solid rgba(198,151,63,.2); overflow-y: auto;
}
.pub-menu-panel.open { right: 0; }
.pub-menu-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.pub-menu-links > div { padding: 13px 20px; font-size: 13px; font-weight: 500; color: rgba(255,255,255,.8); cursor: pointer; transition: all .18s; }
.pub-menu-links > div:hover { background: rgba(198,151,63,.1); color: var(--gold); }
.pub-menu-sep { height: 1px; background: rgba(255,255,255,.08); margin: 6px 0; }

/* ── Barre social nav ───────────────────────────────── */
.social-nav { background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 60px; z-index: 100; }
.social-nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; }
.snav-btn {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
  font-size: 12px; font-weight: 500; color: var(--text-m); cursor: pointer;
  white-space: nowrap; border-bottom: 2px solid transparent; transition: all .18s;
}
.snav-btn:hover, .snav-btn.active { color: var(--ink); border-bottom-color: var(--gold); }
.sicon { font-size: 14px; }
.snav-sep { width: 1px; background: var(--border); margin: 8px 4px; }

/* ── Footer ─────────────────────────────────────────── */
.pub-footer { background: var(--ink); border-top: 1px solid rgba(198,151,63,.2); margin-top: 60px; }
.pub-footer-inner { max-width: 1200px; margin: 0 auto; padding: 40px 20px 20px; }
.pub-footer-top { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 30px; }
.footer-brand-name { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.footer-brand-desc { font-size: 12px; color: rgba(255,255,255,.45); line-height: 1.7; }
.footer-col-title  { font-size: 10px; font-weight: 700; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.footer-link { display: block; font-size: 12px; color: rgba(255,255,255,.55); cursor: pointer; margin-bottom: 6px; transition: color .18s; }
.footer-link:hover { color: var(--gold); }
.pub-footer-bottom { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid rgba(255,255,255,.08); padding-top: 16px; }
.footer-copy   { font-size: 11px; color: rgba(255,255,255,.3); }
.footer-arabic { font-family: 'Amiri', serif; font-size: 18px; color: var(--gold); opacity: .6; }

/* ══════════════════════════════════════════════════════
   AUTH OVERLAY
   ══════════════════════════════════════════════════════ */
.auth-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 500;
  align-items: center; justify-content: center;
}
.auth-overlay.open { display: flex; }
.auth-panel {
  background: var(--bg-card); border-radius: var(--radius);
  width: 420px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.auth-top    { background: var(--ink); padding: 24px 26px 18px; border-radius: var(--radius) var(--radius) 0 0; }
.auth-logo   { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; font-weight: 700; color: #fff; }
.auth-logo span { color: var(--gold); }
.auth-subtitle { font-size: 11px; color: rgba(255,255,255,.45); margin-top: 4px; }
.auth-tabs   { display: flex; border-bottom: 1px solid var(--border); }
.auth-tab    { flex: 1; padding: 12px; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-l); cursor: pointer; transition: all .18s; border-bottom: 2px solid transparent; }
.auth-tab.active { color: var(--ink); border-bottom-color: var(--gold); }
.auth-body   { padding: 18px 26px; }

/* Checkbox inscription */
.reg-check-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; transition: all .18s; }
.reg-check-box:hover { border-color: var(--gold); background: rgba(198,151,63,.04); }
.reg-check-box.checked { border-color: var(--gold); background: rgba(198,151,63,.08); }
.reg-checkbox {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-radius: 4px; flex-shrink: 0; transition: all .18s;
  display: flex; align-items: center; justify-content: center;
}
.reg-checkbox.checked { background: var(--gold); border-color: var(--gold); }
.reg-checkbox.checked::after { content: '✓'; color: var(--ink); font-size: 11px; font-weight: 700; }
.reg-section-title { font-size: 10px; font-weight: 700; color: var(--text-l); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }

/* ══════════════════════════════════════════════════════
   BIBLIOTHÈQUE OVERLAY
   ══════════════════════════════════════════════════════ */
.lib-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); z-index: 400;
  align-items: center; justify-content: center;
}
.lib-overlay.open { display: flex; }
.lib-panel {
  background: var(--bg-card); border-radius: var(--radius);
  width: 760px; max-width: 96vw; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.lib-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.lib-title  { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 700; }
.lib-close  { background: none; border: none; font-size: 18px; color: var(--text-l); cursor: pointer; }
.lib-body   { padding: 16px; overflow-y: auto; }
.lib-cats   { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.lib-cat    { padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); cursor: pointer; transition: all .18s; color: var(--text-m); }
.lib-cat.active, .lib-cat:hover { background: var(--ink); color: var(--gold); border-color: var(--ink); }
.lib-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }

/* ══════════════════════════════════════════════════════
   HISTOIRES OVERLAY
   ══════════════════════════════════════════════════════ */
.hist-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 400;
  align-items: flex-end; justify-content: center;
}
.hist-overlay.open { display: flex; }
.hist-panel {
  background: var(--ink); width: 100%; max-height: 80vh;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0,0,0,.4);
}
.hist-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.hist-title  { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 700; color: #fff; }
.hist-lock   { font-size: 10px; color: rgba(255,255,255,.35); margin-top: 3px; }
.hist-body   { padding: 16px; overflow-y: auto; }

/* ══════════════════════════════════════════════════════
   APP — INTERFACE MEMBRE CONNECTÉ
   ══════════════════════════════════════════════════════ */

/* ── Top nav ────────────────────────────────────────── */
.app-topnav {
  position: sticky; top: 0; z-index: 200;
  background: var(--ink); border-bottom: 1px solid rgba(198,151,63,.2);
  height: 58px; display: flex; align-items: center; padding: 0 16px; gap: 12px;
}
.app-nav-brand { display: flex; align-items: center; gap: 8px; }
.app-nav-monogram {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold); display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--ink); font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.app-nav-title { font-family: 'Cormorant Garamond', serif; font-size: .95rem; font-weight: 700; color: #fff; white-space: nowrap; }
.app-nav-search {
  flex: 1; max-width: 340px; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.07); border-radius: 20px; padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.1);
}
.app-nav-search input { background: none; border: none; color: #fff; font-size: 12px; outline: none; width: 100%; }
.app-nav-search input::placeholder { color: rgba(255,255,255,.35); }
.app-nav-search-icon { color: rgba(255,255,255,.35); font-size: 13px; }
.app-nav-items { display: flex; gap: 2px; margin-left: auto; }
.app-nav-item  { padding: 6px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; color: rgba(255,255,255,.6); cursor: pointer; white-space: nowrap; transition: all .18s; }
.app-nav-item:hover, .app-nav-item.active { color: var(--gold); background: rgba(198,151,63,.12); }
.app-nav-right { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.app-nav-actions { display: flex; gap: 4px; }
.app-nav-btn  { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 15px; color: rgba(255,255,255,.55); transition: all .18s; background: none; border: none; }
.app-nav-btn:hover { background: rgba(255,255,255,.08); color: var(--gold); }
.app-nav-user { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); transition: all .18s; }
.app-nav-user:hover { background: rgba(255,255,255,.06); }
.app-nav-av   { width: 30px; height: 30px; border-radius: 50%; background: var(--gold); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--ink); }
.app-nav-username { font-size: 12px; font-weight: 600; color: #fff; }
.app-nav-role    { font-size: 10px; color: rgba(255,255,255,.4); }
.sb-rbadge { font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: 700; }
.app-hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 4px; margin-left: 8px; }
.app-hamburger span { display: block; width: 20px; height: 2px; background: rgba(255,255,255,.7); border-radius: 2px; }

/* ── Drawer mobile ──────────────────────────────────── */
.mob-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 300; }
.mob-overlay.open { display: block; }
.mob-drawer  {
  position: fixed; top: 0; left: -280px; width: 280px; height: 100%;
  background: var(--ink); z-index: 301; transition: left .25s;
  border-right: 1px solid rgba(198,151,63,.2); overflow-y: auto;
  display: flex; flex-direction: column;
}
.mob-drawer.open { left: 0; }
.mob-drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.mob-drawer-user { display: flex; align-items: center; gap: 10px; }
.mob-drawer-av   { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--ink); }
.mob-drawer-name { font-size: 13px; font-weight: 600; color: #fff; }
.mob-drawer-grade{ font-size: 10px; color: rgba(255,255,255,.4); }
.mob-drawer-close{ background: rgba(255,255,255,.08); border: none; color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 13px; }
.mob-drawer-search { padding: 10px 14px; }
.mob-drawer-search { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border-radius: 20px; padding: 7px 14px; }
.mob-drawer-search input { background: none; border: none; color: #fff; font-size: 12px; outline: none; flex: 1; }
.mob-drawer-search-icon { color: rgba(255,255,255,.35); }
.mob-drawer-actions { padding: 14px 14px 20px; display: flex; flex-direction: column; gap: 8px; margin-top: auto; }

/* ── Sous-nav ────────────────────────────────────────── */
.app-subnav {
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  padding: 0 20px; display: flex; gap: 4px; overflow-x: auto;
  position: sticky; top: 58px; z-index: 100;
}
.app-subnav-item {
  padding: 10px 14px; font-size: 12px; font-weight: 500; color: var(--text-m);
  cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; transition: all .18s;
}
.app-subnav-item:hover, .app-subnav-item.active { color: var(--ink); border-bottom-color: var(--gold); }
.app-subnav-dd { display: none; background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 8px 16px; position: sticky; top: 58px; z-index: 100; }
.app-subnav-dd-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 14px; font-size: 13px; font-weight: 500; cursor: pointer; }
.app-subnav-dd-caret { font-size: 10px; color: var(--text-l); transition: transform .2s; }
.app-subnav-dd-menu { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 4px; display: none; box-shadow: var(--shadow); overflow: hidden; }
.app-subnav-dd-menu.open { display: block; }
.app-subnav-dd-menu-item { padding: 10px 14px; font-size: 12px; cursor: pointer; transition: background .15s; }
.app-subnav-dd-menu-item:hover, .app-subnav-dd-menu-item.active { background: rgba(198,151,63,.08); color: var(--ink); }

/* ── Main content ───────────────────────────────────── */
.app-main { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

/* ── Cartes ─────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}

/* ── Grilles responsive ─────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ── Badges rôles ───────────────────────────────────── */
.badge-super_admin { background: rgba(139,26,26,.1);  color: var(--red);   border: 1px solid rgba(139,26,26,.2); }
.badge-bureau_amla { background: rgba(198,151,63,.12); color: var(--gold-d); border: 1px solid rgba(198,151,63,.25); }
.badge-khadim      { background: rgba(26,26,46,.06);   color: var(--ink);   border: 1px solid rgba(26,26,46,.12); }
.badge-membre      { background: rgba(120,120,150,.08); color: var(--text-m); border: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .pub-nav-links { display: none; }
  .pub-burger    { display: flex; }
  .app-nav-search { display: none; }
  .app-nav-items  { display: none; }
  .app-hamburger  { display: flex; }
  .app-nav-user .app-nav-username,
  .app-nav-user .app-nav-role { display: none; }
  .app-subnav    { display: none; }
  .app-subnav-dd { display: block; }
  .pub-footer-top { grid-template-columns: 1fr; gap: 24px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .fr2 { grid-template-columns: 1fr; }
  .app-main { padding: 16px; }
}
@media (max-width: 1024px) and (min-width: 769px) {
  .app-subnav    { display: none; }
  .app-subnav-dd { display: block; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
