/* Tokens do tema */
:root {
  --rs-primary: #2563eb;
  --rs-secondary: #64748b;
  --rs-success: #16a34a;
  --rs-warning: #f59e0b;
  --rs-danger:  #dc2626;
  --rs-info:    #0ea5e9;
  --rs-surface: #ffffff;
  --rs-muted:   #f8fafc;
  --rs-navbar-bg: #1e3a8a;
  --rs-sidebar-bg: #172554;
}

[data-bs-theme="dark"] {
  --rs-surface: #0f172a; /* Cor de fundo dos cards */
  --rs-muted:   #020617; /* Cor de fundo principal */
  --rs-primary: #16a34a;
  --rs-secondary: #7a8b85;
  --rs-navbar-bg: #0f172a;
  --rs-sidebar-bg: #0f172a;
}

/* Mapeamento para Bootstrap */
:root, [data-bs-theme="light"] {
  --bs-primary: var(--rs-primary);
  --bs-secondary: var(--rs-secondary);
  --bs-success: var(--rs-success);
  --bs-warning: var(--rs-warning);
  --bs-danger: var(--rs-danger);
  --bs-info: var(--rs-info);
}

/* Layout */
body {
  background-color: var(--rs-muted);
}

/* Navbar verde-escuro */
.navbar {
  background-color: var(--rs-navbar-bg) !important;
  color: #fff;
}
.navbar .navbar-brand, .navbar .nav-link, .navbar .btn {
  color: #fff;
}
.navbar .btn-outline-secondary {
  color: #fff;
  border-color: rgba(255,255,255,.35);
}
.navbar .btn-outline-secondary:hover {
  background-color: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.5);
}

/* Cards */
.card {
  border: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
}

/* Tabelas */
.table {
  border-radius: .5rem;
  overflow: hidden;
}
.table thead th {
  background-color: var(--rs-surface);
  border-bottom-width: 1px;
}
.table tbody tr:hover {
  background-color: rgba(37, 99, 235, 0.08);
}

/* Botões de ação compactos */
.btn-sm i {
  pointer-events: none;
}

/* Badges de status */
.badge-status {
  font-weight: 600;
  letter-spacing: .2px;
}
.badge-registrado { background-color: rgba(22, 163, 74, .15); color: #16a34a; }
.badge-pendente   { background-color: rgba(234, 179, 8, .15); color: #a16207; }
.badge-falha      { background-color: rgba(220, 38, 38, .15); color: #dc2626; }

/* Sidebar verde-escuro */
.bg-dark {
  background-color: var(--rs-sidebar-bg) !important;
}
#menu a.nav-link {
  color: #e5e7eb;
  opacity: .9;
}
#menu a.nav-link:hover {
  opacity: 1;
}
#menu a.nav-link.active {
  background-color: rgba(22,163,74,.18);
  border-radius: .5rem;
}
#menu a.nav-link i {
  width: 1.25rem;
  text-align: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1040;
  background-color: rgba(2, 6, 23, 0.85);
  border-bottom: 1px solid rgba(255,255,255,.06);
  backdrop-filter: saturate(180%) blur(8px);
}

/* App shell (grid) */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 100vh;
  height: 100vh;
  overflow: hidden;
}
.app-sidebar {
  grid-column: 1;
  grid-row: 1;
  background-color: var(--rs-sidebar-bg) !important;
  overflow-y: auto;
}
.app-main-container {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-header {
  flex-shrink: 0;
}
.app-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem 1.25rem;
}

.dashboard-shell {
  background-color: var(--rs-surface);
  padding: 1.5rem;
  border-radius: 12px;
}

.kpi-card {
  background-color: var(--rs-surface);
  border-radius: 12px;
  border: none;
}

.kpi-label {
  color: #94a3b8;
  font-size: .85rem;
}

.sidebar .nav-link.active {
  background-color: var(--rs-primary) !important;
  color: #fff !important;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 80px 1fr;
}

.app-shell.sidebar-collapsed .sidebar-text {
  display: none;
}

.app-shell.sidebar-collapsed .app-sidebar .nav-link {
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-text,
.app-shell.sidebar-collapsed .sidebar-logo-text {
  display: none;
}

.logout-button {
  color: #94a3b8 !important;
  width: 100%;
  text-align: left;
}

.logout-button:hover {
  color: #fff !important;
  background-color: #dc2626 !important;
}

/* Estilos da nova sidebar */
.app-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

.app-sidebar nav a:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.app-sidebar nav a.active {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--bs-primary);
  font-weight: 500;
}

.app-sidebar .logout-button {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: #ef4444;
  background-color: transparent;
  border: none;
  text-align: left;
  transition: all 0.2s ease-in-out;
}

.app-sidebar .logout-button:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}


@media (max-width: 991.98px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    display: none;
  }
}

/* Estilos dos cards de KPI */
.custom-card {
  background-color: var(--rs-surface);
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 0.5rem;
}

.card-value-large {
  font-size: 2.25rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1;
}

.card-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  background-color: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}

.card-trend .material-icons-round {
  font-size: 1rem;
}

/* Estilos da tabela customizada */
.table-custom {
  width: 100%;
  border-collapse: collapse;
}

.table-custom thead th {
  font-size: 0.875rem;
  font-weight: 600;
  color: #94a3b8;
  text-align: left;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table-custom tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table-custom tbody tr:last-child {
  border-bottom: none;
}

.table-custom tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.table-custom td {
  padding: 1rem 1.5rem;
  vertical-align: middle;
}

.table-custom .customer-name {
  font-weight: 500;
  color: #f8fafc;
}

.table-custom .customer-document {
  font-size: 0.875rem;
  color: #94a3b8;
}

.table-custom .value {
  font-weight: 500;
  color: #f8fafc;
}

.table-custom .due-date {
  font-size: 0.875rem;
  color: #94a3b8;
}

/* Estilos das tags de status */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
}

.status-tag::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.status-paid {
  color: #16a34a;
  background-color: rgba(22, 163, 74, 0.1);
}
.status-paid::before {
  background-color: #16a34a;
}

.status-pending {
  color: #f59e0b;
  background-color: rgba(245, 158, 11, 0.1);
}
.status-pending::before {
  background-color: #f59e0b;
}

.status-overdue {
  color: #dc2626;
  background-color: rgba(220, 38, 38, 0.1);
}
.status-overdue::before {
  background-color: #dc2626;
}




.offcanvas.bg-dark {
  background-color: var(--rs-sidebar-bg) !important;
}

/* Alerts */
.alert {
  border: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* Utility classes */
.bg-surface {
  background-color: var(--rs-surface) !important;
}

/* Custom subtle backgrounds for dark mode to match design */
[data-bs-theme="dark"] .bg-success-subtle {
  background-color: rgba(22, 163, 74, 0.1) !important;
  color: #16a34a !important;
  border-color: rgba(22, 163, 74, 0.2) !important;
}

[data-bs-theme="dark"] .bg-primary-subtle {
  background-color: rgba(37, 99, 235, 0.1) !important;
  color: #3b82f6 !important;
  border-color: rgba(37, 99, 235, 0.2) !important;
}
[data-bs-theme="dark"] .text-primary {
  color: #3b82f6 !important;
}

[data-bs-theme="dark"] .bg-warning-subtle {
  background-color: rgba(245, 158, 11, 0.1) !important;
  color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.2) !important;
}

[data-bs-theme="dark"] .bg-info-subtle {
  background-color: rgba(14, 165, 233, 0.1) !important;
  color: #0ea5e9 !important;
  border-color: rgba(14, 165, 233, 0.2) !important;
}

[data-bs-theme="dark"] .bg-danger-subtle {
  background-color: rgba(220, 38, 38, 0.1) !important;
  color: #dc2626 !important;
  border-color: rgba(220, 38, 38, 0.2) !important;
}

[data-bs-theme="dark"] .bg-secondary-subtle {
  background-color: rgba(148, 163, 184, 0.1) !important;
  color: #94a3b8 !important;
  border-color: rgba(148, 163, 184, 0.2) !important;
}

/* Card refinements */
.card {
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-radius: 0.75rem; /* Rounded-xl */
}

/* Table refinements */
.table > :not(caption) > * > * {
  padding: 1rem 1.5rem;
  background-color: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Sidebar Utilities */
.hover-bg-white-5:hover {
  background-color: rgba(255, 255, 255, 0.05);
}
.text-white-hover:hover {
  color: #fff !important;
}
.hover-bg-danger-10:hover {
  background-color: rgba(220, 38, 38, 0.1);
  color: #ef4444 !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--rs-muted); 
}
::-webkit-scrollbar-thumb {
  background: #334155; 
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569; 
}

[data-bs-theme="light"] .topbar {
  background-color: #1e3a8a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}
[data-bs-theme="light"] .topbar .btn-outline-secondary {
  color: #fff;
  border-color: rgba(255,255,255,.35);
}
[data-bs-theme="light"] .topbar .btn-outline-secondary:hover {
  background-color: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.5);
}
[data-bs-theme="light"] .topbar .text-secondary {
  color: #e5e7eb !important;
}
[data-bs-theme="light"] .custom-card {
  border: 1px solid rgba(0, 0, 0, 0.05);
}
[data-bs-theme="light"] .card-label {
  color: #475569;
}
[data-bs-theme="light"] .card-value-large {
  color: #0f172a;
}
[data-bs-theme="light"] .table > :not(caption) > * > * {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}
[data-bs-theme="light"] .table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}
[data-bs-theme="light"] .table-custom thead th {
  color: #475569;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
[data-bs-theme="light"] .table-custom tbody tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
[data-bs-theme="light"] .table-custom .customer-name {
  color: #0f172a;
}
[data-bs-theme="light"] .table-custom .value {
  color: #0f172a;
}
