/* ============================================================================
 * inka-plugins.css — Reglas de tema propias (portadas 1:1 desde el legacy
 * ui_theme_tokens.volt). Cubre lo que inka-base NO trae: multiselect, select2,
 * jqGrid, sweet-alert, page-header, color de iconos, placeholders, y el dark
 * del shell. Token-based (valores desde global_style.css). Se carga en ambos
 * modos. La purga de redundante con inka-base es paso posterior (5D).
 * ==========================================================================*/
/* La tipografía se sirve en local desde public/assets/fonts/fonts.css, cargado
   por el layout. Antes se pedía aquí con @import a Google Fonts: además de
   mandar la IP del usuario a Google, un @import es BLOQUEANTE de render y este
   CSS lo carga todo el sistema, así que un bloqueador colgaba cualquier página. */

:root {
    --app-font-family: 'Plus Jakarta Sans', sans-serif;
    --brand-primary: rgb(219, 123, 23);
    --brand-secondary: rgb(209, 62, 46);
    --brand-gradient: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    --app-content-bg: #f4f6f8;
    --app-sidebar-bg: #191c1f;
    --bg-page: #f4f6f8;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --text-primary: #1f2937;
    --text-muted: #6b7280;
    --border-soft: rgba(15, 23, 42, 0.10);
    --input-bg: #ffffff;
    --dropdown-bg: #ffffff;
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
}

html.theme-dark,
body.theme-dark {
    /* Solo ALIASES de nombres legacy → tokens de global_style.css (nuestra única
       fuente de verdad de color en dark). No redefinir valores aquí:
       --bg-surface/--bg-elevated/--input-bg/--border-soft/--text-muted vienen
       directo de global_style. */
    --app-content-bg: var(--bg-main);
    --app-sidebar-bg: #0b1016;
    --bg-page: var(--bg-main);
    --text-primary: var(--text-main);
    --dropdown-bg: var(--bg-surface);
    --shadow-soft: var(--ui-shadow-soft, 0 12px 30px rgba(0, 0, 0, 0.35));
}

body,
.navbar,
.sidebar,
.page-header,
.panel,
.content,
.form-control,
.btn,
.nav,
.dropdown-menu {
    font-family: var(--app-font-family);
}

body {
    background: var(--bg-page);
    color: var(--text-primary);
}

.content,
.content-wrapper {
    background: var(--bg-page);
}

/* Solo en oscuro: degradado gris neutro en el body; el contenido lo deja pasar. */
html.theme-dark body,
body.theme-dark {
    background: linear-gradient(180deg, #171717 0%, #0f0f0f 100%);
    background-attachment: fixed;
}

html.theme-dark .content,
html.theme-dark .content-wrapper,
body.theme-dark .content,
body.theme-dark .content-wrapper {
    background: transparent;
}

.panel,
.card,
.modal-content,
.dropdown-menu,
.table-responsive {
    background: var(--bg-surface);
    border-color: var(--border-soft);
}

/* Tablas sin chrome (ej. resumen de totales IGV/Total): heredan el fondo del
   panel contenedor, no una superficie propia que haga "banda". */
.table-responsive.no-border,
.table-responsive.no-border > .table,
.table-responsive.no-border > .table > tbody > tr > td {
    background: transparent;
}


.panel,
.modal-content,
.dropdown-menu {
    box-shadow: var(--shadow-soft);
}

.panel-heading,
.modal-header,
.modal-footer,
.table > thead > tr > th,
.table > tbody > tr > td,
.table > tfoot > tr > td {
    border-color: var(--border-soft);
}

.form-control,
.select2-container--default .select2-selection--single,
.select2-dropdown,
.multiselect {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-soft);
}

.multiselect-container > li.active > a,
.multiselect-container > li.active > a:hover,
.multiselect-container > li.active > a:focus,
.multiselect-container > li > a:hover,
.multiselect-container > li > a:focus {
    background: #d55824;
    color: #ffffff;
}

.multiselect-container > li.active > a label,
.multiselect-container > li.active > a:hover label,
.multiselect-container > li.active > a:focus label,
.multiselect-container > li > a:hover label,
.multiselect-container > li > a:focus label {
    color: #ffffff;
}

.text-muted,
.help-block,
.table > tbody > tr > td .text-muted {
    color: var(--text-muted);
}

html.theme-dark .navbar-default .navbar-nav > li > a,
html.theme-dark .navbar-default .navbar-text,
html.theme-dark .dropdown-menu > li > a,
html.theme-dark .panel-title,
html.theme-dark .label-form,
html.theme-dark .page-title h4,
html.theme-dark .page-title h5,
html.theme-dark .nav-tabs > li > a,
html.theme-dark .content-group h5,
html.theme-dark .content-group h6,
html.theme-dark .table > tbody > tr > td,
html.theme-dark .table > thead > tr > th,
html.theme-dark .modal-title {
    color: var(--text-primary);
}

html.theme-dark .dropdown-menu {
    background: var(--dropdown-bg);
}

html.theme-dark .dropdown-menu > li > a:hover,
html.theme-dark .dropdown-menu > li > a:focus {
    background: rgba(255, 255, 255, 0.08);
}

html.theme-dark .modal-header,
html.theme-dark .panel-heading,
html.theme-dark .panel-footer,
html.theme-dark .modal-footer {
    background: rgba(255, 255, 255, 0.02);
}

html.theme-dark .panel,
html.theme-dark .panel-body,
html.theme-dark .content-group,
html.theme-dark .tab-content,
html.theme-dark .navbar-component,
html.theme-dark .navbar.navbar-default.navbar-component,
html.theme-dark .content-group.tab-content-bordered.navbar-component {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-soft);
}

html.theme-dark .btn-default,
html.theme-dark .btn.btn-default {
    color: var(--text-primary);
    background: var(--bg-elevated);
    border-color: var(--border-soft);
}

html.theme-dark .btn-link,
html.theme-dark a,
html.theme-dark .dropdown-menu > li > a,
html.theme-dark .navbar-nav > li > a,
html.theme-dark .tabbable .nav-tabs > li > a {
    color: var(--text-primary);
}

html.theme-dark .nav-tabs > li > a,
html.theme-dark .nav-tabs.nav-tabs-highlight > li > a,
html.theme-dark .nav-tabs.nav-tabs-solid > li > a {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

html.theme-dark .nav-tabs > li.active > a,
html.theme-dark .nav-tabs > li.active > a:hover,
html.theme-dark .nav-tabs > li.active > a:focus,
html.theme-dark .nav-tabs.nav-tabs-highlight > li.active > a,
html.theme-dark .nav-tabs.nav-tabs-solid > li.active > a {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-soft);
}

html.theme-dark .form-control::placeholder,
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

html.theme-dark .select2-container--default .select2-selection--single .select2-selection__rendered,
html.theme-dark .select2-container--default .select2-selection--single .select2-selection__placeholder,
html.theme-dark .select2-container--default .select2-search--dropdown .select2-search__field,
html.theme-dark .select2-results__option {
    color: var(--text-primary);
}

html.theme-dark .select2-dropdown {
    background: var(--dropdown-bg);
    border-color: var(--border-soft);
}

html.theme-dark .select2-search--dropdown,
html.theme-dark .select2-container--default .select2-search--dropdown {
    background: var(--dropdown-bg);
}

html.theme-dark .select2-search--dropdown .select2-search__field,
html.theme-dark .select2-container--default .select2-search--dropdown .select2-search__field {
    background: var(--input-bg);
    border: 1px solid var(--border-soft);
    color: var(--text-primary);
}

html.theme-dark .select2-search--dropdown .select2-search__field::placeholder,
html.theme-dark .select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

html.theme-dark .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--text-primary) transparent transparent transparent;
}

html.theme-dark .select2-container--default .select2-results__option--highlighted[aria-selected],
html.theme-dark .select2-container--default .select2-results__option[aria-selected=true] {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

html.theme-dark table,
html.theme-dark .table,
html.theme-dark .table > thead > tr > th,
html.theme-dark .table > tbody > tr > td,
html.theme-dark .table > tfoot > tr > td,
html.theme-dark .datatable-basic,
html.theme-dark .dataTable,
html.theme-dark .table-responsive {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-soft);
}

html.theme-dark .dataTables_wrapper .dataTables_info,
html.theme-dark .dataTables_wrapper .dataTables_filter label,
html.theme-dark .dataTables_wrapper .dataTables_length label,
html.theme-dark .dataTables_wrapper .paginate_button {
    color: var(--text-muted);
}

html.theme-dark .dataTables_wrapper .dataTables_filter input,
html.theme-dark .dataTables_wrapper .dataTables_length select {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
}

html.theme-dark .dataTables_empty {
    color: var(--text-primary);
}

html.theme-dark .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.02);
}

html.theme-dark .breadcrumb-line,
html.theme-dark .breadcrumb-line-component,
html.theme-dark .breadcrumb {
    background: var(--bg-elevated);
    border-color: var(--border-soft);
    color: var(--text-primary);
}

html.theme-dark .breadcrumb > li,
html.theme-dark .breadcrumb > li > a,
html.theme-dark .breadcrumb > li > span,
html.theme-dark .breadcrumb-line .text-semibold {
    color: var(--text-primary);
}

html.theme-dark [class^="icon-"],
html.theme-dark [class*=" icon-"],
html.theme-dark .fa {
    color: var(--text-primary);
}

html.theme-dark .text-success,
html.theme-dark .text-success [class^="icon-"],
html.theme-dark .text-success [class*=" icon-"],
html.theme-dark .text-success .fa {
    color: #52d68b;
}

html.theme-dark .text-danger,
html.theme-dark .text-danger [class^="icon-"],
html.theme-dark .text-danger [class*=" icon-"],
html.theme-dark .text-danger .fa {
    color: #ff7f7f;
}

html.theme-dark .text-warning,
html.theme-dark .text-warning [class^="icon-"],
html.theme-dark .text-warning [class*=" icon-"],
html.theme-dark .text-warning .fa {
    color: #f8bf63;
}

html.theme-dark .sweet-overlay {
    background-color: rgba(5, 10, 18, 0.78);
}

html.theme-dark .sweet-alert {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

html.theme-dark .sweet-alert h2,
html.theme-dark .sweet-alert p,
html.theme-dark .sweet-alert .sa-icon + h2,
html.theme-dark .sweet-alert .sa-icon + h2 + p {
    color: var(--text-primary);
}

html.theme-dark .sweet-alert button.cancel {
    background: #4b5567;
}

html.theme-dark .ui-jqgrid,
html.theme-dark .ui-jqgrid-view,
html.theme-dark .ui-jqgrid-bdiv,
html.theme-dark .ui-jqgrid-hdiv,
html.theme-dark .ui-jqgrid-htable,
html.theme-dark .ui-jqgrid-btable,
html.theme-dark .ui-jqgrid tr.jqgrow td,
html.theme-dark .ui-jqgrid .ui-jqgrid-htable th,
html.theme-dark .ui-jqgrid .ui-jqgrid-hbox,
html.theme-dark .ui-jqgrid .ui-jqgrid-btable tbody tr td,
html.theme-dark table.scroll,
html.theme-dark #gbox_detalle_documento,
html.theme-dark #gview_detalle_documento,
html.theme-dark #ghead_detalle_documento,
html.theme-dark #gview_detalle_documento .ui-jqgrid-titlebar {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-soft);
}

/* El tema del calendario (daterangepicker) se movió a
   public/css/modules/datepicker/datepicker.css — clase `ui-datepicker`. */

.page-header .page-header-content {
    max-width: 1120px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
    padding: 14px 18px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.page-header .page-title h4,
.page-header .page-title h5 {
    font-weight: 800;
    letter-spacing: -0.01em;
}

.page-header .page-title i {
    color: var(--brand-primary);
}

.page-header .heading-btn-group .btn-float {
    font-weight: 700;
}

@media (max-width: 768px) {
    .page-header .page-header-content {
        border-radius: 0.8rem;
        padding: 12px 14px;
    }
}

/* ---------- DataTables: menú "Columnas" (colvis) — diseño único del sistema ----------
   El de Productos: lista simple en 2 columnas (collectionLayout 'fixed two-column'), sin
   casillas; las columnas visibles van en naranja sobre fondo suave. Sin velo gris detrás.
   Los menús de acciones con otra clase (p. ej. .mv-menu de Mis ventas) se estilan aparte. */
.dt-button-background { background: transparent; opacity: 1; }
.dt-button-collection {
    padding: 8px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    box-shadow: var(--ui-shadow-card, 0 12px 32px rgba(15, 23, 42, .16));
    z-index: 1080;
}
.dt-button-collection.fixed.two-column { max-width: calc(100vw - 24px); }
.dt-button-collection > .dt-button.buttons-columnVisibility {
    padding: 8px 14px;
    color: var(--ui-text);
    background: transparent;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}
.dt-button-collection > .dt-button.buttons-columnVisibility:hover,
.dt-button-collection > .dt-button.buttons-columnVisibility:focus,
.dt-button-collection > .dt-button.buttons-columnVisibility.active {
    color: var(--ui-accent-strong);
    background: var(--ui-accent-soft);
    outline: 0;
}
