/* ═══════════════════════════════════════════════════════════
   LAYOUT — Design "Antigravity"
   Topbar verre dépoli, sidebar sombre, dock mobile flottant.
   ═══════════════════════════════════════════════════════════ */

/* Layout général */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ═══════════════════════════════════════
   Topbar — verre dépoli translucide
   ═══════════════════════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 var(--pad-lg);
  gap: var(--gap);
  z-index: 40;
}
.topbar-title {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.4px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-icon);
  color: var(--text-secondary);
  font-size: 18px;
  transition: all 0.2s var(--ease);
}
.topbar-btn:hover { background: var(--accent-light); color: var(--accent); transform: translateY(-1px); }
.topbar-btn:active { transform: scale(0.94); }

/* Hamburger — uniquement sur mobile (le PC a la sidebar) */
.topbar-menu-btn { margin-left: -8px; }
@media (min-width: 768px) {
  .topbar-menu-btn { display: none; }
}

/* ═══════════════════════════════════════
   Content
   ═══════════════════════════════════════ */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.page {
  flex: 1;
  padding: var(--pad-lg);
  overflow-y: auto;
  padding-bottom: calc(var(--navbar-h) + 92px);
  animation: page-in 0.35s var(--ease) both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-list { display: flex; flex-direction: column; gap: var(--gap); }

/* ═══════════════════════════════════════
   Navbar mobile — dock flottant en verre
   ═══════════════════════════════════════ */
.navbar {
  position: fixed;
  bottom: 10px;
  left: 10px;
  right: 10px;
  height: var(--navbar-h);
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  display: flex;
  padding: 0 6px;
  z-index: 40;
  margin-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: var(--shadow-lg);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}
.nav-item:active { transform: scale(0.92); }
.nav-item.active { color: var(--accent); font-weight: var(--fw-semibold); }
/* Point lumineux sous l'onglet actif */
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.nav-item-icon { font-size: 22px; transition: transform 0.25s var(--ease-spring); }
.nav-item.active .nav-item-icon { transform: translateY(-2px); }

/* Bouton Chat central surélevé */
.nav-chat {
  flex: 0 0 62px;
  align-self: stretch; /* la navbar inline met align-items:center → sans ceci le bouton s'écrase à 0px */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
}
.nav-chat-icon {
  position: absolute;
  top: -10px; /* léger dépassement : ne recouvre plus la zone de saisie du chat */
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-accent-lg);
  border: 3px solid var(--bg);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.2s;
}
.nav-chat:active .nav-chat-icon { transform: scale(0.9); }
.nav-chat.active .nav-chat-icon { box-shadow: var(--glow-accent-lg), 0 0 0 3px var(--accent-light); }
.nav-item-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 9px;
  font-weight: var(--fw-semibold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 8px var(--error-light);
}

/* ═══════════════════════════════════════
   Sidebar PC — dépliable
   ═══════════════════════════════════════ */
.sidebar {
  display: none;
  width: var(--sidebar-w);
  background: var(--sidebar-bg, #f8f9fd);
  border-right: 1px solid var(--border);
  flex-direction: column;
  padding: 12px 10px;
  gap: 2px;
  z-index: 40;
  transition: width 0.3s var(--ease);
  overflow-x: hidden;
  overflow-y: auto;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}
.sidebar.sidebar-open { width: var(--sidebar-w-open); }

/* Logo + toggle en haut */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 16px;
  min-height: 52px;
  cursor: pointer;
  border-radius: var(--radius-btn);
  transition: background 0.15s;
}
.sidebar-header:hover { background: var(--accent-light); }
.sidebar-logo-icon { font-size: 26px; flex-shrink: 0; width: 38px; display: flex; align-items: center; justify-content: center; transition: width 0.3s var(--ease); }
/* Logo agrandi pour prendre la largeur du menu une fois déplié (retour Julien 2026-08-09). */
.sidebar-open .sidebar-logo-icon { flex: 1; width: auto; min-width: 0; justify-content: flex-start; }
.sidebar-logo-img { width: 38px; height: 38px; object-fit: contain; border-radius: 4px; flex-shrink: 0; transition: width 0.3s var(--ease), height 0.3s var(--ease); }
.sidebar-open .sidebar-logo-img { width: 100%; height: auto; max-height: 72px; }
.sidebar-logo-text {
  font-weight: var(--fw-bold);
  font-size: var(--fs-xl);
  letter-spacing: -0.4px;
  white-space: pre-line;
  line-height: 1.2;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-open .sidebar-logo-text { opacity: 1; }
.sidebar-toggle {
  margin-left: auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border-radius: 50%;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.3s var(--ease), background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.sidebar-open .sidebar-toggle { transform: rotate(180deg); }
.sidebar-header:hover .sidebar-toggle { opacity: 1; background: var(--accent-light); color: var(--accent); }

/* Items */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 46px;
  padding: 0 12px;
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--fs-base);
  font-family: var(--font);
  border: none;
  background: none;
  transition: all 0.2s var(--ease);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-item-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
  transition: transform 0.25s var(--ease-spring);
}
.sidebar-item:hover .sidebar-item-icon { transform: scale(1.12); }
.sidebar-item-label {
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  font-weight: var(--fw-medium);
}
.sidebar-open .sidebar-item-label { opacity: 1; }

.sidebar-item:hover {
  background: var(--accent-light);
  color: var(--text);
}
.sidebar-item.active {
  background: var(--accent-gradient);
  color: #fff;
  font-weight: var(--fw-semibold);
  box-shadow: var(--glow-accent);
}
.sidebar-item.active:hover { filter: brightness(1.08); }
.sidebar-spacer { flex: 1; }

.sidebar-section-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: var(--fw-semibold);
  padding: 16px 12px 6px;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  white-space: nowrap;
}
.sidebar-open .sidebar-section-label { opacity: 0.7; }

/* ═══════════════════════════════════════
   Drawer mobile (menu complet)
   ═══════════════════════════════════════ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.55);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.drawer-overlay-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 290px;
  max-width: 85vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 91;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
.drawer-open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.drawer-head-title {
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  letter-spacing: -0.3px;
  white-space: pre-line;
  line-height: 1.2;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.drawer-section {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 20px 6px;
}
.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border: none;
  background: none;
  color: var(--text);
  font-size: var(--fs-base);
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s var(--ease);
  border-radius: 0;
}
.drawer-item:hover { background: var(--accent-light); }
.drawer-item.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: var(--fw-semibold);
  border-left: 3px solid var(--accent);
}
.drawer-item span:first-child { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }

/* ═══════════════════════════════════════
   PC — responsive
   ═══════════════════════════════════════ */
@media (min-width: 768px) {
  .navbar { display: none !important; }
  .drawer-overlay, .drawer { display: none !important; }
  .sidebar { display: flex; }
  .fab { display: none; }
  .page { padding-bottom: var(--pad-lg); }

  .page-split {
    display: grid;
    grid-template-columns: 55% 45%;
    gap: var(--pad);
    height: calc(100vh - var(--topbar-h));
    overflow: hidden;
  }
  .page-split > * { overflow-y: auto; }
}

/* ═══════════════════════════════════════
   Login — fond aurora animé + carte verre
   ═══════════════════════════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding: var(--pad);
  position: relative;
  overflow: hidden;
}
/* Deux halos flottants derrière la carte */
.login-page::before,
.login-page::after {
  content: '';
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
  pointer-events: none;
}
.login-page::before {
  background: var(--accent);
  top: -140px;
  left: -120px;
  animation: aurora-a 14s ease-in-out infinite alternate;
}
.login-page::after {
  background: var(--accent-2, #8b5cf6);
  bottom: -160px;
  right: -120px;
  animation: aurora-b 17s ease-in-out infinite alternate;
}
@keyframes aurora-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(90px, 60px) scale(1.15); }
}
@keyframes aurora-b {
  from { transform: translate(0, 0) scale(1.1); }
  to { transform: translate(-80px, -70px) scale(0.95); }
}
.login-card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-xl);
  text-align: center;
  position: relative;
  animation: login-in 0.5s var(--ease-spring) both;
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.8px;
  margin-bottom: 6px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-subtitle {
  color: var(--text-secondary);
  font-size: var(--fs-base);
  margin-bottom: 28px;
}
.login-error {
  color: var(--error);
  font-size: var(--fs-sm);
  margin-top: 8px;
  display: none;
}
