/* ============================================================
   Sidebar persistante — même comportement que Lecteurs Solutions
   Desktop : réduite (72px) -> étendue (240px) au survol ou épinglée
   Mobile  : drawer coulissant + overlay
   ============================================================ */

:root { --sidebar-w: 72px; }
body.sidebar-pinned { --sidebar-w: 240px; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 72px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: width .25s ease, transform .25s ease;
}
.sidebar:hover,
body.sidebar-pinned .sidebar { width: 240px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.brand-badge {
  flex: 0 0 40px; height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
}
.brand-badge svg { width: 22px; height: 22px; }
.brand-name {
  font-weight: 800; font-size: 16px;
  opacity: 0; transition: opacity .2s;
}
.brand-accent { color: var(--accent); }
.sidebar:hover .brand-name,
body.sidebar-pinned .brand-name { opacity: 1; }

.sidebar-nav { flex: 1; padding: 10px 12px; overflow-y: auto; overflow-x: hidden; }

.nav-group { margin-bottom: 14px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-2);
  padding: 6px 10px 4px;
  white-space: nowrap;
  opacity: 0; transition: opacity .2s;
  height: 22px;
}
.sidebar:hover .nav-group-label,
body.sidebar-pinned .nav-group-label { opacity: 1; }

.nav-link {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600; font-size: 14px;
  white-space: nowrap;
  margin-bottom: 2px;
  border: none; background: none; width: 100%; cursor: pointer; font-family: inherit;
  transition: background .15s, color .15s;
}
.nav-link svg { flex: 0 0 22px; width: 22px; height: 22px; }
.nav-link .nav-label { opacity: 0; transition: opacity .2s; }
.sidebar:hover .nav-label,
body.sidebar-pinned .nav-label { opacity: 1; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }

.sidebar-footer { padding: 10px 12px; border-top: 1px solid var(--border); }
body.sidebar-pinned .pin-toggle svg { transform: rotate(180deg); }
.pin-toggle svg { transition: transform .25s; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10, 14, 20, .5);
  z-index: 90;
  opacity: 0; transition: opacity .25s;
}

/* --------- Mobile drawer --------- */
@media (max-width: 860px) {
  .sidebar {
    width: 260px;
    transform: translateX(-100%);
  }
  .sidebar:hover { width: 260px; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; opacity: 1; }
  .sidebar .brand-name,
  .sidebar .nav-label,
  .sidebar .nav-group-label { opacity: 1; }
  .sidebar-footer { display: none; }
}
