/* ============================================================
   RZBoletos — Design System (DashUI-inspired)
   Bootstrap 5 base + sidebar layout + custom overrides
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --rz-primary:            #624bff;
  --rz-primary-dark:       #4835cc;
  --rz-primary-bg:         rgba(98, 75, 255, 0.08);
  --rz-primary-border:     rgba(98, 75, 255, 0.2);
  --rz-success:            #198754;
  --rz-warning:            #f59e0b;
  --rz-danger:             #dc3545;
  --rz-info:               #0dcaf0;
  --rz-gray-50:            #f8fafc;
  --rz-gray-100:           #f1f5f9;
  --rz-gray-200:           #e2e8f0;
  --rz-gray-300:           #cbd5e1;
  --rz-gray-400:           #94a3b8;
  --rz-gray-500:           #64748b;
  --rz-gray-600:           #475569;
  --rz-gray-700:           #334155;
  --rz-gray-800:           #1e293b;
  --rz-gray-900:           #0f172a;
  --rz-body-bg:            #f1f5f9;
  --rz-card-shadow:        0 1px 3px 0 rgba(0,0,0,.07), 0 1px 2px -1px rgba(0,0,0,.07);
  --rz-sidebar-width:      260px;
  --rz-topbar-height:      64px;
  --rz-sidebar-bg:         #ffffff;
  --rz-topbar-bg:          #ffffff;
  --rz-sidebar-border:     var(--rz-gray-200);
  --rz-sidebar-active-bg:  var(--rz-primary-bg);
  --rz-sidebar-active-clr: var(--rz-primary);
  --rz-sidebar-text:       var(--rz-gray-600);
  --rz-radius:             0.75rem;
  --rz-radius-sm:          0.5rem;
}

/* ── Base ───────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--rz-body-bg);
  color: var(--rz-gray-700);
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Layout Shell ───────────────────────────────────────────── */
.main-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: var(--rz-sidebar-width);
  right: 0;
  height: var(--rz-topbar-height);
  background: var(--rz-topbar-bg);
  border-bottom: 1px solid var(--rz-sidebar-border);
  z-index: 1020;
  transition: left .25s ease;
  display: flex;
  align-items: center;
}

.header .navbar-custom {
  width: 100%;
  padding: 0 1.5rem;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.app-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--rz-sidebar-width);
  height: 100vh;
  background: var(--rz-sidebar-bg);
  border-right: 1px solid var(--rz-sidebar-border);
  z-index: 1030;
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}

.app-menu .navbar-vertical {
  height: 100%;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  flex: 1;
  overflow: hidden;
  /* Override Bootstrap .navbar flex-direction: row */
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
}

.app-menu .navbar-vertical > .h-100 {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
}

/* Brand */
.app-menu .navbar-brand {
  padding: 1rem 1.25rem;
  margin: 0;
  text-decoration: none;
  border-bottom: 1px solid var(--rz-sidebar-border);
  display: flex;
  align-items: center;
  width: 100%;
  flex-shrink: 0;
}

/* Section headings */
.app-menu .navbar-heading {
  font-size: 0.7rem;
  letter-spacing: .08em;
  padding: 1rem 1rem 0.35rem;
  color: var(--rz-gray-400);
  font-weight: 600;
}

/* Nav items */
.app-menu .navbar-nav {
  padding: 0.5rem 0.75rem;
  flex: 1;
  width: 100%;
  min-width: 0;
}

.app-menu .nav-link {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-radius: var(--rz-radius-sm);
  color: var(--rz-sidebar-text);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.app-menu .nav-link:hover {
  background: var(--rz-gray-100);
  color: var(--rz-gray-800);
}

.app-menu .nav-link.active {
  background: var(--rz-primary-bg);
  color: var(--rz-primary);
  font-weight: 600;
}

.app-menu .nav-link .nav-icon {
  font-size: 1rem;
  flex-shrink: 0;
  opacity: 0.75;
}

.app-menu .nav-link.active .nav-icon {
  opacity: 1;
}

/* Submenu */
.app-menu .collapse .nav-link {
  font-size: 0.82rem;
  font-weight: 400;
  padding: 0.4rem 0.85rem;
  color: var(--rz-gray-500);
}

.app-menu .collapse .nav-link:hover,
.app-menu .collapse .nav-link.active {
  color: var(--rz-primary);
  background: var(--rz-primary-bg);
}

/* Collapse arrow */
.app-menu .has-arrow .arrow-icon {
  transition: transform .2s;
  opacity: 0.5;
  font-size: 0.65rem;
}

.app-menu .has-arrow[aria-expanded="true"] .arrow-icon {
  transform: rotate(180deg);
}

/* Bottom user section */
.app-menu .sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--rz-sidebar-border);
  flex-shrink: 0;
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  margin-left: var(--rz-sidebar-width);
  padding-top: var(--rz-topbar-height);
  min-height: 100vh;
  width: calc(100% - var(--rz-sidebar-width));
  transition: margin-left .25s ease, width .25s ease;
}

/* ── Sidebar toggle button ──────────────────────────────────── */
.sidebar-toggle-btn {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  border: 1px solid var(--rz-gray-200);
  background: var(--rz-sidebar-bg);
  color: var(--rz-gray-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--rz-primary-bg);
  border-color: var(--rz-primary-border);
  color: var(--rz-primary);
}

.sidebar-toggle-btn .fa-angles-left {
  transition: transform .25s ease;
}

/* ── Sidebar Mini — Desktop (ícones apenas) ─────────────────── */
@media (min-width: 992px) {
  body.sidebar-mini .app-menu {
    width: 64px;
    transform: none;
  }

  body.sidebar-mini .header {
    left: 64px;
  }

  body.sidebar-mini .page-content {
    margin-left: 64px;
    width: calc(100% - 64px);
  }

  /* Ocultar textos */
  body.sidebar-mini .sidebar-brand-text,
  body.sidebar-mini .app-menu .navbar-heading,
  body.sidebar-mini .nav-link-text,
  body.sidebar-mini .arrow-icon,
  body.sidebar-mini .sidebar-footer-text,
  body.sidebar-mini .sidebar-footer-logout {
    display: none !important;
  }

  /* Centralizar ícones */
  body.sidebar-mini .app-menu .nav-link {
    justify-content: center;
    padding: 0.65rem 0.5rem;
  }

  body.sidebar-mini .app-menu .nav-link .nav-icon {
    margin: 0 !important;
    font-size: 1.1rem;
    opacity: 1;
  }

  /* Brand centralizado */
  body.sidebar-mini .app-menu .navbar-brand {
    justify-content: center;
    padding: 1rem 0.5rem;
  }

  /* Ocultar sub-menus e separadores */
  body.sidebar-mini .app-menu .collapse,
  body.sidebar-mini .app-menu .navbar-nav > .mt-1 {
    display: none !important;
  }

  body.sidebar-mini .app-menu .navbar-nav {
    padding: 0.5rem 0.4rem;
  }

  /* Rodapé mini: centralizar avatar */
  body.sidebar-mini .app-menu .sidebar-footer {
    padding: 0.75rem 0.4rem;
  }

  body.sidebar-mini .app-menu .sidebar-footer > div {
    justify-content: center;
  }

  /* Girar seta do botão de recolher */
  body.sidebar-mini .sidebar-toggle-btn .fa-angles-left {
    transform: rotate(180deg);
  }
}

/* ── Overlay (mobile) ───────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1025;
  backdrop-filter: blur(1px);
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .app-menu {
    transform: translateX(calc(-1 * var(--rz-sidebar-width)));
  }

  .header {
    left: 0;
  }

  .page-content {
    margin-left: 0;
    width: 100%;
  }

  body.sidebar-open .app-menu {
    transform: translateX(0);
  }
}

/* ── Bootstrap overrides ────────────────────────────────────── */

/* Primary color */
.btn-primary, .bg-primary {
  background-color: var(--rz-primary) !important;
  border-color: var(--rz-primary) !important;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--rz-primary-dark) !important;
  border-color: var(--rz-primary-dark) !important;
}

.btn-primary {
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  border-radius: var(--rz-radius-sm);
  box-shadow: 0 2px 8px rgba(98,75,255,.25);
  transition: background .15s, box-shadow .15s, transform .1s;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-outline-primary {
  color: var(--rz-primary) !important;
  border-color: var(--rz-primary) !important;
}

.btn-outline-primary:hover {
  background-color: var(--rz-primary) !important;
  color: #fff !important;
}

.text-primary { color: var(--rz-primary) !important; }
.border-primary { border-color: var(--rz-primary) !important; }

a { color: var(--rz-primary); }

/* Cards */
.card {
  border: 1px solid var(--rz-gray-200);
  border-radius: var(--rz-radius);
  box-shadow: var(--rz-card-shadow);
  background: #fff;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--rz-gray-200);
  padding: 1rem 1.25rem;
  font-weight: 600;
  border-radius: var(--rz-radius) var(--rz-radius) 0 0 !important;
}

.card-body {
  padding: 1.25rem;
}

/* Tables */
.table thead th {
  background: var(--rz-gray-50);
  color: var(--rz-gray-500);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rz-gray-200);
  border-top: none;
  white-space: nowrap;
}

.table tbody td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--rz-gray-100);
  color: var(--rz-gray-700);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-hover tbody tr:hover td {
  background: var(--rz-gray-50);
}

/* Forms */
.form-control, .form-select {
  border-color: var(--rz-gray-200);
  border-radius: var(--rz-radius-sm);
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  color: var(--rz-gray-700);
  background-color: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--rz-primary);
  box-shadow: 0 0 0 3px rgba(98,75,255,.12);
  outline: none;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--rz-gray-600);
  margin-bottom: 0.4rem;
}

/* Badges */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35em 0.65em;
  border-radius: 0.35rem;
  letter-spacing: .02em;
}

.badge.rounded-pill { border-radius: 9999px; }

/* Soft backgrounds (status badges) */
.bg-soft-success  { background-color: rgba(25, 135, 84, .1)  !important; }
.bg-soft-danger   { background-color: rgba(220, 53, 69, .1)   !important; }
.bg-soft-warning  { background-color: rgba(245, 158, 11, .1)  !important; }
.bg-soft-info     { background-color: rgba(13, 202, 240, .1)  !important; }
.bg-soft-primary  { background-color: rgba(98, 75, 255, .1)   !important; }
.bg-soft-secondary{ background-color: rgba(100, 116, 139, .1) !important; }

.text-soft-success  { color: var(--rz-success)  !important; }
.text-soft-danger   { color: var(--rz-danger)   !important; }
.text-soft-warning  { color: var(--rz-warning)  !important; }

/* KPI Cards */
.kpi-card {
  border: none;
  border-radius: var(--rz-radius);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--rz-card-shadow);
  background: #fff;
}

.kpi-card .kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--rz-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.kpi-card .kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--rz-gray-800);
}

.kpi-card .kpi-label {
  font-size: 0.78rem;
  color: var(--rz-gray-500);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

/* Topbar search */
.topbar-search {
  position: relative;
  min-width: 240px;
}

.topbar-search input {
  background: var(--rz-gray-100);
  border: none;
  border-radius: 9999px;
  padding: 0.45rem 1rem 0.45rem 2.5rem;
  font-size: 0.82rem;
  color: var(--rz-gray-600);
  width: 100%;
}

.topbar-search input:focus {
  box-shadow: 0 0 0 2px var(--rz-primary-border);
  outline: none;
}

.topbar-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rz-gray-400);
  font-size: 0.85rem;
}

/* Avatar */
.avatar {
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

/* Modals */
.modal-content {
  border: none;
  border-radius: var(--rz-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

.modal-header {
  border-bottom: 1px solid var(--rz-gray-200);
  padding: 1.1rem 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--rz-gray-200);
  padding: 0.9rem 1.5rem;
}

/* Dropdowns */
.dropdown-menu {
  border: 1px solid var(--rz-gray-200);
  border-radius: var(--rz-radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  padding: 0.4rem 0;
  font-size: 0.85rem;
}

.dropdown-item {
  padding: 0.5rem 1rem;
  color: var(--rz-gray-600);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0;
  transition: background .1s;
}

.dropdown-item:hover {
  background: var(--rz-gray-100);
  color: var(--rz-gray-800);
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  opacity: 0.7;
}

.dropdown-divider { border-color: var(--rz-gray-200); }

/* Alerts */
.alert {
  border: none;
  border-radius: var(--rz-radius-sm);
  font-size: 0.85rem;
  padding: 0.85rem 1rem;
}

/* Page title area */
.page-title-box {
  margin-bottom: 1.5rem;
}

.page-title-box h4, .page-title-box h3 {
  font-weight: 700;
  color: var(--rz-gray-800);
  margin-bottom: 0.2rem;
}

.page-title-box p {
  color: var(--rz-gray-500);
  font-size: 0.85rem;
  margin: 0;
}

/* Progress bars */
.progress {
  border-radius: 9999px;
  background: var(--rz-gray-200);
}

.progress-bar {
  background: var(--rz-primary);
  border-radius: 9999px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.8rem;
  margin-bottom: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--rz-gray-400);
}

.breadcrumb-item a {
  color: var(--rz-gray-500);
  text-decoration: none;
}

.breadcrumb-item.active {
  color: var(--rz-gray-700);
  font-weight: 500;
}

/* Simplebar (scrollbar customization) */
.simplebar-scrollbar::before {
  background: var(--rz-gray-300);
  border-radius: 4px;
}

/* Auth layout */
.auth-wrapper {
  min-height: 100vh;
  background: var(--rz-gray-50);
}

.auth-card {
  max-width: 440px;
  width: 100%;
  border-radius: 1.25rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.1);
}

/* ── Utility classes ────────────────────────────────────────── */
.dropdown-menu-notification { min-width: 300px; }
.progress-sm { height: 8px; }
.cursor-pointer  { cursor: pointer; }
.rounded-rz      { border-radius: var(--rz-radius); }
.rounded-rz-sm   { border-radius: var(--rz-radius-sm); }
.fs-7            { font-size: 0.82rem !important; }
.fs-8            { font-size: 0.72rem !important; }
.fw-semibold     { font-weight: 600 !important; }
.text-muted      { color: var(--rz-gray-400) !important; }
.text-secondary  { color: var(--rz-gray-500) !important; }

/* Icon boxes (substituem width/height inline) */
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--rz-radius-sm);
}
.icon-box-xs  { width: 24px; height: 24px; font-size: .7rem; }
.icon-box-sm  { width: 32px; height: 32px; font-size: .9rem; }
.icon-box-md  { width: 40px; height: 40px; font-size: 1rem;  }
.icon-box-lg  { width: 48px; height: 48px; font-size: 1.2rem; }

/* Avatar circles (substituem width/height + border-radius inline) */
.avatar-xs { width: 24px; height: 24px; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar-md { width: 40px; height: 40px; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Bg primary soft (substitui style="background:var(--rz-primary-bg)") */
.bg-primary-soft   { background-color: var(--rz-primary-bg)   !important; }
.bg-success-soft   { background-color: rgba(25,135,84,.1)      !important; }
.bg-warning-soft   { background-color: rgba(245,158,11,.1)     !important; }
.bg-danger-soft    { background-color: rgba(220,53,69,.1)      !important; }
.bg-secondary-soft { background-color: rgba(100,116,139,.1)    !important; }
.bg-info-soft      { background-color: rgba(13,202,240,.1)     !important; }

/* Text primary via var (substitui style="color:var(--rz-primary)") */
.text-primary  { color: var(--rz-primary)  !important; }
.text-warning  { color: var(--rz-warning)  !important; }
.text-danger   { color: var(--rz-danger)   !important; }
.text-success  { color: var(--rz-success)  !important; }
.text-info     { color: var(--rz-info)     !important; }

/* Topbar icon button (substitui style= de width/height/background nos botões da topbar) */
.btn-topbar {
  width: 36px;
  height: 36px;
  background: var(--rz-gray-100);
  border: none;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--rz-gray-500);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.btn-topbar:hover {
  background: var(--rz-gray-200);
  color: var(--rz-gray-700);
}

/* Sidebar brand icon box */
.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--rz-primary);
  border-radius: var(--rz-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Sidebar footer avatar */
.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  background: var(--rz-primary-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Admin pill badge */
.badge-admin {
  color: var(--rz-warning);
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: .78rem;
  font-weight: 600;
}

/* Sidebar nav warning item */
.nav-link-warning {
  color: var(--rz-warning) !important;
}
.nav-link-warning .nav-icon {
  color: var(--rz-warning) !important;
}

/* Code snippets */
code {
  color: var(--rz-primary);
  background: var(--rz-primary-bg);
  padding: 0.15em 0.45em;
  border-radius: 0.25rem;
  font-size: 0.82em;
}
