/* ============================================================
   LAYOUT — sidebar, topbar, nav, brand, main, footer
   Portail client + admin uniquement (pas les pages auth)
   ============================================================ */

/* Shell principal */
.app-layout,
.app {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

/* ── Sidebar (rework 2026 — harmonise avec vitrine) ──
   Meme glass + backdrop-blur que .nav vitrine, pour la coherence
   visuelle quand on switch entre vitrine et espace app.            */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: rgba(6, 9, 15, 0.86);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Brand (style nav-brand vitrine : logo discret, pas de carre orange) ── */
.brand,
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  object-fit: contain;
  background: transparent;
  border: 0;
  padding: 0;
  flex-shrink: 0;
}

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.01em;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
}

/* ── User card ── */
.user-card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 14px;
}

.user-name  { font-weight: 700; font-size: 15.5px; margin-bottom: 2px; }
.user-email,
.user-mail  { font-size: 12.5px; color: var(--muted); word-break: break-word; }

/* ── Nav ── */
.nav-card {
  background: transparent;
  border: 0;
  padding: 0;
  margin-top: 4px;
}

.nav-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--subtle);
  margin: 8px 12px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  color: var(--muted);
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover {
  background: var(--glass);
  color: var(--text);
}

.nav-link.active,
.nav-link.is-current {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent-soft);
  font-weight: 600;
}

/* ── Main area ── */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 0;
  flex-wrap: wrap;
}

.page-title {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 700;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  letter-spacing: -.01em;
}

.page-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-content {
  padding: 22px 24px;
  flex: 1;
}

/* ── Footer ── */
.site-footer {
  margin-top: auto;
  padding: 18px 24px 28px;
  text-align: center;
  font-size: 13px;
  color: rgba(240,245,255,.55);
}

/* ── Topbar (barre en haut du main) ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.topbar-left h1 { margin: 0; font-size: 28px; }
.topbar-left p  { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Responsive : drawer mobile ── */
@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  /* Laisse de la place pour le bouton hamburger en haut a gauche */
  .main, .page-header { padding-top: 64px; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(86vw, 320px);
    max-width: 320px;
    z-index: 200;
    border-right: 1px solid var(--line);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform .22s ease-out;
    overflow-y: auto;
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: translateX(0); }

  /* Backdrop semi-transparent quand drawer ouvert */
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s;
  }
  .sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* Bouton hamburger sticky en haut a gauche */
  .nav-burger {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 201;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md, 14px);
    background: var(--bg2);
    border: 1px solid var(--line-md);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-s);
  }
  .nav-burger svg { width: 22px; height: 22px; }
  .nav-burger:hover { background: rgba(98,168,255,.15); }
}

/* Caché en desktop */
@media (min-width: 1101px) {
  .nav-burger { display: none; }
  .sidebar-backdrop { display: none; }
}

@media (max-width: 760px) {
  .page-header,
  .page-content { padding-left: 16px; padding-right: 16px; }
  .page-title { font-size: 22px; }
  .topbar-left h1 { font-size: 22px; }
}

/* ── Topbar inner (compatibilité anciennes pages) ── */
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
}
.site-logo { width: 40px; height: 40px; object-fit: contain; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
