/* Reset e Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Nova Palette - Tema Roxo/Azul Moderno */
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --success-color: #48bb78;
  --danger-color: #f56565;
  --warning-color: #f6ad55;
  --info-color: #4299e1;
  --light-bg: #f7fafc;
  --dark-text: #2d3748;
  --sidebar-width: 260px;
  --header-height: 60px;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--light-bg);
  color: var(--dark-text);
  line-height: 1.6;
}

/* Sidebar - Gradiente Roxo */
/* Sidebar - Gradiente Roxo */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(135deg,
      var(--primary-color) 0%,
      var(--secondary-color) 100%);
  color: white;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

/* ... existing code ... */

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
  /* Custom scrollbar for sidebar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

/* ... existing code ... */

.sidebar-footer {
  /* position: relative; removed absolute */
  width: 100%;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.sidebar-header i {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.sidebar-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* ... items ... */

.sidebar-footer {
  width: 100%;
  padding: 1rem;
  background-color: #764ba2 !important;
  /* Solid Purple */
  color: #ffffff !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 9999 !important;
}

.sidebar-footer .user-info i,
.sidebar-footer .user-info strong,
.sidebar-footer .user-info small {
  color: #ffffff !important;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.nav-item i {
  margin-right: 0.75rem;
  width: 20px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: white;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  border-left-color: white;
}

.nav-item-danger:hover {
  background: rgba(245, 101, 101, 0.2);
}

/* Submenus */
.nav-item-parent {
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.nav-item-parent i.fas.fa-chevron-down {
  transition: transform 0.3s ease;
  margin-left: auto;
  width: auto;
}

.nav-item-parent.open i.fas.fa-chevron-down {
  transform: rotate(180deg);
}

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.1);
}

.nav-submenu.open {
  max-height: 2000px;
  /* Increased to accommodate long menus like Relatórios Financeiros */
  overflow: visible;
  /* Allow content to show fully if it expands */
}

.nav-submenu-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem 0.75rem 3rem;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.nav-submenu-item i {
  margin-right: 0.75rem;
  width: 16px;
  font-size: 0.85rem;
}

.nav-submenu-item:hover {
  background: rgba(255, 255, 255, 0.05);
  padding-left: 3.5rem;
}

/* 3rd Level Menu */
.nav-submenu-nested {
  background: rgba(0, 0, 0, 0.15);
  padding-bottom: 0.5rem;
}

.nav-submenu-nested .nav-submenu-item {
  padding-left: 4.5rem;
}

.nav-submenu-nested .nav-submenu-item:hover {
  padding-left: 5rem;
}

.nav-divider {
  margin: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-info i {
  font-size: 2rem;
}

.user-info strong {
  display: block;
  font-size: 0.9rem;
}

.user-info small {
  display: block;
  opacity: 0.8;
  font-size: 0.75rem;
}

/* Menu Toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 2rem;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 {
  font-size: 2rem;
  color: var(--dark-text);
}

.page-header h1 i {
  color: var(--primary-color);
  margin-right: 0.5rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  background: linear-gradient(135deg,
      var(--primary-color),
      var(--secondary-color));
}

.stat-info h3 {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.stat-info p {
  color: #718096;
  font-size: 0.9rem;
}

/* Dashboard Section */
.dashboard-section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.dashboard-section h2 {
  margin-bottom: 1rem;
  color: var(--dark-text);
}

.dashboard-section h2 i {
  color: var(--primary-color);
  margin-right: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.3s ease;
  font-weight: 500;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #4a5568;
  color: white;
}

.btn-secondary:hover {
  background: #2d3748;
}

.btn-info {
  background: var(--info-color);
  color: white;
}

.btn-info:hover {
  background: #3182ce;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background: #e53e3e;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Alerts */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideDown 0.5s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success {
  background: #c6f6d5;
  color: #22543d;
  border-left: 4px solid var(--success-color);
}

.alert-danger {
  background: #fed7d7;
  color: #742a2a;
  border-left: 4px solid var(--danger-color);
}

/* Tables */
.table-responsive {
  background: white;
  border-radius: 12px;
  overflow-x: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: linear-gradient(135deg,
      var(--primary-color),
      var(--secondary-color));
  color: white;
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.table tbody tr {
  transition: background 0.3s ease;
}

.table tbody tr:hover {
  background: #f7fafc;
}

.table .actions {
  display: flex;
  gap: 0.5rem;
}

.text-center {
  text-align: center;
}

/* Toggle Switch Estilo iOS */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  background-color: #cbd5e0;
  border-radius: 34px;
  transition: 0.4s;
  cursor: pointer;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
  background-color: var(--success-color);
}

.toggle-switch input:checked+.toggle-slider:before {
  transform: translateX(24px);
}

.toggle-switch input:disabled+.toggle-slider {
  opacity: 0.6;
  cursor: not-allowed;
}

.toggle-label {
  font-size: 0.875rem;
  color: var(--dark-text);
  font-weight: 500;
}

/* Forms */
.form {
  max-width: 900px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--dark-text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
  font-family: inherit;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

/* Login Page - Gradiente Roxo */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg,
      var(--primary-color) 0%,
      var(--secondary-color) 100%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
}

.login-box {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header i {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.login-header h1 {
  font-size: 1.5rem;
  color: var(--dark-text);
}

.login-form .form-group {
  margin-bottom: 1.5rem;
}

.login-form label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--dark-text);
}

.login-form label i {
  color: var(--primary-color);
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: #a0aec0;
}

.login-footer i {
  color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 5rem 1rem 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .table {
    font-size: 0.875rem;
  }

  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: 1rem;
  }

  .login-box {
    padding: 1.5rem;
  }
}

/* Tabs Refinement */
.custom-tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 0;
  background: #f8fafc;
  border-radius: 12px 12px 0 0;
  padding: 0.5rem 0.5rem 0;
  gap: 0.5rem;
}

.tab-button {
  padding: 1rem 1.5rem;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  color: #64748b;
  font-weight: 500;
  background: transparent;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-button:hover {
  color: var(--primary-color);
  background: rgba(102, 126, 234, 0.05);
}

.tab-button.active {
  color: var(--primary-color);
  border-bottom: 3px solid var(--primary-color);
  background: white;
}

.tab-content-wrapper {
  background: white;
  padding: 2rem;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.status-pill:hover {
  transform: scale(1.05);
}

.status-pill button {
  opacity: 0.7;
  transition: opacity 0.2s;
}

.status-pill button:hover {
  opacity: 1;
}

.card {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Missing Tab Content Styles */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Table Adjustments */
.dataTables_wrapper .row {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

table.dataTable thead th,
table.dataTable thead td {
  padding: 10px 10px;
  border-bottom: 1px solid #e2e8f0;
}

table.dataTable.no-footer {
  border-bottom: 1px solid #e2e8f0;
}

/* Filter Inputs */
input[type="date"].form-control,
select.form-control {
  min-height: 42px;
  /* Ensure consistent height */
}

/* Resumo Styles */
.btn-resumo {
  background: white;
  width: 100%;
  padding: 1rem 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
  transition: all 0.2s;
  outline: none;
}

.btn-resumo:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.resumo-content {
  background: white;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 1.5rem;
  margin-top: -8px;
  /* Connect with button */
  display: none;
  animation: slideDown 0.3s ease;
}

.resumo-content.open {
  display: block;
}

.resumo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.resumo-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #edf2f7;
}

.resumo-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.resumo-info {
  display: flex;
  flex-direction: column;
}

.resumo-info small {
  font-size: 0.75rem;
  color: #718096;
  text-transform: uppercase;
  font-weight: 600;
}

.resumo-info strong {
  font-size: 1.1rem;
  color: #2d3748;
}

.status-grid-count {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.status-count-item {
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.count-number {
  font-size: 1.1rem;
  font-weight: 800;
}

.count-label {
  font-size: 0.85rem;
  color: #4a5568;
}