/* Shell du portail : sidebar (desktop) + main + bottom-nav (mobile).
   Calqué sur le portail alces, recoloré au thème Lutra. */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
}

/* ---- Shell ---- */
.app-shell {
  min-height: 100vh;
}

/* Caché tant que déconnecté → la carte login/signup occupe tout l'écran. */
.app-shell:not(.logged-in) .sidebar,
.app-shell:not(.logged-in) .mobile-header,
.app-shell:not(.logged-in) .bottom-nav {
  display: none !important;
}
.app-shell:not(.logged-in) .main-content {
  margin-left: 0 !important;
  padding-bottom: 0 !important;
}

/* ---- Sidebar (desktop) ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  color: var(--text);
  padding: 0 8px 22px;
}
.sidebar-brand .mark {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
}
.sidebar-nav a:hover {
  background: rgba(31, 77, 74, 0.06);
  color: var(--text);
}
.sidebar-nav a.active {
  background: rgba(31, 77, 74, 0.12);
  color: var(--accent);
}
.sidebar-nav a .ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.85;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-soft);
}
.sidebar-foot .lang-switch {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
}
.lang-switch button {
  appearance: none;
  background: none;
  border: none;
  padding: 2px 5px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-soft);
  font: inherit;
}
.lang-switch button.active {
  color: var(--text);
  font-weight: 600;
}

/* ---- Mobile header ---- */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.mobile-header .sidebar-brand {
  padding: 0;
  font-size: 19px;
}

/* ---- Main ---- */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 32px;
  max-width: 980px;
}

/* ---- Bottom nav (mobile) ---- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  z-index: 20;
}
.bottom-nav nav {
  display: flex;
  height: 100%;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-soft);
}
.bottom-nav a.active {
  color: var(--accent);
}
.bottom-nav a .ico {
  width: 20px;
  height: 20px;
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .sidebar {
    display: none;
  }
  .mobile-header {
    display: flex;
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px calc(var(--bottom-nav-height) + 20px);
  }
  .bottom-nav {
    display: block;
  }
  .app-shell.logged-in .mobile-header {
    display: flex;
  }
}
