/* ============================================================
   NovoFinance — Layout (Bootstrap 5 + sidebar compacta)
   ============================================================ */

:root {
  --nf-sidebar-width: 250px;
  --nf-sidebar-collapsed: 68px;
  --nf-topbar-height: 60px;
  --nf-sidebar-bg: #1e293b;
  --nf-sidebar-hover: #334155;
  --nf-sidebar-active: #0ea5e9;
  --nf-sidebar-text: #cbd5e1;
  --nf-content-bg: #f1f5f9;
}

* { box-sizing: border-box; }

body.app-body {
  margin: 0;
  background: var(--nf-content-bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Wrapper ---------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--nf-sidebar-width);
  background: var(--nf-sidebar-bg);
  color: var(--nf-sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nf-topbar-height);
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar-brand i { font-size: 1.3rem; color: var(--nf-sidebar-active); }
.sidebar-brand-text { transition: opacity 0.2s; }

.sidebar-close { color: #94a3b8 !important; padding: 0 !important; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
  flex-shrink: 0;
}
.avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--nf-sidebar-active);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user-info { line-height: 1.2; overflow: hidden; }
.sidebar-user-info strong { color: #fff; display: block; font-size: 0.9rem; }
.sidebar-user-info small { font-size: 0.75rem; opacity: 0.75; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 20px;
}
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--nf-sidebar-text);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 2px;
  white-space: nowrap;
  font-size: 0.92rem;
}
.sidebar-nav .nav-link i {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-nav .nav-link:hover { background: var(--nf-sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--nf-sidebar-active); color: #fff; }

.sidebar-section-label {
  padding: 14px 12px 4px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.55;
  white-space: nowrap;
}

/* ---------- App main (full width) ---------- */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--nf-sidebar-width);
  transition: margin-left 0.25s ease;
  width: calc(100% - var(--nf-sidebar-width));
}

/* ---------- Sidebar colapsada (desktop) ---------- */
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar { width: var(--nf-sidebar-collapsed); }
  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .sidebar-user-info,
  body.sidebar-collapsed .sidebar-nav .nav-link span,
  body.sidebar-collapsed .sidebar-section-label span {
    display: none;
  }
  body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; padding: 10px 0; }
  body.sidebar-collapsed .sidebar-section-label { text-align: center; padding: 14px 0 4px; }
  body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 14px 8px; }

  body.sidebar-collapsed .app-main { margin-left: var(--nf-sidebar-collapsed); width: calc(100% - var(--nf-sidebar-collapsed)); }
}

/* ---------- Mobile: sidebar vira offcanvas ---------- */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: var(--nf-sidebar-width) !important; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .app-main { margin-left: 0; }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1030;
}
@media (max-width: 991.98px) {
  body.sidebar-open .sidebar-overlay { display: block; }
}

/* ---------- Topbar ---------- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--nf-topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
}
.btn-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; }

/* ---------- Conteúdo ---------- */
.app-content { padding: 24px; width: 100%; max-width: 100%; }
.app-content .card,
.app-content .table-responsive { width: 100%; }

/* ---------- Topbar: global search ---------- */
.topbar-search { flex: 1; max-width: 560px; min-width: 180px; }
.topbar-search .input-group-text { background: #f8fafc; }
.topbar-search .form-control:focus { box-shadow: none; border-color: #0ea5e9; }

/* ---------- Cards de estatística ---------- */
.stat-card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stat-card .stat-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-card .stat-label { color: #64748b; font-size: 0.85rem; }

/* ---------- Tabelas ---------- */
.table-card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.table-card .card-header { background: #fff; border-radius: 12px 12px 0 0 !important; }

/* ---------- Auth ---------- */
body.auth-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  min-height: 100vh;
}
.auth-card { border: none; border-radius: 14px; }
.auth-logo { font-size: 2.6rem; color: #0ea5e9; }
