
/* ====================================================================
 * invdreports — Estilos del módulo de reportes
 * ==================================================================== */

/* --- Contenedor principal de reportes --- */
.reports-main-container {
    width: calc(100vw - 212px);
    height: calc(100vh - 48px);
}

.reports-main-container.reports-no-sidemenu {
    width: calc(100vw - 20px);
}

.reports-main-container .title label {
    font-size: 2vw;
    font-weight: 500;
}

.reports-main-container .bottom {
    display: grid;
    grid-template-columns: 180px calc(100% - 180px);
    grid-gap: 10px;
}

.reports-main-container .bottom .menu .option {
    margin-left: 10px;
    border: 0.1px solid rgb(200, 200, 200);
    border-radius: 4px;
    margin-bottom: 5px;
    padding: 2px 4px;
    background: rgb(230, 230, 230);
    cursor: pointer;
}

.reports-main-container .bottom .report {
    width: calc(100% - 20px);
    height: calc(100vh - 100px);
    border: 0.1px solid rgb(200, 200, 200);
    border-radius: 4px;
    position: relative;
}

.reports-main-container .bottom .report iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.reports-main-container i.fa.fa-chart-line {
    font-size: x-large;
    padding: 10px;
}

/* Ajustes de layout cuando se oculta sidebar */
.reports-main-container ~ div.fiche {
    margin: 0px;
}

/* --- Overlay de carga --- */
#overlay-effect,
#inline-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(190, 190, 190, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 20px;
    font-weight: 500;
}

#overlay-effect {
    z-index: 9999;
}

#inline-loading {
    z-index: 10;
}

/* --- Listado dinámico (DataTables) --- */
.invd-listado-container {
    padding: 10px;
    height: 100%;
    overflow: auto;
}

.invd-listado-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.invd-listado-toolbar .invd-toggle-btn {
    padding: 4px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 0.85em;
}

.invd-listado-toolbar .invd-toggle-btn.active {
    background: #003f7f;
    color: #fff;
    border-color: #003f7f;
}

/* Drill-down links en DataTables */
.invd-drilldown-link {
    color: #003f7f;
    text-decoration: underline;
    cursor: pointer;
}

.invd-drilldown-link:hover {
    color: #005fbf;
}

/* --- Vista Pivot --- */
.invd-pivot-container {
    padding: 10px;
    overflow: auto;
}

.invd-pivot-container .pvtUi {
    font-size: 0.85em;
}

/* Encabezado de sección dentro del pivot (multi-valor / interactivo) */
.invd-pivot-section-hdr {
    font-weight: 600;
    font-size: 0.92em;
    color: #003f7f;
    padding: 6px 0 4px 0;
    border-bottom: 2px solid #003f7f;
    margin-bottom: 10px;
}
.invd-pivot-section-hdr .fa {
    margin-right: 5px;
}

/* Wrapper del PivotTable.js interactivo */
.invd-pivotui-wrap {
    overflow-x: auto;
}

/* Tabs de campos valor en el explorador interactivo */
.invd-val-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 2px solid #003f7f;
    padding-bottom: 6px;
}

.invd-val-tab {
    padding: 5px 14px;
    border: 1px solid #b0bcd8;
    background: #f0f2f8;
    color: #003f7f;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.invd-val-tab:hover {
    background: #d6e4f7;
}

.invd-val-tab.active {
    background: #003f7f;
    color: #fff;
    border-color: #003f7f;
}

.invd-val-panels {
    overflow-x: auto;
}

/* Tabla resumen multi-valor */
.invd-multipivot-wrap {
    overflow-x: auto;
    margin-bottom: 10px;
}

.invd-multipivot-table {
    border-collapse: collapse;
    font-size: 0.85em;
    min-width: 300px;
    width: auto;
}

.invd-multipivot-table thead tr {
    background: #003f7f;
    color: #fff;
}

.invd-multipivot-table thead th {
    padding: 6px 10px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid #00316a;
}

.invd-multipivot-table tbody tr:nth-child(even) {
    background: #f5f6fa;
}

.invd-multipivot-table tbody tr:hover {
    background: #e8effc;
}

.invd-multipivot-table tbody td {
    padding: 5px 10px;
    border: 1px solid #dde0ea;
    white-space: nowrap;
}

.invd-multipivot-table tbody td.dt-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.invd-multipivot-table tfoot tr {
    background: #d6e4f7;
}

.invd-multipivot-table tfoot th {
    padding: 5px 10px;
    border: 1px solid #b0c8e8;
    font-weight: 700;
    color: #003f7f;
    border-top: 2px solid #003f7f;
}

.invd-multipivot-table tfoot th.dt-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* --- Admin: configuración de columnas de listado --- */
.invd-listcol-table {
    width: 100%;
}

.invd-listcol-table th {
    white-space: nowrap;
}

.invd-listcol-table .invd-drilldown-opts {
    display: none;
}

.invd-listcol-table .invd-drilldown-opts.active {
    display: table-row;
}

/* SQL textarea en admin */
.invd-sql-editor {
    width: 100%;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    min-height: 120px;
    resize: vertical;
}

/* --- Botones de exportación --- */
.invd-export-btn {
    padding: 4px 12px;
    border: 1px solid #2a7f2a;
    border-radius: 4px;
    background: #f0fff0;
    color: #2a7f2a;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.2s, color 0.2s;
}

.invd-export-btn:hover {
    background: #2a7f2a;
    color: #fff;
}

/* --- Barra de filtros pre-ejecución --- */
.invd-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    background: #f5f6fa;
    border: 1px solid #dde;
    border-radius: 4px;
}

.invd-filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 140px;
}

.invd-filter-group label {
    font-size: 0.8em;
    font-weight: 600;
    color: #555;
}

.invd-filter-group select,
.invd-filter-group input {
    padding: 4px 8px;
    font-size: 0.9em;
    border: 1px solid #bbb;
    border-radius: 3px;
    background: #fff;
    min-width: 120px;
}

.invd-filter-apply {
    align-self: flex-end;
    padding: 5px 16px !important;
    white-space: nowrap;
}

/* --- Fila de totales en tfoot de DataTables --- */
.invd-totals-row th {
    background: #f0f4ff !important;
    font-weight: 700;
    border-top: 2px solid #003f7f !important;
    padding: 5px 8px !important;
    font-size: 0.9em;
    white-space: nowrap;
}

.invd-agg-label {
    display: inline-block;
    font-size: 0.7em;
    color: #888;
    font-weight: 400;
    text-transform: uppercase;
    margin-right: 2px;
}

.invd-agg-value {
    color: #003f7f;
    font-weight: 700;
}

/* --- Fila de filtros en thead (segunda fila) --- */
thead tr.invd-col-filters th {
    background: #f0f2f8;
    padding: 3px 4px;
    border-bottom: 1px solid #c8d0e8;
}

/* --- Filtros por columna en DataTables --- */
.invd-col-filter {
    width: 100%;
    padding: 3px 4px;
    font-size: 0.85em;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
}

#invd-listado-dt tfoot th {
    padding: 4px;
}

/* --- Admin: Reglas de formato condicional --- */
.invd-rules-row td {
    background: #fafbff;
}

.invd-rules-container {
    padding: 4px 0;
}

.invd-rules-table {
    width: auto;
    max-width: 700px;
    border-collapse: collapse;
    font-size: 0.88em;
}

.invd-rules-table thead tr {
    background: #e8eaf0;
}

.invd-rules-table thead th {
    padding: 4px 6px;
    font-weight: 600;
    color: #444;
    border-bottom: 1px solid #ccc;
    white-space: nowrap;
}

.invd-rules-table tbody tr:hover {
    background: #f0f2ff;
}

.invd-toggle-rules {
    min-width: 36px;
}

/* --- Botones de acción con solo icono (tabla de reportes admin) ---
 * Usa las variables CSS del tema de Dolibarr para alinearse con su paleta:
 *   --btncolorbg / --btncolorborder / --btncolortext  → estado normal
 *   --butactionbg / --textbutaction                   → estado hover
 *   --butactiondeletebg                               → variante danger
 */
.invd-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    border: 1px solid var(--btncolorborder, #ddd);
    border-radius: 3px;
    background: var(--btncolorbg, #fbfbfb);
    color: var(--btncolortext, #555);
    font-size: 13px;
    text-decoration: none;
    margin: 1px 2px;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    cursor: pointer;
    vertical-align: middle;
}

.invd-icon-btn:hover {
    background: var(--butactionbg, #8e6aa4);
    color: var(--textbutaction, #fff);
    border-color: transparent;
    text-decoration: none;
    box-shadow: 0px 0px 6px 1px rgba(50,50,50,0.25);
}

.invd-icon-btn-danger {
    color: #633;
    border-color: var(--btncolorborder, #ddd);
    background: var(--butactiondeletebg, #f5f0ee);
}

.invd-icon-btn-danger:hover {
    background: var(--butactiondeletebg, #eae4e1);
    color: #633;
    border-color: transparent;
    box-shadow: 0px 0px 6px 1px rgba(50,50,50,0.25);
}

/* Toggle activo → usa el color del botón de acción del tema */
.invd-icon-btn-active {
    color: var(--butactionbg, #8e6aa4);
    font-size: 15px;
}

/* Toggle inactivo → gris neutro */
.invd-icon-btn-inactive {
    color: #aaa;
    font-size: 15px;
}

/* --- Alineación de columnas numéricas --- */
.invd-listado-wrapper td.dt-right,
.invd-listado-wrapper th.dt-right {
    text-align: right !important;
}

/* --- Texto truncado con puntos suspensivos y tooltip --- */
.invd-truncated {
    cursor: help;
    border-bottom: 1px dotted #aaa;
    white-space: nowrap;
    overflow: hidden;
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
}

.invd-totals-row th.dt-right {
    text-align: right !important;
}
