/**
 * Sistema de Variáveis CSS para Temas
 * Este arquivo define todas as cores e estilos que mudam entre tema claro e escuro
 */

:root {
  /* ========== TEMA CLARO (Padrão) ========== */
  
  /* Backgrounds */
  --bg-primary: #f5f7fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9ff;
  --bg-input: #f8f9ff;
  --bg-filter: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  --bg-table-header: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  
  /* Textos */
  --text-primary: #2d3748;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-title: #333333;
  --text-label: #667eea;
  
  /* Bordas */
  --border-color: #e0e7ff;
  --border-light: #f0f0f0;
  --border-medium: #eee;
  
  /* Sombras */
  --shadow-card: 0 4px 15px rgba(0,0,0,0.08);
  --shadow-card-hover: 0 8px 25px rgba(0,0,0,0.15);
  --shadow-dropdown: 0 8px 30px rgba(0, 0, 0, 0.15);
  
  /* Tabelas */
  --table-bg: #ffffff;
  --table-row-hover: #f8f9fa;
  --table-border: #f0f3f7;
  
  /* Dropdowns e Modais */
  --dropdown-bg: #ffffff;
  --modal-bg: #ffffff;
  
  /* Cards de Estatísticas */
  --stat-card-bg: #ffffff;
  --stat-badge-positive-bg: #d4edda;
  --stat-badge-positive-text: #155724;
  --stat-badge-negative-bg: #f8d7da;
  --stat-badge-negative-text: #721c24;
  
  /* Gráficos */
  --chart-stat-bg: #f8f9fa;
  
  /* Alertas */
  --warning-banner-bg: #ffffff;
  --warning-banner-text: #666666;
}

/* ========== TEMA ESCURO ========== */
body.dark-mode {
  /* Backgrounds */
  --bg-primary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1f2b47;
  --bg-input: #1f2b47;
  --bg-filter: linear-gradient(135deg, #1f2b47 0%, #16213e 100%);
  --bg-table-header: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  
  /* Textos */
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b0;
  --text-muted: #888888;
  --text-title: #e8e8e8;
  --text-label: #a5b4fc;
  
  /* Bordas */
  --border-color: #2d3a5a;
  --border-light: #2d3a5a;
  --border-medium: #2d3a5a;
  
  /* Sombras */
  --shadow-card: 0 4px 15px rgba(0,0,0,0.3);
  --shadow-card-hover: 0 8px 25px rgba(0,0,0,0.4);
  --shadow-dropdown: 0 8px 30px rgba(0, 0, 0, 0.4);
  
  /* Tabelas */
  --table-bg: #16213e;
  --table-row-hover: #1f2b47;
  --table-border: #2d3a5a;
  
  /* Dropdowns e Modais */
  --dropdown-bg: #16213e;
  --modal-bg: #16213e;
  
  /* Cards de Estatísticas */
  --stat-card-bg: #16213e;
  --stat-badge-positive-bg: #1a4731;
  --stat-badge-positive-text: #86efac;
  --stat-badge-negative-bg: #4a1c24;
  --stat-badge-negative-text: #fca5a5;
  
  /* Gráficos */
  --chart-stat-bg: #1f2b47;
  
  /* Alertas */
  --warning-banner-bg: #16213e;
  --warning-banner-text: #b0b0b0;
}

/* ========== ESTILOS GLOBAIS COM VARIÁVEIS ========== */

/* Body */
body {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Cards Genéricos */
.card,
.card-pro,
.stat-card-pro,
.chart-card {
  background: var(--bg-card) !important;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.card:hover,
.card-pro:hover,
.stat-card-pro:hover {
  box-shadow: var(--shadow-card-hover);
}

/* Títulos nos Cards */
.stat-card-header h5,
.section-title,
.chart-card-header h5 {
  color: var(--text-secondary);
}

/* Valores e Números */
.stat-value,
.doughnut-center-number,
.chart-stat-item .value {
  color: var(--text-title) !important;
}

/* Textos Secundários */
.stat-card-footer span,
.chart-stat-item .label,
.doughnut-center-label {
  color: var(--text-muted);
}

/* Tabelas */
.table-professional tbody tr,
.table tbody tr,
table.dataTable tbody tr {
  background: var(--table-bg);
  border-color: var(--table-border);
}

.table-professional tbody tr:hover,
.table tbody tr:hover,
table.dataTable tbody tr:hover {
  background: var(--table-row-hover);
}

.table-professional tbody td,
.table tbody td,
table.dataTable tbody td {
  color: var(--text-primary);
  border-color: var(--table-border);
}

/* Formulários */
.form-control {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.form-control:focus {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-group label {
  color: var(--text-primary);
}

/* Dropdowns */
.dropdown-menu,
.dropdown-menu-custom {
  background: var(--dropdown-bg);
  border-color: var(--border-color);
  box-shadow: var(--shadow-dropdown);
}

.dropdown-item {
  color: var(--text-primary) !important;
}

.dropdown-item:hover {
  background: var(--bg-card-hover);
}

/* Modais */
.modal-content {
  background: var(--modal-bg);
  color: var(--text-primary);
}

.modal-body,
.modal-footer {
  border-color: var(--border-color);
}

/* Filtros */
.filter-box {
  background: var(--bg-filter);
  border-color: var(--border-color);
}

.filter-box label {
  color: var(--text-label);
}

/* Alerts e Banners */
.warning-banner {
  background: var(--warning-banner-bg);
}

.warning-banner p {
  color: var(--warning-banner-text);
}

/* Badges de Estatísticas */
.stat-badge.positive {
  background: var(--stat-badge-positive-bg);
  color: var(--stat-badge-positive-text);
}

.stat-badge.negative {
  background: var(--stat-badge-negative-bg);
  color: var(--stat-badge-negative-text);
}

/* Gráficos */
.chart-stat-item {
  background: var(--chart-stat-bg);
}

/* Botões de Ação */
.btn-action-modern:not(.primary):not(.success):not(.warning) {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-action-dropdown {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-label);
}

.btn-action-dropdown:hover {
  background: var(--bg-card-hover);
}

/* Seções e Bordas */
.stat-card-footer,
.chart-card-header,
.chart-stats,
.form-section-title {
  border-color: var(--border-light);
}

/* Export Bar */
.export-bar {
  background: var(--bg-filter);
  border-color: var(--border-color);
}

/* Select2 */
.select2-container--default .select2-selection--single {
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.select2-dropdown {
  background: var(--dropdown-bg);
  border-color: var(--border-color);
}

.select2-results__option {
  color: var(--text-primary);
}

/* Inputs em geral */
select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Links */
.stat-card-footer a {
  color: var(--text-label);
}

/* DataTables Override */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
  color: var(--text-primary);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--bg-card-hover) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

/* Transições suaves */
body,
.card,
.card-pro,
.stat-card-pro,
.chart-card,
.form-control,
.dropdown-menu,
.modal-content,
.table-professional tbody tr,
.btn-action-modern,
.filter-box {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
