/* ARQUIVO: assets/css/chrome.css */

:root {
  --header-h: 64px;
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 70px;
  --bg-color: #f8f9fa;
  --line: #e2e8f0;
  --brand: #0b57d0;
  
  /* Cores Escuras do Menu */
  --sidebar-bg: #1e293b;
  --sidebar-text: #e2e8f0;
  --sidebar-hover: rgba(255,255,255,0.1);
}

/* RESET */
* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg-color);
  font-family: 'Segoe UI', system-ui, sans-serif;
  padding-top: var(--header-h) !important;
  padding-left: var(--sidebar-w) !important;
  transition: padding-left 0.3s ease;
  min-height: 100vh;
  display: flex; flex-direction: column; overflow-x: hidden;
}

/* === HEADER === */
.site-header {
  position: fixed !important; 
  top: 0; left: 0; right: 0; height: var(--header-h) !important;
  background: white; border-bottom: 1px solid var(--line); 
  
  /* CORREÇÃO AQUI: */
  /* Baixamos de 2000 para 1020 para ficar ABAIXO do Modal do Bootstrap (que é 1055) */
  z-index: 1020; 
  
  display: flex; align-items: center; padding: 0 20px; width: 100% !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.site-header .inner { width: 100%; display: flex; align-items: center; justify-content: space-between; }

/* LADO ESQUERDO */
.left { display: flex; align-items: center; gap: 15px; }

.btn.icon {
  background: transparent; border: 1px solid transparent; border-radius: 8px; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; cursor: pointer; color: #64748b;
  transition: 0.2s;
}
.btn.icon:hover { background: #f1f5f9; color: var(--brand); }

.brand { text-decoration: none; color: #1e293b; font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 8px; height: 8px; background: var(--brand); border-radius: 50%; display: block; }

/* MENU HORIZONTAL */
.nav-horizontal { display: flex; gap: 25px; margin-left: 30px; }
.navlink { text-decoration: none; color: #64748b; font-size: 14px; font-weight: 600; transition: color 0.2s; }
.navlink:hover, .navlink.active { color: var(--brand); }

/* === LADO DIREITO (PERFIL DO USUÁRIO) === */
.right { 
    margin-left: auto !important; 
    display: flex !important; 
    align-items: center; 
    gap: 15px; 
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 50px;
  padding: 5px 16px 5px 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 250px;
}

.user-pill:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  background-color: var(--brand);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
}

#user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-sm.primary {
  background: var(--brand); color: white; padding: 8px 20px;
  border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 600;
  transition: background 0.2s;
}
.btn-sm.primary:hover { background: #0842a0; }

/* === SIDEBAR === */
.site-sidebar {
  position: fixed !important; top: var(--header-h) !important; left: 0 !important; bottom: 0 !important;
  width: var(--sidebar-w) !important;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255,255,255,0.1);
  z-index: 1000;
  overflow-x: hidden;
  overflow-y: hidden; /* scroll fica no container interno (sidebar-content) */
  transition: width 0.3s ease;
  display: block !important;
}

/* Oculta a barra de rolagem do menu (mantém scroll via mouse/trackpad) */
.site-sidebar { scrollbar-width: none; -ms-overflow-style: none; }
.site-sidebar::-webkit-scrollbar { width: 0; height: 0; }

/* alguns navegadores aplicam o scrollbar no container interno; garantimos aqui também */
.sidebar-content { height: 100%; display: flex; flex-direction: column; overflow-y: auto; }
.sidebar-content { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-content::-webkit-scrollbar { width: 0; height: 0; }
body:not(.has-sidebar) .site-sidebar { display: none !important; }

.sidebar-inner { padding: 15px 10px; display: flex; flex-direction: column; gap: 5px; }

.side-item {
  display: flex; align-items: center; gap: 12px; padding: 12px; width: 100%;
  text-decoration: none; color: var(--sidebar-text);
  border-radius: 8px; font-size: 14px; background: none; border: none; cursor: pointer; text-align: left; white-space: nowrap;
}
.side-item:hover { background: var(--sidebar-hover); color: #fff; }
.side-item i { font-size: 22px; min-width: 24px; text-align: center; color: inherit; }
.side-title { font-size: 11px; font-weight: bold; color: #64748b; margin: 15px 0 5px 10px; white-space: nowrap; }

/* MODO RECOLHIDO */
body.sidebar-collapsed { padding-left: var(--sidebar-collapsed-w) !important; }
body.sidebar-collapsed .site-sidebar { width: var(--sidebar-collapsed-w) !important; }
body.sidebar-collapsed .label-text, body.sidebar-collapsed .side-title { display: none !important; opacity: 0; }
body.sidebar-collapsed .side-item { justify-content: center !important; padding: 12px 0 !important; }
body.sidebar-collapsed .side-item i { margin: 0 !important; }

/* MOBILE */
@media (max-width: 900px) {
  body, body.sidebar-collapsed { padding-left: 0 !important; }
  .nav-horizontal { display: none !important; }
  .site-sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; transition: transform 0.3s ease; }
  body.sidebar-open .site-sidebar { transform: translateX(0); box-shadow: 5px 0 15px rgba(0,0,0,0.2); }
  .sidebar-overlay { position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); z-index: 900; display: none; }
  body.sidebar-open .sidebar-overlay { display: block; }
  
  .user-pill { padding: 0; border: none; background: transparent; }
  #user-name { display: none; }
}

/* FOOTER */
#site-footer { margin-top: auto !important; width: 100%; position: relative; z-index: 10; }
.site-footer { padding: 20px; border-top: 1px solid #e2e8f0; background: #fff; text-align: center; font-size: 12px; color: #64748b; }
/* ===== UX FIX: evita flash branco enquanto o chrome ainda não foi injetado ===== */
#site-sidebar:empty {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width, 280px);
  height: 100vh;
  background: var(--sidebar-bg, #0b1f3a);
  z-index: 1030;
}

#site-header:empty {
  min-height: var(--header-height, 64px);
}
