/* =================================================================
   Estilos compartidos de las vistas de Cuentas Corrientes (carga
   manual, búsqueda, ver detalle, hub, consulta cta cte).
   Hace que las clases custom (.form-section, .seccion, .hub-card,
   .filtro-section, .resultados-section, .resumen-card, .grid-card,
   .filtros-card, .resumen-tile, .doc-thumb-card, etc.) reaccionen
   correctamente al modo oscuro Bootstrap 5.3 (data-bs-theme="dark").

   En lugar de hardcodear blancos / grises, todas usan las variables
   de Bootstrap (--bs-body-bg, --bs-body-color, --bs-border-color,
   --bs-tertiary-bg, --bs-secondary-bg, --bs-emphasis-color, etc.).
   ================================================================= */

/* ----------- Cards / secciones genéricas ----------- */
.form-section,
.seccion,
.hub-card,
.filtro-section,
.resultados-section,
.resumen-card,
.grid-card,
.filtros-card,
.ctacte-container .seccion,
.buscar-container .filtro-section,
.buscar-container .resultados-section {
    background: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}

/* Tiles / cuadritos secundarios */
.resumen-tile,
.doc-thumb-card,
.row-saldo-anterior,
#loteActions {
    background: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}

/* Mini-canvas del documento */
.doc-thumb-canvas-wrap {
    background: var(--bs-body-bg) !important;
}
.doc-thumb-name { color: var(--bs-body-color) !important; }
.doc-thumb-size { color: var(--bs-secondary-color) !important; }
.doc-thumb-remove {
    background: var(--bs-body-bg) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-secondary-color) !important;
}

/* Hub */
.hub-section-title {
    color: var(--bs-emphasis-color) !important;
    border-bottom-color: var(--bs-border-color) !important;
}
.hub-card h3 { color: var(--bs-emphasis-color) !important; }
.hub-card p  { color: var(--bs-secondary-color) !important; }

/* Headings de sección dentro de cards */
.seccion h5,
.form-section h5,
.filtro-section h5,
.resultados-section h5,
.grid-card h5,
.filtros-card h5 {
    color: var(--bs-emphasis-color) !important;
}

/* Tablas custom */
#ctaCteGrid thead th,
#renglonesBody ~ thead th,
.renglones-tbl thead th,
.vtos-tbl thead th,
.resultados-grid thead th {
    background: var(--bs-tertiary-bg) !important;
    color: var(--bs-emphasis-color) !important;
    border-color: var(--bs-border-color) !important;
}
.renglones-table thead.table-light th,
.renglones-tbl thead th,
.vtos-tbl thead th {
    --bs-table-bg: var(--bs-tertiary-bg);
    color: var(--bs-emphasis-color) !important;
}

/* DataTables hover/stripes */
#ctaCteGrid tbody tr:hover,
.resultados-grid tbody tr:hover {
    background: var(--bs-tertiary-bg) !important;
}

/* Filas con estado en modo oscuro */
[data-bs-theme="dark"] #ctaCteGrid tbody tr.row-can { background: rgba(34, 197, 94, .12) !important; }
[data-bs-theme="dark"] #ctaCteGrid tbody tr.row-saldo-anterior { background: rgba(255, 255, 255, .06) !important; }

/* Badges semánticos: dejar que Bootstrap maneje */
.estado-pill {
    background: var(--bs-secondary-bg);
    color: var(--bs-emphasis-color);
}
[data-bs-theme="dark"] .estado-PEN { background: rgba(245, 158, 11, .25); color: #fcd34d; }
[data-bs-theme="dark"] .estado-CAN { background: rgba(34, 197, 94, .25); color: #86efac; }
[data-bs-theme="dark"] .estado-ANU { background: rgba(239, 68, 68, .25); color: #fca5a5; }
[data-bs-theme="dark"] .tipo-PRI   { background: rgba(59, 130, 246, .25); color: #93c5fd; }
[data-bs-theme="dark"] .tipo-APL   { background: rgba(245, 158, 11, .25); color: #fcd34d; }

/* Empty states */
.empty-state, .info-text { color: var(--bs-secondary-color) !important; }
.info-resultados { color: var(--bs-secondary-color) !important; }

/* Grilla de detalle */
.grid-detalle dt { color: var(--bs-secondary-color) !important; }
.grid-detalle dd { color: var(--bs-emphasis-color) !important; }

/* Modales custom (portal, anulación, número asiento, etc.) — el bg lo maneja
   Bootstrap, solo aseguramos contraste de inputs internos. */
.ffcc-jer-tree-filial { border-color: var(--bs-border-color) !important; }
.ffcc-jer-tree-filial-head {
    background: var(--bs-tertiary-bg) !important;
    color: var(--bs-emphasis-color) !important;
}
.ffcc-jer-tree-filial-head:hover { background: var(--bs-secondary-bg) !important; }
.ffcc-jer-tree-cc-list { background: var(--bs-body-bg) !important; }
.ffcc-jer-tree-cc { border-top-color: var(--bs-border-color) !important; }
.ffcc-jer-tree-cc:hover { background: var(--bs-tertiary-bg) !important; }

/* Sugerencias del CuentaSelector */
.cuenta-suggestions {
    background: var(--bs-body-bg) !important;
    border-color: var(--bs-border-color) !important;
}
.cuenta-suggestions .suggestion-item .denom { color: var(--bs-secondary-color) !important; }

/* Helper genérico: cualquier "fondo blanco hardcoded" en views custom */
[data-bs-theme="dark"] .ctacte-container *[style*="background:#fff"],
[data-bs-theme="dark"] .ctacte-container *[style*="background: #fff"],
[data-bs-theme="dark"] .ctacte-container *[style*="background:white"],
[data-bs-theme="dark"] .ctacte-container *[style*="background: white"] {
    background: var(--bs-body-bg) !important;
}
