/* ============================================
   DARK MODE - Overrides completos
   ============================================ */

/* Quando dark mode está ativo */
[data-theme="dark"],
body.dark-mode {
  /* Sobrescrever variáveis do style.css */
  --light: #121212 !important;
  --white: #1e1e1e !important;
  --dark: #ffffff !important;
  --gray: #b0b0b0 !important;
  --border: #333333 !important;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
  
  /* Cores de texto */
  color: #ffffff;
  background-color: #121212;
}

/* Body em dark mode */
[data-theme="dark"] body,
body.dark-mode {
  background-color: #121212;
  color: #ffffff;
}

/* ============================================
   COMPONENTES EM DARK MODE
   ============================================ */

/* Sidebar */
[data-theme="dark"] .sidebar,
body.dark-mode .sidebar {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  border-right: 1px solid #333;
}

/* Logo na sidebar - garantir visibilidade no modo escuro */
[data-theme="dark"] .sidebar-header .logo-link,
body.dark-mode .sidebar-header .logo-link {
  color: #ffffff;
}

[data-theme="dark"] .sidebar-header img,
body.dark-mode .sidebar-header img {
  filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) !important;
}

[data-theme="dark"] .sidebar-menu a,
body.dark-mode .sidebar-menu a {
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .sidebar-menu a:hover,
[data-theme="dark"] .sidebar-menu li.active a,
body.dark-mode .sidebar-menu a:hover,
body.dark-mode .sidebar-menu li.active a {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* Main Content */
[data-theme="dark"] .main-content,
body.dark-mode .main-content {
  background-color: #121212;
}

/* Cards */
[data-theme="dark"] .card,
body.dark-mode .card {
  background: #1e1e1e;
  border: 1px solid #333;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .card-header,
body.dark-mode .card-header {
  border-bottom-color: #333;
}

[data-theme="dark"] .card-header h3,
body.dark-mode .card-header h3 {
  color: #ffffff;
}

/* Page Header */
[data-theme="dark"] .page-header h1,
body.dark-mode .page-header h1 {
  color: #ffffff;
}

[data-theme="dark"] .page-header p,
body.dark-mode .page-header p {
  color: #b0b0b0;
}

/* Dashboard Cards */
[data-theme="dark"] .dashboard-cards .card,
body.dark-mode .dashboard-cards .card {
  background: #1e1e1e;
}

[data-theme="dark"] .card-info .amount,
body.dark-mode .card-info .amount {
  color: #ffffff;
}

[data-theme="dark"] .card-info h3,
body.dark-mode .card-info h3 {
  color: #b0b0b0;
}

/* Tables */
[data-theme="dark"] .table,
body.dark-mode .table {
  color: #ffffff;
}

[data-theme="dark"] .table th,
body.dark-mode .table th {
  color: #b0b0b0;
  border-bottom-color: #333;
}

[data-theme="dark"] .table td,
body.dark-mode .table td {
  border-bottom-color: #333;
}

[data-theme="dark"] .table tr:hover,
body.dark-mode .table tr:hover {
  background: #2a2a2a;
}

/* Form Inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background: #2a2a2a;
  border-color: #444;
  color: #ffffff;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus,
body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
  border-color: var(--md-primary);
  background: #333;
}

[data-theme="dark"] input::placeholder,
body.dark-mode input::placeholder {
  color: #666;
}

[data-theme="dark"] label,
body.dark-mode label {
  color: #b0b0b0;
}

/* Buttons */
[data-theme="dark"] .btn-secondary,
body.dark-mode .btn-secondary {
  background: #333;
  color: #ffffff;
  border: 1px solid #444;
}

[data-theme="dark"] .btn-secondary:hover,
body.dark-mode .btn-secondary:hover {
  background: #444;
}

/* Modal */
[data-theme="dark"] .modal-content,
body.dark-mode .modal-content {
  background: #1e1e1e;
  border: 1px solid #333;
}

[data-theme="dark"] .modal-header,
body.dark-mode .modal-header {
  border-bottom-color: #333;
}

[data-theme="dark"] .modal-header h3,
body.dark-mode .modal-header h3 {
  color: #ffffff;
}

/* Filters */
[data-theme="dark"] .filters,
[data-theme="dark"] .filters-advanced,
body.dark-mode .filters,
body.dark-mode .filters-advanced {
  background: #1e1e1e;
  border: 1px solid #333;
}

[data-theme="dark"] .filters label,
body.dark-mode .filters label {
  color: #b0b0b0;
}

/* Account Cards */
[data-theme="dark"] .account-card,
body.dark-mode .account-card {
  background: #1e1e1e;
  border: 1px solid #333;
}

[data-theme="dark"] .account-info h4,
body.dark-mode .account-info h4 {
  color: #ffffff;
}

[data-theme="dark"] .account-type,
body.dark-mode .account-type {
  color: #b0b0b0;
}

[data-theme="dark"] .account-balance,
body.dark-mode .account-balance {
  border-top-color: #333;
}

/* Category Cards */
[data-theme="dark"] .category-card,
body.dark-mode .category-card {
  background: #1e1e1e;
  border: 1px solid #333;
}

[data-theme="dark"] .category-info h4,
body.dark-mode .category-info h4 {
  color: #ffffff;
}

/* Budget Cards */
[data-theme="dark"] .budget-card,
body.dark-mode .budget-card {
  background: #1e1e1e;
  border: 1px solid #333;
}

[data-theme="dark"] .budget-amounts .label,
body.dark-mode .budget-amounts .label {
  color: #b0b0b0;
}

[data-theme="dark"] .budget-footer,
body.dark-mode .budget-footer {
  border-top-color: #333;
}

/* Progress Bars */
[data-theme="dark"] .progress-bar,
body.dark-mode .progress-bar {
  background: #333;
}

/* Tabs */
[data-theme="dark"] .categories-tabs,
body.dark-mode .categories-tabs {
  background: transparent;
}

[data-theme="dark"] .tab-btn,
body.dark-mode .tab-btn {
  background: #2a2a2a;
  border-color: #444;
  color: #b0b0b0;
}

[data-theme="dark"] .tab-btn.active,
body.dark-mode .tab-btn.active {
  background: var(--md-primary);
  color: #ffffff;
  border-color: var(--md-primary);
}

/* Admin Tabs */
[data-theme="dark"] .admin-tabs,
body.dark-mode .admin-tabs {
  background: #1e1e1e;
  border: 1px solid #333;
}

[data-theme="dark"] .admin-content,
body.dark-mode .admin-content {
  background: #1e1e1e;
  border: 1px solid #333;
}

/* Plan Cards */
[data-theme="dark"] .plan-card,
[data-theme="dark"] .plan-admin-card,
body.dark-mode .plan-card,
body.dark-mode .plan-admin-card {
  background: #1e1e1e;
  border: 1px solid #333;
}

[data-theme="dark"] .plan-card .yearly,
body.dark-mode .plan-card .yearly {
  color: #4caf50;
}

/* Auth Pages */
[data-theme="dark"] .auth-box,
body.dark-mode .auth-box {
  background: #1e1e1e;
  border: 1px solid #333;
}

[data-theme="dark"] .auth-header h2,
body.dark-mode .auth-header h2 {
  color: #ffffff;
}

/* Logo nas páginas de login/register */
[data-theme="dark"] .auth-header img,
body.dark-mode .auth-header img {
  color: var(--primary) !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

[data-theme="dark"] .auth-footer,
body.dark-mode .auth-footer {
  border-top-color: #333;
  color: #b0b0b0;
}

/* Empty State */
[data-theme="dark"] .empty-state,
body.dark-mode .empty-state {
  color: #666;
}

/* Badges */
[data-theme="dark"] .badge-default,
body.dark-mode .badge-default {
  background: #333;
  color: #b0b0b0;
}

/* Transaction Colors */
[data-theme="dark"] .income,
body.dark-mode .income {
  color: #4caf50;
}

[data-theme="dark"] .expense,
body.dark-mode .expense {
  color: #f44336;
}

/* Color Picker */
[data-theme="dark"] .color-option.selected,
body.dark-mode .color-option.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #121212, 0 0 0 4px #ffffff;
}

/* Usage Items */
[data-theme="dark"] .usage-header,
body.dark-mode .usage-header {
  color: #b0b0b0;
}

/* Profile Grid */
[data-theme="dark"] .profile-grid .card,
body.dark-mode .profile-grid .card {
  background: #1e1e1e;
}

/* Subscription Info */
[data-theme="dark"] .subscription-info .info-row,
body.dark-mode .subscription-info .info-row {
  border-bottom-color: #333;
}

[data-theme="dark"] .subscription-info .label,
body.dark-mode .subscription-info .label {
  color: #b0b0b0;
}

/* Sidebar Footer */
[data-theme="dark"] .sidebar-footer,
body.dark-mode .sidebar-footer {
  border-top-color: #333;
}

[data-theme="dark"] .user-info,
body.dark-mode .user-info {
  color: rgba(255, 255, 255, 0.7);
}

/* Links */
[data-theme="dark"] a,
body.dark-mode a {
  color: var(--md-primary-light);
}

[data-theme="dark"] a:hover,
body.dark-mode a:hover {
  color: var(--md-primary);
}

/* Scrollbar Dark */
[data-theme="dark"] ::-webkit-scrollbar,
body.dark-mode ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track,
body.dark-mode ::-webkit-scrollbar-track {
  background: #1e1e1e;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb,
body.dark-mode ::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 5px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ============================================
   AJUSTES ESPECÍFICOS POR VARIÂNTE DE COR
   ============================================ */

/* Garantir que cores primárias funcionem no dark */
[data-theme="dark"] .btn-primary,
body.dark-mode .btn-primary {
  color: #ffffff;
}

[data-theme="dark"] .card-primary .card-icon,
body.dark-mode .card-primary .card-icon {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .card-success .card-icon,
body.dark-mode .card-success .card-icon {
  background: rgba(76, 175, 80, 0.2);
}

[data-theme="dark"] .card-danger .card-icon,
body.dark-mode .card-danger .card-icon {
  background: rgba(244, 67, 54, 0.2);
}

[data-theme="dark"] .card-warning .card-icon,
body.dark-mode .card-warning .card-icon {
  background: rgba(255, 152, 0, 0.2);
}

/* Header actions */
[data-theme="dark"] .header-actions .btn-secondary,
body.dark-mode .header-actions .btn-secondary {
  background: #2a2a2a;
  color: #ffffff;
}

/* Filters advanced */
[data-theme="dark"] .filters-advanced input,
[data-theme="dark"] .filters-advanced select,
body.dark-mode .filters-advanced input,
body.dark-mode .filters-advanced select {
  background: #2a2a2a;
  border-color: #444;
  color: #ffffff;
}

/* Danger Zone */
[data-theme="dark"] .danger-zone .card-header,
body.dark-mode .danger-zone .card-header {
  background: rgba(244, 67, 54, 0.1);
}

/* Plan inactive */
[data-theme="dark"] .plan-admin-card.inactive,
body.dark-mode .plan-admin-card.inactive {
  opacity: 0.5;
  border-color: #444;
}
