/* ============================================================
   VELORA — Overrides para dark mode.
   La plantilla Ample Admin ya cubre la mayoría con [data-theme="dark"].
   Aquí ajustamos los módulos custom (dashboard, montos, datatables).
   ============================================================ */

/* ─────────── Footer dark ─────────── */
body[data-theme="dark"] .footer {
  background: #050a12 !important;
  color: rgba(255, 255, 255, .45) !important;
  border-top: 1px solid rgba(255, 255, 255, .04);
}
body[data-theme="dark"] .footer a,
body[data-theme="dark"] .footer b {
  color: rgba(255, 255, 255, .75) !important;
}


/* ─────────── Fondo del workspace más oscuro para que las tarjetas resalten ─────────── */
body[data-theme="dark"] {
  background: #0a131f !important;
}
body[data-theme="dark"] .page-wrapper,
body[data-theme="dark"] .page-content {
  background: #0a131f !important;
}

/* Cards del template: subir contraste para que floten sobre el nuevo fondo */
body[data-theme="dark"] .card,
body[data-theme="dark"] .card-body {
  background-color: #1a2230 !important;
  border-color: rgba(255, 255, 255, .04);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
}

/* Card-header / card-footer en sintonía */
body[data-theme="dark"] .card-header,
body[data-theme="dark"] .card-footer {
  background-color: rgba(255, 255, 255, .02) !important;
  border-color: rgba(255, 255, 255, .05) !important;
}


/* ─────────── Sidebar + Navbar más oscuros en dark ─────────── */
body[data-theme="dark"] .left-sidebar,
body[data-theme="dark"] .left-sidebar .scroll-sidebar,
body[data-theme="dark"] .left-sidebar .sidebar-nav,
body[data-theme="dark"] .left-sidebar #sidebarnav,
body[data-theme="dark"] .left-sidebar #sidebarnav ul {
  background: #050a12 !important;
}

body[data-theme="dark"] .topbar,
body[data-theme="dark"] .topbar .top-navbar .navbar-collapse[data-navbarbg='skin5'],
body[data-theme="dark"] .topbar .top-navbar .navbar-header[data-logobg='skin5'] {
  background: #050a12 !important;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}

/* En dark, ligera variación de hover/activo para que se perciba sobre fondo tan oscuro */
body[data-theme="dark"] .left-sidebar .sidebar-item .sidebar-link:hover {
  background: rgba(255, 255, 255, .045) !important;
}
body[data-theme="dark"] .left-sidebar .sidebar-item.selected > .sidebar-link,
body[data-theme="dark"] .left-sidebar .sidebar-item .sidebar-link.active {
  background: linear-gradient(90deg, rgba(91,115,232,.28) 0%, rgba(91,115,232,.05) 100%) !important;
}


/* ─────────── Toggle button (topbar) ─────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border: 0;
  cursor: pointer;
  margin-top: 12px;
  margin-right: 8px;
  transition: background .2s ease, transform .2s ease;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: rotate(15deg);
}
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: inline; }
body[data-theme="dark"] .theme-toggle .icon-sun  { display: inline; }
body[data-theme="dark"] .theme-toggle .icon-moon { display: none; }


/* ─────────── DASHBOARD — modo oscuro ─────────── */
body[data-theme="dark"] #dashboardRoot .dash-card {
  background: #2a3447 !important;
  color: #e6e8ed;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}
body[data-theme="dark"] #dashboardRoot .dash-card:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

body[data-theme="dark"] #dashboardRoot .kpi-card.kpi-light {
  background: #2a3447 !important;
}
body[data-theme="dark"] #dashboardRoot .kpi-card.kpi-light .kpi-value {
  color: #ffffff !important;
}
body[data-theme="dark"] #dashboardRoot .kpi-card.kpi-light .kpi-label,
body[data-theme="dark"] #dashboardRoot .kpi-card.kpi-light .kpi-sub {
  color: #b1b6c4 !important;
}

body[data-theme="dark"] #dashboardRoot .chart-title { color: #f1f1f1; }
body[data-theme="dark"] #dashboardRoot .chart-sub   { color: #9aa1b2; }

body[data-theme="dark"] #dashboardRoot .dash-filtros {
  background: #2a3447;
  color: #e6e8ed;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
body[data-theme="dark"] #dashboardRoot .dash-filtros label {
  color: #9aa1b2 !important;
}
body[data-theme="dark"] #dashboardRoot .dash-filtros .form-control {
  background: #1f2937;
  border-color: #3d4759;
  color: #e6e8ed;
}
body[data-theme="dark"] #dashboardRoot .dash-preset-btn {
  background: #3d4759;
  color: #e6e8ed;
  border-color: transparent;
}
body[data-theme="dark"] #dashboardRoot .dash-preset-btn:hover {
  background: #4a5568;
}

/* Select2 dentro del dashboard en modo oscuro */
body[data-theme="dark"] #dashboardRoot .select2-container--default .select2-selection--single {
  background: #1f2937 !important;
  border-color: #3d4759 !important;
}
body[data-theme="dark"] #dashboardRoot .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #e6e8ed !important;
}
body[data-theme="dark"] .select2-dropdown {
  background: #2a3447;
  border-color: #3d4759;
  color: #e6e8ed;
}
body[data-theme="dark"] .select2-results__option {
  color: #e6e8ed;
}
body[data-theme="dark"] .select2-results__option--highlighted[aria-selected] {
  background: #5b73e8 !important;
}
body[data-theme="dark"] .select2-search--dropdown .select2-search__field {
  background: #1f2937 !important;
  border-color: #3d4759 !important;
  color: #e6e8ed !important;
}

/* ApexCharts: tooltip y leyenda */
body[data-theme="dark"] .apexcharts-tooltip {
  background: #1f2937 !important;
  color: #e6e8ed !important;
  border: 1px solid #3d4759 !important;
}
body[data-theme="dark"] .apexcharts-tooltip-title {
  background: #2a3447 !important;
  border-bottom: 1px solid #3d4759 !important;
}
body[data-theme="dark"] .apexcharts-legend-text {
  color: #c5cad6 !important;
}
body[data-theme="dark"] .apexcharts-xaxis text,
body[data-theme="dark"] .apexcharts-yaxis text {
  fill: #9aa1b2 !important;
}
body[data-theme="dark"] .apexcharts-gridline {
  stroke: #3d4759 !important;
}


/* ─────────── DATATABLES — dark ─────────── */
body[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
body[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
  background: #1f2937;
  border: 1px solid #3d4759;
  color: #e6e8ed;
}
body[data-theme="dark"] .dataTables_info,
body[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
  color: #c5cad6 !important;
}
body[data-theme="dark"] table.dataTable {
  color: #e6e8ed;
}
body[data-theme="dark"] table.dataTable.table-striped tbody tr:nth-of-type(odd) {
  background: #2a3447;
}
body[data-theme="dark"] table.dataTable.table-striped tbody tr:nth-of-type(even) {
  background: #232b3a;
}
body[data-theme="dark"] table.dataTable thead th {
  background: #1f2937;
  color: #e6e8ed;
  border-color: #3d4759;
}
body[data-theme="dark"] table.dataTable > tbody > tr.child td.child {
  background: #232b3a !important;
}
body[data-theme="dark"] table.dataTable > tbody > tr.child td.child ul.dtr-details li span.dtr-title {
  color: #e6e8ed !important;
}
body[data-theme="dark"] table.dataTable > tbody > tr.child td.child ul.dtr-details li span.dtr-data {
  color: #c5cad6 !important;
}


/* ─────────── Otros componentes ─────────── */
body[data-theme="dark"] .montos-toolbar {
  background: #2a3447;
  border-color: #3d4759;
  color: #e6e8ed;
}
body[data-theme="dark"] .montos-wrapper {
  border-color: #3d4759;
}
body[data-theme="dark"] #tablaMontos tbody tr:nth-child(odd)  { background: #2a3447; }
body[data-theme="dark"] #tablaMontos tbody tr:nth-child(even) { background: #232b3a; }
body[data-theme="dark"] #tablaMontos tbody tr:hover           { background: #38445e !important; }
body[data-theme="dark"] #tablaMontos tbody td {
  border-top-color: #3d4759 !important;
  color: #e6e8ed;
}
body[data-theme="dark"] .input-monto-fila { color: #fff; }
body[data-theme="dark"] .input-pago-fila {
  background: #1f2937 !important;
  border-color: #3d4759 !important;
  color: #e6e8ed;
}

/* SweetAlert popups (legibilidad básica) */
body[data-theme="dark"] .swal2-popup {
  background: #2a3447 !important;
  color: #e6e8ed !important;
}
body[data-theme="dark"] .swal2-title,
body[data-theme="dark"] .swal2-html-container { color: #e6e8ed !important; }
