/*
 * layout.css — Estrutura de layout: sidebar, topbar, main, footer
 * Saci Digital · v2.0
 */

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  border-right: 1px solid rgba(255,255,255,.07);
  transition: width .25s ease;
}
#sidebar.collapsed { width: 70px; }

/* Logo */
.sb-logo {
  padding: 18px 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  min-height: 64px;
}
.sb-logo .logo-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #F97316, #FBBF24);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.sb-logo .logo-text         { transition: opacity .2s; }
.sb-logo .logo-name         { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: #fff; letter-spacing: -.3px; }
.sb-logo .logo-sub          { font-size: 9px; color: rgba(255,255,255,.32); letter-spacing: .8px; text-transform: uppercase; }
#sidebar.collapsed .logo-text { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }

/* Nav */
.sb-nav  { flex: 1; padding: 12px 10px; overflow: hidden; }
.sb-group-label {
  font-size: 9.5px; font-weight: 700; color: rgba(255,255,255,.26);
  letter-spacing: 1.3px; text-transform: uppercase;
  padding: 0 8px; margin-bottom: 6px; margin-top: 14px;
  white-space: nowrap; transition: opacity .2s;
}
#sidebar.collapsed .sb-group-label { opacity: 0; }

.nav-btn {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; border: none;
  background: transparent; color: rgba(255,255,255,.42);
  font-family: var(--font-body); font-size: 13px; font-weight: 400;
  text-align: left; transition: var(--transition-fast);
  margin-bottom: 2px; white-space: nowrap;
}
.nav-btn:hover         { background: rgba(255,255,255,.07); color: #fff; }
.nav-btn.active        { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; }
.nav-btn .nav-icon     { font-size: 17px; flex-shrink: 0; }
.nav-btn .nav-label    { transition: opacity .2s; overflow: hidden; }
.nav-btn .nav-dot      { width: 6px; height: 6px; border-radius: 50%; background: var(--tealL); margin-left: auto; flex-shrink: 0; opacity: 0; transition: opacity .2s; }
.nav-btn.active .nav-dot { opacity: 1; }

#sidebar.collapsed .nav-btn .nav-label,
#sidebar.collapsed .nav-btn .nav-dot { opacity: 0; width: 0; }
#sidebar.collapsed .nav-btn { padding: 10px 16px; justify-content: center; }

/* User */
.sb-user { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 10px; }
.sb-avatar {
  width: 35px; height: 35px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--tealL));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 12px; color: #fff;
}
.sb-user-info .user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.sb-user-info .user-role { font-size: 10px; color: rgba(255,255,255,.32); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
#sidebar.collapsed .sb-user-info { opacity: 0; width: 0; overflow: hidden; }

/* ════════════════════════════════════════
   MAIN
════════════════════════════════════════ */
#main {
  flex: 1;
  display: flex; flex-direction: column;
  margin-left: var(--sidebar-w);
  transition: margin-left .25s ease;
  min-width: 0;
}
#main.expanded { margin-left: 70px; }

/* ── Top Bar ────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--bgCard);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; flex-shrink: 0;
}
.topbar-left   { display: flex; align-items: center; gap: 12px; }
.topbar-right  { display: flex; align-items: center; gap: 10px; }
.topbar-title  { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--text1); letter-spacing: -.3px; }
.topbar-sub    { font-size: 11px; color: var(--text3); }
.topbar-badge  { font-size: 11px; color: var(--text3); }

.toggle-btn {
  width: 36px; height: 36px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text2);
  transition: var(--transition-fast);
}
.toggle-btn:hover { background: var(--border); }

.flt-sel {
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg);
  font-size: 12px; color: var(--text2);
  font-family: var(--font-body); outline: none;
}

.tb-btn {
  padding: 7px 14px; border-radius: 8px; border: none;
  font-size: 12px; font-weight: 600;
  font-family: var(--font-body);
  transition: var(--transition-fast);
  display: flex; align-items: center; gap: 5px;
}
.btn-ghost   { background: var(--bg); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { opacity: .88; }

/* ── Content ─────────────────────────────── */
#content { flex: 1; overflow-y: auto; padding: 26px 28px 60px; }

/* ── Footer ──────────────────────────────── */
#footer {
  padding: 11px 28px;
  border-top: 1px solid var(--border);
  background: var(--bgCard);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text3);
  flex-shrink: 0;
}

/* ════════════════════════════════════════
   PAGES
════════════════════════════════════════ */
.page     { display: none; animation: fadeIn .3s ease; }
.page.active { display: block; }

/* ════════════════════════════════════════
   GRIDS
════════════════════════════════════════ */
.grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3    { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-kpi  { display: grid; grid-template-columns: repeat(auto-fill,minmax(195px,1fr)); gap: 14px; }
.grid-trails { display: grid; grid-template-columns: repeat(auto-fill,minmax(255px,1fr)); gap: 16px; }
.flex-col  { display: flex; flex-direction: column; gap: 18px; }
