/**
 * layout.css — Mise en page George V3 Client
 * Shell, sidebar, header, bottom-nav, pages, ticker, orbe, chat…
 */

/* ══════════════════════════════════════════════════════════════════════════
   BOOT / LOGIN
══════════════════════════════════════════════════════════════════════════ */
.boot-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  background: var(--bg);
}
.boot-text { color: var(--fg-2); font-size: var(--text-sm); }

.login-root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--sp-4);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.login-brand { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--fg); }
.login-sub   { color: var(--fg-2); font-size: var(--text-sm); margin-bottom: var(--sp-6); }
.login-form  { display: flex; flex-direction: column; gap: var(--sp-4); }
.login-error {
  padding: var(--sp-2) var(--sp-3);
  background: #2d0808;
  border: 1px solid var(--err);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: var(--text-sm);
  margin-bottom: var(--sp-3);
}
.login-hint { margin-top: var(--sp-4); font-size: var(--text-xs); color: var(--fg-3); text-align: center; }

/* ══════════════════════════════════════════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ══════════════════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.sidebar-top   { flex: 1; overflow-y: auto; padding: var(--sp-4) 0; }
.sidebar-bottom { padding: var(--sp-4); border-top: 1px solid var(--border); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.sidebar-title { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--fg); }

.sidebar-nav { display: flex; flex-direction: column; gap: var(--sp-1); padding: 0 var(--sp-2); }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  color: var(--fg-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: background var(--tr-fast), color var(--tr-fast);
  width: 100%;
  text-align: left;
}
.sidebar-item:hover { background: var(--bg-4); color: var(--fg); }
.sidebar-item--active { background: color-mix(in srgb, var(--a) 15%, transparent); color: var(--a); }
.sidebar-icon  { font-size: var(--text-base); width: 20px; text-align: center; }
.sidebar-label { flex: 1; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { display: block; font-size: var(--text-xs); color: var(--fg-3); }
.sidebar-logout { width: 100%; justify-content: center; }

/* ══════════════════════════════════════════════════════════════════════════
   MAIN AREA
══════════════════════════════════════════════════════════════════════════ */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
}

/* ══════════════════════════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════════════════════════ */
.header {
  height: var(--header-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  flex-shrink: 0;
  gap: var(--sp-4);
}
.header-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}
.header-icon  { font-size: var(--text-lg); }
.header-title { font-size: var(--text-lg); font-weight: var(--weight-semi); color: var(--fg); }
.header-right { flex: 1; min-width: 0; max-width: 480px; }

/* ══════════════════════════════════════════════════════════════════════════
   TICKER SSE
══════════════════════════════════════════════════════════════════════════ */
.ticker {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  overflow: hidden;
}
.ticker-dot { font-size: 0.6rem; flex-shrink: 0; }
.ticker-scroll {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  scrollbar-width: none;
}
.ticker-scroll::-webkit-scrollbar { display: none; }
.ticker-msg {
  font-size: var(--text-xs);
  color: var(--fg-2);
  white-space: nowrap;
  padding: 2px var(--sp-2);
  background: var(--bg-4);
  border-radius: var(--radius-full);
}
.ticker-msg strong { color: var(--a); }
.ticker-empty { font-size: var(--text-xs); color: var(--fg-3); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════════════
   ORBE (placeholder CSS, pas Three.js)
══════════════════════════════════════════════════════════════════════════ */
.orbe {
  width: 36px; height: 36px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.orbe-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--a);
  opacity: 0.3;
  animation: orbe-pulse 3s ease-in-out infinite;
}
.orbe-ring--1 { width: 36px; height: 36px; animation-delay: 0s; }
.orbe-ring--2 { width: 26px; height: 26px; animation-delay: 0.5s; opacity: 0.4; }
.orbe-ring--3 { width: 18px; height: 18px; animation-delay: 1s; opacity: 0.5; }
.orbe-core {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--a);
  box-shadow: 0 0 8px var(--a);
}
.orbe--active .orbe-ring { opacity: 0.6; }
.orbe--active .orbe-core { box-shadow: 0 0 12px var(--a); }
@keyframes orbe-pulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.1); opacity: 0.6; }
}

.orbe-mini {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--a-light), var(--a-dark));
  box-shadow: 0 0 12px var(--a);
  flex-shrink: 0;
}
.orbe-mini--pulse { animation: orbe-pulse 1.5s ease-in-out infinite; }

/* ══════════════════════════════════════════════════════════════════════════
   BOTTOM NAV (mobile)
══════════════════════════════════════════════════════════════════════════ */
.bottom-nav {
  display: none; /* masquée par défaut (desktop) */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--sp-2);
  color: var(--fg-3);
  font-size: var(--text-xs);
  transition: color var(--tr-fast);
}
.bottom-nav-item--active { color: var(--a); }
.bottom-nav-icon { font-size: 1.2rem; }
.bottom-nav-label { font-size: 0.65rem; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .app-content { padding-bottom: calc(var(--bottom-nav-h) + var(--sp-4)); }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGES GÉNÉRIQUES
══════════════════════════════════════════════════════════════════════════ */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ══════════════════════════════════════════════════════════════════════════
   PAGE ACCUEIL
══════════════════════════════════════════════════════════════════════════ */
.accueil-page { padding: var(--sp-4) 0; }
.accueil-hero { margin-bottom: var(--sp-6); }
.accueil-greeting { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--fg); }
.accueil-sub { color: var(--fg-2); margin-top: var(--sp-1); }

.accueil-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.accueil-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  text-align: left;
  transition: background var(--tr-fast), border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.accueil-card:hover {
  background: var(--bg-4);
  border-color: var(--a);
  box-shadow: var(--shadow);
}
.accueil-card-icon  { font-size: 1.5rem; }
.accueil-card-label { font-size: var(--text-base); font-weight: var(--weight-semi); color: var(--fg); }
.accueil-card-desc  { font-size: var(--text-sm); color: var(--fg-2); }

.accueil-health {
  font-size: var(--text-xs);
  color: var(--fg-3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════════════════
   CHAT
══════════════════════════════════════════════════════════════════════════ */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - 2 * var(--sp-4));
  max-width: 800px;
  margin: 0 auto;
}

.chat-status-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--fg-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-2);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
}

.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--fg-3);
  font-size: var(--text-sm);
}

.chat-msg { display: flex; }
.chat-msg--user    { justify-content: flex-end; }
.chat-msg--george  { justify-content: flex-start; }

.chat-bubble {
  max-width: 75%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
}
.chat-msg--user .chat-bubble {
  background: var(--a);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}
.chat-msg--george .chat-bubble {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-text { font-size: var(--text-sm); line-height: 1.6; white-space: pre-wrap; }
.chat-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}
.chat-latency { font-size: var(--text-xs); color: var(--fg-3); }

/* Typing indicator */
.chat-bubble--typing { padding: var(--sp-3) var(--sp-4); }
.typing-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--fg-3);
  border-radius: 50%;
  margin: 0 2px;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* Confirm banner */
.confirm-banner {
  background: color-mix(in srgb, var(--warn) 10%, var(--bg-3));
  border: 1px solid var(--warn);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin: var(--sp-3) 0;
  display: flex;
  gap: var(--sp-4);
  align-items: center;
}
.confirm-summary {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--fg);
  line-height: 1.5;
}
.confirm-actions { display: flex; gap: var(--sp-2); }

/* Input bar */
.chat-input-bar {
  display: flex;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.chat-input {
  flex: 1;
  resize: none;
  overflow: hidden;
  max-height: 120px;
}
.chat-send {
  flex-shrink: 0;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-base);
}

/* ══════════════════════════════════════════════════════════════════════════
   MÉMOIRE
══════════════════════════════════════════════════════════════════════════ */
.memory-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.memory-item {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  align-items: start;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}
.memory-key   { font-weight: var(--weight-medium); color: var(--a); word-break: break-all; }
.memory-value { color: var(--fg-2); word-break: break-all; }
.memory-date  { font-size: var(--text-xs); color: var(--fg-3); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════════════
   ACTIVITÉ / TIMELINE
══════════════════════════════════════════════════════════════════════════ */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  position: relative;
}
.timeline-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid var(--a);
  flex-shrink: 0;
  z-index: 1;
}
.timeline-body { flex: 1; }
.timeline-text { font-size: var(--text-sm); color: var(--fg); line-height: 1.5; }
.timeline-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}
.timeline-date { font-size: var(--text-xs); color: var(--fg-3); }
