/* Report / dashboard viewers inside workspace tabs — fill host + scroll report surface */

.report-tab-host {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* When report/dashboard host is on the tab root/body, keep scroll inside Stimulsoft */
.qtab-content-root.report-tab-host {
    overflow: hidden;
}

.qtab-content-body.report-tab-host {
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    min-height: 0;
    height: 100%;
}

.qtab-page-wrapper.report-tab-host {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.report-workspace-page.workspace-page-host {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.rpt-toolbar-card {
    border-radius: 10px;
    direction: rtl;
    flex-shrink: 0;
}

/* Single horizontal RTL toolbar: actions + params on one row */
.rpt-toolbar-split {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    direction: rtl;
}

.rpt-toolbar-actions {
    flex: 0 0 auto;
    max-width: none;
    min-width: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    order: 0;
}

.rpt-toolbar-actions .mud-icon-button-root {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 4px;
}

.rpt-toolbar-actions .mud-icon-button-root .mud-icon-root {
    font-size: 1.25rem;
}

.rpt-toolbar-hint-ico {
    opacity: 0.85;
    margin-inline: 2px;
}

.rpt-toolbar-params {
    flex: 1 1 auto;
    min-width: 0;
    order: 0;
    direction: rtl;
    text-align: right;
}

.rpt-params-panels .mud-expand-panel {
    background: transparent;
}

.rpt-workspace-keyboard {
    outline: none;
}

.rpt-workspace-keyboard:focus-visible {
    outline: 1px dashed var(--mud-palette-primary);
    outline-offset: 2px;
}

.rpt-toolbar-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 28px;
}

.rpt-toolbar-row .mud-icon-button-root,
.rpt-toolbar-row .mud-button-root {
    flex-shrink: 0;
}

.rpt-toolbar-refresh-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
}

.rpt-viewer-shell {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
}

.rpt-viewer-paper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rpt-viewer-host {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.report-container-style {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.report-container-style.heyat-sti-host-fitted {
    overflow: hidden;
}

.report-container-style > [id^="StiViewer_"],
.report-container-style > [id^="StiDesigner_"],
.report-container-style > div {
    flex: 1 1 auto;
    min-height: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    box-sizing: border-box;
}

/* Stimulsoft main chrome: column flex; pages scroll inside ReportPanel */
.report-container-style .stiJsViewerMainPanel,
.report-container-style .stiViewer,
.report-container-style .stiDesignerMainPanel {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
}

.report-container-style .stiJsViewerReportPanel,
.report-container-style [class*="ReportPanel"] {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: none !important;
}

/* Stimulsoft: default IRANSans; SVG text keeps template/user font-family when set */
.report-container-style,
.report-container-style .stiJsViewerMainPanel,
.report-container-style .stiViewer,
.report-container-style .stiJsViewerPage,
.report-container-style .stiJsViewerReportPanel {
    font-family: "IRANSansWebFaNum", "IRANSansWeb(FaNum)", Tahoma, sans-serif;
}

.report-container-style text:not([font-family]),
.report-container-style tspan:not([font-family]) {
    font-family: "IRANSansWebFaNum", "IRANSansWeb(FaNum)", Tahoma, sans-serif;
}

.cr-schedule-inline-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    flex-shrink: 0;
}

.rpt-data-refresh {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: color-mix(in srgb, var(--mud-palette-surface) 92%, var(--mud-palette-primary) 8%);
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.rpt-data-refresh__icon {
    animation: cr-schedule-spin 1.4s linear infinite;
}

.rpt-data-refresh__bar {
    width: min(16rem, 70vw);
    border-radius: 999px;
    overflow: hidden;
}

@keyframes cr-schedule-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.cr-schedule-inline-wrap .cr-schedule-ring,
.cr-schedule-inline-wrap .mud-progress-circular {
    width: 20px !important;
    height: 20px !important;
}

@media (max-width: 960px) {
    .report-tab-host .qtab-content-body {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }

    .report-tab-host .report-workspace-page {
        margin-top: 0 !important;
        padding: 2px 4px !important;
        flex: 1 1 auto;
        min-height: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .rpt-toolbar-card {
        padding: 4px 6px !important;
        margin: 2px 0 !important;
    }

    .rpt-toolbar-split {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
    }

    .rpt-toolbar-actions {
        max-width: none;
        flex: 0 0 auto;
        width: auto;
    }

    .rpt-toolbar-params {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
    }

    .rpt-toolbar-row {
        gap: 2px;
        min-height: 26px;
    }

    .rpt-toolbar-row .mud-icon-button-root,
    .rpt-toolbar-actions .mud-icon-button-root {
        width: 26px;
        height: 26px;
        min-width: 26px;
        padding: 2px;
    }

    .report-tab-host .rpt-viewer-shell,
    .report-tab-host .rpt-viewer-paper,
    .report-tab-host .rpt-viewer-host {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .report-tab-host .report-container-style {
        flex: 1 1 auto;
        min-height: 240px !important;
        height: 100% !important;
        max-height: none !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .report-tab-host .report-container-style > [id^="StiViewer_"],
    .report-tab-host .report-container-style .stiViewer,
    .report-tab-host .report-container-style .stiJsViewerMainPanel {
        flex: 1 1 auto;
        min-height: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        /* Beat Stimulsoft InitializeMobile CSS fullscreen (inline fixed + z-index 1000000). */
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        inset: auto !important;
        z-index: 1 !important;
    }

    /* Also cover pages that may not receive report-tab-host class */
    .report-workspace-page .report-container-style > [id^="StiViewer_"],
    .report-workspace-page .report-container-style > [id^="StiDesigner_"],
    .report-workspace-page .report-container-style .stiJsViewerMainPanel,
    .report-workspace-page .report-container-style .stiViewer,
    .report-workspace-page .report-container-style .stiDesignerMainPanel,
    .qtab-content-body .report-container-style > [id^="StiViewer_"],
    .qtab-content-body .report-container-style .stiJsViewerMainPanel {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        inset: auto !important;
        z-index: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    body.heyat-sti-contained-mobile {
        overflow: auto !important;
    }

    .dxd-host {
        min-height: 160px !important;
        height: auto !important;
        flex: 1 1 auto;
    }

    .report-workspace-page .mud-overlay {
        border-radius: 8px;
    }

    .qtab-content-body .stiDesignerMainPanel {
        max-width: 100% !important;
        width: 100% !important;
        min-height: 240px !important;
    }

    .qtab-content-body .stiViewer,
    .qtab-content-body .stiJsViewerMainPanel {
        max-width: 100% !important;
        width: 100% !important;
    }
}

@media (max-width: 960px) {
    .qtab-toolbar {
        padding: 2px 8px;
        min-height: 32px;
        gap: 4px;
    }

    .qtab-toolbar-path-text {
        max-width: 34vw;
        font-size: 0.72rem;
    }

    .qtab-toolbar-actions .mud-icon-button-root {
        width: 30px;
        height: 30px;
        padding: 3px;
    }
}
