/* ============================================================
   LAYOUT — sidebar, header, área principal
   ============================================================ */

/* Wrapper raiz */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width var(--duration) var(--ease);
  position: relative;
  z-index: 40;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-white);
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  border-radius: 0;
  transition: background var(--duration), color var(--duration);
  cursor: pointer;
  position: relative;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-white);
}

.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: var(--text-white);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; overflow: hidden; }
.sidebar-user .user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-white);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
}

/* ── MAIN AREA ── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── HEADER ── */
.header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 30;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.header-title span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botão primário */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand);
  color: white;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--duration);
  border: none;
  cursor: pointer;
}

.btn-primary:hover { background: var(--brand-light); }

/* Botão secundário */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all var(--duration);
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-col);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* Botão ícone */
.btn-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--duration);
  font-size: 16px;
  border: 1px solid transparent;
}

.btn-icon:hover {
  background: var(--bg-col);
  border-color: var(--border);
  color: var(--text-primary);
}

/* Input de busca no header */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-col);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 34px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--duration);
  min-width: 200px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
}

.search-box:focus-within {
  background: white;
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(37,86,168,0.12);
}

/* ── CONTEÚDO DA PÁGINA ── */
.page-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Filtros/barra de ferramentas abaixo do header */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration);
}

.filter-chip:hover { border-color: var(--brand-light); color: var(--brand); }
.filter-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

select.filter-select {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  font-size: 12px;
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
}

select.filter-select:focus {
  border-color: var(--brand-light);
}

/* Responsivo */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .logo-text,
  .sidebar .logo-sub,
  .sidebar .nav-item span,
  .sidebar-footer .user-info,
  .nav-section-label { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item .nav-icon { width: auto; }
  .sidebar-logo { justify-content: center; padding: 16px; }
  .sidebar-logo .logo-icon { margin: 0; }
  .sidebar-user { justify-content: center; }
  .sidebar-user .avatar { margin: 0; }
}

/* ── LOGO SUPER+LINK NA SIDEBAR ── */
.sidebar-logo {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}

.sidebar-logo-img {
  width: 140px;
  height: auto;
  object-fit: contain;
}

/* Botão logout compacto na sidebar */
.btn-logout-sidebar {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--duration);
  padding: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.btn-logout-sidebar:hover { opacity: 1; }
