/* ============================================================
   LAYOUT.CSS — Sidebar modulaire + Auth
   GP-MFB · Gestionnaire du Patrimoine
   ============================================================ */

/* ══════════════════════════════════════
   SIDEBAR — Design épuré, zones par module
══════════════════════════════════════ */
.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: #F8F9FA;
  border-right: 1px solid #E8ECF0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #E0E4E8 transparent;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: #DDE2E7; border-radius: 3px; }

/* ── Logo — fond sombre pour lisibilité du SVG blanc ── */
.sb-logo {
  padding: 1.4rem 1.3rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  background: #152318;
}
.sb-logo svg { flex-shrink: 0; }
.sb-brand {
  color: rgba(255,255,255,.48);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1.6;
  font-weight: 500;
}
.sb-brand strong {
  display: block;
  color: rgba(255,255,255,.92);
  font-size: 12.5px;
  letter-spacing: .02em;
  font-weight: 700;
}

/* ── Zone modulaire (section + nav) ── */
.sb-section {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: .7rem .75rem .15rem;
  padding: .45rem .75rem;
  font-size: 9px;
  color: #fff;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  border-radius: 8px 8px 0 0;
  flex-shrink: 0;
}

/* Icône de module dans le header de section */
.sb-section::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  flex-shrink: 0;
}

/* ── Couleurs de fond par module ── */
.sb-section[data-mod="acq"]          { background: #0EA472; }
.sb-section[data-mod="mvt"]          { background: #D9681A; }
.sb-section[data-mod="mission"]      { background: #5B6AF0; }
.sb-section[data-mod="actifs"]       { background: #0891B2; }
.sb-section[data-mod="docs"]         { background: #B45309; }
.sb-section[data-mod="acq-pf"]       { background: #0D9488; }
.sb-section[data-mod="stats"]        { background: #7C3AED; }
.sb-section[data-mod="superviseur"]  { background: #0D2E6B; }
.sb-section[data-mod="controle"]     { background: #1A73E8; }
.sb-section[data-mod="eval"]         { background: #059669; }
.sb-section[data-mod="admin"]        { background: #DB2777; }
.sb-section[data-mod="compte"]       { background: #475569; }

[data-mod="admin"].sb-nav            { background: rgba(219,39,119,.07); }
[data-mod="compte"].sb-nav           { background: rgba(71,85,105,.07);  }
[data-mod="admin"].sb-nav  li a:hover .ico { background: rgba(219,39,119,.14); color: #DB2777; }
[data-mod="compte"].sb-nav li a:hover .ico { background: rgba(71,85,105,.14);  color: #475569; }
[data-mod="admin"].sb-nav  li a:hover      { color: #DB2777; }
[data-mod="compte"].sb-nav li a:hover      { color: #475569; }
[data-mod="admin"].sb-nav  li a.active     { background: #DB2777; }
[data-mod="compte"].sb-nav li a.active     { background: #475569; }

/* ── Nav items — même zone colorée ── */
.sb-nav {
  list-style: none;
  padding: .2rem 0 .5rem;
  flex-shrink: 0;
  margin: 0 .75rem;
  border-radius: 0 0 10px 10px;
}

/* Couleurs de fond des zones nav */
[data-mod="acq"].sb-nav          { background: rgba(14,164,114,.07); }
[data-mod="mvt"].sb-nav          { background: rgba(217,104,26,.07); }
[data-mod="mission"].sb-nav      { background: rgba(91,106,240,.07); }
[data-mod="actifs"].sb-nav       { background: rgba(8,145,178,.07);  }
[data-mod="docs"].sb-nav         { background: rgba(180,83,9,.07);   }
[data-mod="acq-pf"].sb-nav       { background: rgba(13,148,136,.07); }
[data-mod="stats"].sb-nav        { background: rgba(124,58,237,.07); }
[data-mod="superviseur"].sb-nav  { background: rgba(13,46,107,.07);  }
[data-mod="controle"].sb-nav     { background: rgba(26,115,232,.07); }
[data-mod="eval"].sb-nav         { background: rgba(5,150,105,.07);  }

.sb-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: .48rem .8rem;
  margin: 1px .4rem;
  border-radius: 7px;
  font-size: 12px;
  color: #4B5563;
  transition: background .13s, color .13s;
  font-weight: 400;
}
.sb-nav li a:hover {
  color: #111827;
  text-decoration: none;
}

/* ── Icône avec fond coloré ── */
.sb-nav li a .ico {
  width: 28px;
  height: 28px;
  padding: 6px;
  border-radius: 7px;
  flex-shrink: 0;
  background: rgba(0,0,0,.05);
  transition: background .13s, color .13s;
  box-sizing: border-box;
}

/* Hover — fond légèrement teinté */
[data-mod="acq"].sb-nav     li a:hover .ico { background: rgba(14,164,114,.14);  color: #0EA472; }
[data-mod="mvt"].sb-nav     li a:hover .ico { background: rgba(217,104,26,.14);  color: #D9681A; }
[data-mod="mission"].sb-nav li a:hover .ico { background: rgba(91,106,240,.14);  color: #5B6AF0; }
[data-mod="actifs"].sb-nav  li a:hover .ico { background: rgba(8,145,178,.14);   color: #0891B2; }
[data-mod="docs"].sb-nav    li a:hover .ico { background: rgba(180,83,9,.14);    color: #B45309; }
[data-mod="acq-pf"].sb-nav  li a:hover .ico { background: rgba(13,148,136,.14); color: #0D9488; }
[data-mod="stats"].sb-nav   li a:hover .ico { background: rgba(124,58,237,.14);  color: #7C3AED; }

/* Texte au hover */
[data-mod="acq"].sb-nav     li a:hover { color: #0EA472; }
[data-mod="mvt"].sb-nav     li a:hover { color: #D9681A; }
[data-mod="mission"].sb-nav li a:hover { color: #5B6AF0; }
[data-mod="actifs"].sb-nav  li a:hover { color: #0891B2; }
[data-mod="docs"].sb-nav    li a:hover { color: #B45309; }
[data-mod="acq-pf"].sb-nav  li a:hover { color: #0D9488; }
[data-mod="stats"].sb-nav   li a:hover { color: #7C3AED; }

/* ── Active state — indicateur visuel fort ── */
.sb-nav li a.active {
  font-weight: 600;
  color: #fff !important;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
/* Trait indicateur à droite */
.sb-nav li a.active::after {
  content: '';
  position: absolute;
  right: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: rgba(255,255,255,.7);
}
.sb-nav li a.active .ico {
  color: #fff !important;
  opacity: 1;
}

[data-mod="acq"].sb-nav     li a.active { background: #0EA472; }
[data-mod="mvt"].sb-nav     li a.active { background: #D9681A; }
[data-mod="mission"].sb-nav li a.active { background: #5B6AF0; }
[data-mod="actifs"].sb-nav  li a.active { background: #0891B2; }
[data-mod="docs"].sb-nav    li a.active { background: #B45309; }
[data-mod="acq-pf"].sb-nav  li a.active { background: #0D9488; }
[data-mod="stats"].sb-nav   li a.active { background: #7C3AED; }

[data-mod="acq"].sb-nav     li a.active .ico { background: rgba(255,255,255,.2); }
[data-mod="mvt"].sb-nav     li a.active .ico { background: rgba(255,255,255,.2); }
[data-mod="mission"].sb-nav li a.active .ico { background: rgba(255,255,255,.2); }
[data-mod="actifs"].sb-nav  li a.active .ico { background: rgba(255,255,255,.2); }
[data-mod="docs"].sb-nav    li a.active .ico { background: rgba(255,255,255,.2); }
[data-mod="acq-pf"].sb-nav  li a.active .ico { background: rgba(255,255,255,.2); }
[data-mod="stats"].sb-nav   li a.active .ico { background: rgba(255,255,255,.2); }

/* Badge compteur */
.sb-badge {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,.25);
  color: #fff;
}

/* ── Profil bas — fond sombre assorti au logo ── */
.sb-bottom {
  margin-top: auto;
  padding: 1rem 1.1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  background: #152318;
}
.sb-user { display: flex; align-items: center; gap: 10px; }
.sb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #D9681A, #B55412);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .03em;
}
.sb-uname {
  font-size: 11px;
  color: rgba(255,255,255,.48);
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
}
.sb-uname strong {
  display: block;
  color: rgba(255,255,255,.88);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Override des inline styles rgba(255,255,255,.45) du PHP */
.sb-uname span { color: rgba(255,255,255,.48) !important; }
.sb-logout {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.42);
  flex-shrink: 0;
  transition: all .15s;
}
.sb-logout:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.35);
  color: #fff;
}

/* ══════════════════════════════════════
   MAIN WRAPPER
══════════════════════════════════════ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ══════════════════════════════════════
   TOPBAR
══════════════════════════════════════ */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .85rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #D9681A 0%, #F5A030 35%, #4CAF8A 65%, #2D6B4A 100%);
  opacity: .5;
}
.topbar-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.topbar-date { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
  transition: border-color .15s, box-shadow .15s;
}
.topbar-search:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
.topbar-search input {
  background: none; border: none; outline: none;
  font-size: 13px; color: var(--text); width: 180px;
}
.topbar-search input::placeholder { color: var(--hint); }

.topbar-notif {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  position: relative;
  transition: all .15s;
  flex-shrink: 0;
}
.topbar-notif:hover { background: var(--orange-light); border-color: var(--orange); color: var(--orange); }
.notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--orange);
  border: 1.5px solid var(--white);
}

/* ══════════════════════════════════════
   ZONE CONTENU
══════════════════════════════════════ */
.content { padding: 2rem; flex: 1; }

/* ══════════════════════════════════════
   GRILLES
══════════════════════════════════════ */
.grid-kpi  { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 2rem; }
.grid-main { display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; margin-bottom: 1.5rem; }
.grid-3    { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.flex-col  { display: flex; flex-direction: column; gap: 1.5rem; }

/* ══════════════════════════════════════
   AUTH — Page de connexion
══════════════════════════════════════ */
.auth-card {
  display: flex;
  width: 100%;
  max-width: 880px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 24px 64px rgba(30,60,40,.18),
    0 4px 16px rgba(0,0,0,.08);
  min-height: 540px;
}

/* Panneau gauche — Vert gouvernemental */
.auth-left {
  width: 42%;
  background: linear-gradient(155deg, #4CAF8A 0%, #2D7A58 45%, #1A4A32 100%);
  padding: 2.8rem 2.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 280px; height: 280px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.1);
  pointer-events: none;
}
.auth-left::after {
  content: '';
  position: absolute;
  bottom: -50px; left: -50px;
  width: 200px; height: 200px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.07);
  pointer-events: none;
}
.auth-deco {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

/* Bande orange verticale droite (drapeau CI) */
.auth-left .auth-stripe {
  position: absolute;
  top: 0; right: 0;
  width: 5px; height: 100%;
  background: linear-gradient(180deg, #F5A030 0%, #D9681A 100%);
}

.auth-badge {
  display: flex;
  align-items: center;
  gap: 13px;
  position: relative;
  z-index: 1;
}
.auth-org {
  color: rgba(255,255,255,.75);
  font-size: 10px;
  letter-spacing: .08em;
  line-height: 1.6;
  text-transform: uppercase;
  font-weight: 500;
}
.auth-tagline {
  position: relative;
  z-index: 1;
}
.auth-tagline h2 {
  font-family: var(--font-serif);
  color: #fff;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 12px;
}
.auth-tagline p {
  color: rgba(255,255,255,.62);
  font-size: 12px;
  line-height: 1.8;
}
.auth-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255,255,255,.18);
  padding-top: 14px;
}
.auth-footer p {
  color: rgba(255,255,255,.45);
  font-size: 10.5px;
  line-height: 1.6;
}

/* Panneau droit — Blanc */
.auth-right {
  flex: 1;
  background: #fff;
  padding: 3.5rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-right h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.auth-sub { font-size: 13px; color: var(--muted); margin-bottom: 26px; }

/* Séparateur tricolore miniature */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 26px;
}
.auth-divider::before {
  content: '';
  width: 22px; height: 3px;
  background: var(--orange);
  border-radius: 3px;
}
.auth-divider::after {
  content: '';
  width: 14px; height: 3px;
  background: #0EA472;
  border-radius: 3px;
}

.auth-help { font-size: 12px; color: var(--muted); text-align: center; margin-top: 18px; }
.auth-help a { color: var(--orange); font-weight: 600; }
.auth-help a:hover { text-decoration: underline; }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid-kpi  { grid-template-columns: repeat(2, 1fr); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .content { padding: 1rem; }
  .grid-kpi { grid-template-columns: 1fr 1fr; }
  .grid-3   { grid-template-columns: 1fr; }
  .auth-card { flex-direction: column; max-width: 420px; }
  .auth-left { width: 100%; min-height: 180px; }
  .auth-tagline { display: none; }
  .auth-right { padding: 2rem 1.8rem; }
}
@media (max-width: 480px) { .grid-kpi { grid-template-columns: 1fr; } }
