/*
 * sidebar.css - Sidebar Component
 * =================================
 * PORQUÊ: Todo o visual da navbar lateral (logo, lista de chats,
 * footer do usuário) isolado. Remover o sidebar = deletar este arquivo.
 */

.sidebar {
 width: var(--sidebar-w);
 background: var(--bg-surface);
 border-right: 1px solid var(--border);
 display: flex;
 flex-direction: column;
 flex-shrink: 0;
 position: relative;
 transition: background 0.3s ease, border-color 0.3s ease;
}

/* Linha vermelha sutil na borda direita */
.sidebar::after {
 content: '';
 position: absolute;
 right: 0;
 top: 0;
 bottom: 0;
 width: 1px;
 background: linear-gradient(to bottom, transparent, var(--red-dim) 40%, var(--red-dim) 60%, transparent);
 opacity: 0.4;
}

/* ── Header (logo + nome) ── */
.sidebar-header {
 padding: 24px 20px 20px;
 border-bottom: 1px solid var(--border);
 display: flex;
 align-items: center;
 gap: 12px;
}

.logo-mark {
 width: 64px;
 height: auto;
 flex-shrink: 0;
 object-fit: contain;
 filter: drop-shadow(0 0 10px rgba(196, 30, 30, 0.5));
}

.logo-text {
 font-family: 'Montserrat', sans-serif;
 font-size: 18px;
 font-weight: 700;
 letter-spacing: 3px;
 color: var(--white);
}

.logo-sub {
 font-size: 9px;
 letter-spacing: 2.5px;
 color: var(--red);
 text-transform: uppercase;
 margin-top: 1px;
}

/* ── Botão nova conversa ── */
.new-chat-btn {
 margin: 16px 16px 8px;
 padding: 10px 14px;
 background: transparent;
 border: 1px solid var(--border);
 border-radius: 8px;
 color: var(--muted-light);
 font-family: 'Open Sans', sans-serif;
 font-size: 13px;
 letter-spacing: 0.5px;
 cursor: pointer;
 display: flex;
 align-items: center;
 gap: 8px;
 transition: all 0.2s;
}

.new-chat-btn:hover {
 border-color: var(--red-dim);
 color: var(--white);
 background: var(--red-glow);
}

.new-chat-btn svg { opacity: 0.7; }

/* ── Seção (label "Recentes") ── */
.sidebar-section {
 padding: 12px 16px 4px;
 font-size: 10px;
 letter-spacing: 2px;
 text-transform: uppercase;
 color: var(--muted);
 font-weight: 500;
}

/* ── Lista de conversas ── */
.chat-list {
 flex: 1;
 overflow-y: auto;
 padding: 4px 8px 16px;
}

.chat-list::-webkit-scrollbar { width: 4px; }
.chat-list::-webkit-scrollbar-track { background: transparent; }
.chat-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Chat items ── */
.chat-item {
 padding: 9px 12px;
 border-radius: 7px;
 font-size: 13px;
 color: var(--muted-light);
 cursor: pointer;
 transition: all 0.15s;
 margin-bottom: 1px;
 border: 1px solid transparent;
 display: flex;
 align-items: center;
 gap: 6px;
}

.chat-item-title {
 flex: 1;
 white-space: nowrap;
 overflow: hidden;
 text-overflow: ellipsis;
}

.chat-item-delete {
 background: none;
 border: none;
 color: var(--muted);
 cursor: pointer;
 padding: 2px;
 border-radius: 4px;
 display: flex;
 align-items: center;
 opacity: 0;
 transition: all 0.15s;
 flex-shrink: 0;
}

.chat-item:hover .chat-item-delete { opacity: 1; }
.chat-item-delete:hover { color: var(--red); background: rgba(196, 30, 30, 0.1); }

.chat-item:hover {
 background: var(--bg-panel);
 color: var(--white);
}

.chat-item.active {
 background: var(--bg-panel);
 border-color: var(--border);
 color: var(--white);
}

.chat-item.active::before {
 content: '';
 display: inline-block;
 width: 5px;
 height: 5px;
 background: var(--red);
 border-radius: 50%;
 margin-right: 4px;
 flex-shrink: 0;
 box-shadow: 0 0 6px var(--red);
}

/* ── Close button (mobile) ── */
.sidebar-close {
 display: none;
 position: absolute;
 top: 16px;
 right: 12px;
 background: none;
 border: none;
 color: var(--muted);
 cursor: pointer;
 padding: 4px;
 z-index: 10;
}

.sidebar-close:hover { color: var(--white); }

/* ── Footer (avatar + nome do usuario) ── */
.sidebar-footer {
 padding: 12px 16px;
 border-top: 1px solid var(--border);
 display: flex;
 align-items: center;
 gap: 10px;
 cursor: pointer;
 transition: background 0.15s;
 border-radius: 0;
}

.sidebar-footer:hover { background: var(--bg-panel); }

.avatar-sm {
 width: 32px;
 height: 32px;
 background: linear-gradient(135deg, var(--red-dim), var(--red));
 border-radius: 50%;
 display: flex;
 align-items: center;
 justify-content: center;
 font-family: 'Montserrat', sans-serif;
 font-size: 12px;
 color: #f0ece6;
 flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Google avatar image */
.avatar-img {
 width: 32px;
 height: 32px;
 border-radius: 50%;
 object-fit: cover;
 flex-shrink: 0;
 border: 1px solid var(--border);
}

/* Logout button */
.logout-btn {
 background: none;
 border: none;
 color: var(--muted);
 cursor: pointer;
 padding: 6px;
 border-radius: 6px;
 display: flex;
 align-items: center;
 transition: all 0.2s;
 flex-shrink: 0;
}

.logout-btn:hover {
 color: var(--red);
 background: rgba(196, 30, 30, 0.1);
}

/* ── Menu button (topbar, mobile) ── */
.menu-btn {
 display: none;
 background: none;
 border: none;
 color: var(--muted-light);
 cursor: pointer;
 padding: 4px;
}

.menu-btn:hover { color: var(--white); }

/* ── Brand logo (OpusMultipla) ── */
/*
 * PORQUE: Logo do cliente no footer reforça branding institucional
 * sem competir com a marca Athena no header. Opacity baixa = sutil.
 */
.sidebar-brand {
 margin-top: auto;
 padding: 12px 20px 4px;
 text-align: center;
}

.brand-logo {
 max-width: 100px;
 height: auto;
 opacity: 0.35;
 filter: grayscale(0.3);
 transition: opacity 0.3s ease, filter 0.3s ease;
}

.brand-logo:hover {
 opacity: 0.6;
 filter: grayscale(0);
}

/* ── Responsive: mobile sidebar ── */
@media (max-width: 768px) {

 .sidebar {
 position: fixed;
 top: 0;
 left: 0;
 bottom: 0;
 z-index: 100;
 transform: translateX(-100%);
 transition: transform 0.25s ease;
 }

 body.sidebar-open .sidebar {
 transform: translateX(0);
 }

 body.sidebar-open::after {
 content: '';
 position: fixed;
 inset: 0;
 background: rgba(0, 0, 0, 0.5);
 z-index: 99;
 }

 .sidebar-close { display: flex; }
 .menu-btn { display: flex; }
}

/* -- Skeleton shimmer (loading state) -- */
/*
 * PORQUE: Quando conversas carregam do BigQuery, a sidebar fica vazia.
 * Skeleton shimmer da feedback visual imediato de que dados estao chegando.
 * Usa anim-shimmer ja definido em animations.css.
 */
.sidebar-skeleton {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 36px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--bg-panel) 25%, var(--bg-surface) 50%, var(--bg-panel) 75%);
  background-size: 200% 100%;
  animation: shimmerSlide 1.5s ease-in-out infinite;
}

.skeleton-line:nth-child(2) { width: 85%; }
.skeleton-line:nth-child(3) { width: 70%; }

.chat-list-empty {
  padding: 20px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
