/* ============================================================
   NexoERP — Layout CSS
   Apple.com Design Language — Sidebar, Topbar, conteúdo
   ============================================================ */

/* ── Login ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 390px;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  box-shadow: var(--shadow-lg);
  /* sem border — apple usa shadow para separar, não border */
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.76rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.login-logo p {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* ── App layout ── */
.app { display: none; min-height: 100vh; }
.app.visible { display: flex; }

/* ────────────────────────────────────────
   SIDEBAR — vidro fosco, igual menu apple
   ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  /* nav apple.com: rgba(255,255,255,.72) + saturate(180%) blur(20px) */
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 2px;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: background var(--transition);
}

.sidebar-logo {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.nav-item {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  color: var(--text-tertiary);
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  background: transparent;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  transform: translate(30%, 30%);
  background: #f44336;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  line-height: 1;
  box-sizing: border-box;
}

/* Tooltip */
.nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s;
  z-index: 200;
  box-shadow: var(--shadow-md);
}

.nav-item:hover::after { opacity: 1; }
.sidebar-spacer { flex: 1; }

.nav-badge {
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--bg-surface);
}

/* ────────────────────────────────────────
   TOPBAR — idêntico ao nav do apple.com
   ─────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 90;
  gap: 14px;
  transition: background var(--transition);
}

.topbar-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  letter-spacing: -0.018em;
}

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

.theme-toggle {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.user-avatar:hover { opacity: 0.82; }

/* ── Conteúdo principal ── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
  padding: 28px;   /* apple usa padding generoso */
  transition: all var(--transition);
}

/* Página */
.page {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: pageIn 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.page.active { display: flex; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: var(--topbar-h);
    flex-direction: row;
    bottom: 0; top: auto;
    border-right: none;
    border-top: 0.5px solid var(--border);
    padding: 0 10px;
  }
  .sidebar-logo, .sidebar-spacer { display: none; }
  .nav-item::after { display: none; }
  .main-content { margin-left: 0; margin-bottom: var(--topbar-h); padding: 16px; }
  .topbar { left: 0; }
}
