/**
 * Enterprise Tabulator Pagination Stepper — shared footer UI.
 * Referenz: documents-overview #documents_grid_pagination_footer (v209+).
 */
.po-tabulator-pagination-footer {
    flex: 0 0 auto !important;
    display: none;
    align-items: center;
    justify-content: stretch;
    gap: 0;
    width: 100% !important;
    min-height: 44px;
    padding: 8px 16px;
    box-sizing: border-box;
    overflow: visible;
    background: linear-gradient(180deg, var(--po-bg-secondary, #f8fafc) 0%, var(--po-bg-primary, #ffffff) 100%);
    border-top: 1px solid var(--po-border, #e2e8f0);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    z-index: 20;
}

.po-tabulator-pagination-footer.is-visible {
    display: flex !important;
}

.po-tabulator-pagination-footer .po-tabulator-pagination-controls {
    display: flex !important;
    align-items: center;
    justify-content: stretch;
    gap: 0;
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.po-tabulator-stepper-shell {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.po-tabulator-stepper-nav-left,
.po-tabulator-stepper-nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.po-tabulator-stepper-nav-left {
    justify-content: flex-start;
}

.po-tabulator-stepper-nav-right {
    justify-content: flex-end;
}

.po-tabulator-stepper-viewport {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
}

.po-tabulator-stepper-viewport--fits {
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

.po-tabulator-stepper-viewport--overflow {
    display: block;
    overflow-x: auto;
}

.po-tabulator-stepper-viewport::-webkit-scrollbar {
    display: none;
}

.po-tabulator-stepper-track {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: min-content;
    width: max-content;
}

.po-tabulator-stepper-viewport--fits .po-tabulator-stepper-track {
    margin: 0 auto;
    justify-content: center;
}

.po-tabulator-stepper-viewport--overflow .po-tabulator-stepper-track {
    margin: 0;
    justify-content: flex-start;
}

.po-tabulator-stepper-scroll-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--po-border, #e2e8f0);
    background: var(--po-bg-primary, #ffffff);
    color: var(--po-text-secondary, #475569);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.po-tabulator-stepper-scroll-btn--edge {
    width: 34px;
}

.po-tabulator-stepper-shell:not(.po-tabulator-stepper-shell--active) .po-tabulator-stepper-nav-left,
.po-tabulator-stepper-shell:not(.po-tabulator-stepper-shell--active) .po-tabulator-stepper-nav-right {
    display: none;
}

.po-tabulator-stepper-scroll-btn:hover:not(:disabled) {
    background: var(--po-bg-secondary, #f8fafc);
    border-color: var(--po-accent, #2563eb);
    color: var(--po-accent, #2563eb);
}

.po-tabulator-stepper-scroll-btn:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.po-tabulator-step-btn {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
    overflow: hidden;
}

.po-tabulator-step-btn-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.po-tabulator-step-btn--text {
    min-width: 48px;
    max-width: 72px;
}

.po-tabulator-step-btn--date {
    min-width: 80px;
    max-width: clamp(96px, 12vw, 140px);
}

.po-tabulator-step-btn--index,
.po-tabulator-step-btn--amount {
    min-width: 56px;
    max-width: 92px;
}

/* Fits: Track passt in Viewport → volle Labels ohne Ellipsis */
.po-tabulator-stepper-viewport--fits .po-tabulator-step-btn {
    overflow: visible;
}

.po-tabulator-stepper-viewport--fits .po-tabulator-step-btn-label {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}

.po-tabulator-stepper-viewport--fits .po-tabulator-step-btn--text,
.po-tabulator-stepper-viewport--fits .po-tabulator-step-btn--date,
.po-tabulator-stepper-viewport--fits .po-tabulator-step-btn--index,
.po-tabulator-stepper-viewport--fits .po-tabulator-step-btn--amount {
    max-width: none;
}

.po-tabulator-step-btn.primary {
    font-weight: 600;
    opacity: 1 !important;
    color: var(--po-text-primary, #0f172a) !important;
    border-color: var(--po-accent, #2563eb) !important;
    background: rgba(37, 99, 235, 0.08) !important;
}

.po-tabulator-step-btn.primary:disabled {
    opacity: 1 !important;
    cursor: default;
}

.po-tabulator-step-btn--pending {
    min-width: 72px;
    cursor: default;
    pointer-events: none;
    opacity: 0.65;
}

.po-tabulator-step-btn--date.po-tabulator-step-btn--pending {
    min-width: clamp(96px, 12vw, 140px);
}

.po-tabulator-step-skel {
    display: inline-block;
    width: 56px;
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--po-border, #e2e8f0) 25%, var(--po-bg-secondary, #f1f5f9) 50%, var(--po-border, #e2e8f0) 75%);
    background-size: 200% 100%;
    animation: po-tabulator-step-skel 1.1s ease-in-out infinite;
}

@keyframes po-tabulator-step-skel {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.po-tabulator-step-ellipsis {
    color: var(--po-text-muted, #64748b);
    font-size: 12px;
    padding: 0 2px;
    user-select: none;
}

/* Grid stage: Tabulator + Footer in einer Flex-Spalte */
.po-tabulator-grid-stage {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.po-tabulator-grid-stage > .po-tabulator-grid-host,
.po-tabulator-grid-stage > .workspaces_tabulator_grid,
.po-tabulator-grid-stage > [id$="_grid"] {
    flex: 1 1 auto;
    min-height: 0;
}

html.dark-side .po-tabulator-pagination-footer,
[data-theme="dark"] .po-tabulator-pagination-footer,
.dark-mode .po-tabulator-pagination-footer {
    background: linear-gradient(180deg, var(--po-bg-secondary, #1e293b) 0%, var(--po-bg-primary, #0f172a) 100%);
    border-top-color: var(--po-border, #334155);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Documents legacy aliases — gleiche Optik ohne Duplikat-CSS in content_main */
.documents-grid-pagination-footer.po-tabulator-pagination-footer,
#documents_grid_pagination_footer.po-tabulator-pagination-footer {
    flex: 0 0 auto !important;
}

.documents-pagination-stepper-shell.po-tabulator-stepper-shell,
.documents-pagination-stepper-viewport.po-tabulator-stepper-viewport,
.documents-pagination-stepper-track.po-tabulator-stepper-track,
.documents-pagination-scroll-btn.po-tabulator-stepper-scroll-btn,
.documents-pagination-step-btn.po-tabulator-step-btn,
.documents-pagination-ellipsis.po-tabulator-step-ellipsis,
.documents-pagination-step-skel.po-tabulator-step-skel {
    /* Klassen-Kombination reicht — Regeln oben gelten über po-tabulator-* */
}
