﻿ /* ===== Overlay ===== */
#loadingOverlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.35);
    z-index: 1055;
}

#loadingOverlay.show {
    display: flex !important;
}

/* ===== Select2 kompakt ===== */
.select2-container--default .select2-selection--multiple {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 36px;
    height: 36px;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    box-sizing: border-box;
    padding: 2px 8px;
}

    .select2-container--default .select2-selection--multiple .select2-selection__rendered {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 4px;
        margin: 0 !important;
        padding: 0 !important;
        height: 100%;
        list-style: none !important;
    }

    .select2-container--default .select2-selection--multiple .select2-search__field {
        margin: 0 !important;
        padding: 0 !important;
        height: 20px;
        line-height: 20px;
    }

    .select2-container--default .select2-selection--multiple .select2-selection__choice {
        margin: 0 4px 0 0 !important;
        padding: 0 6px !important;
        line-height: 1.2;
    }

    .select2-container--default .select2-selection--multiple .select2-selection__rendered:empty::after {
        content: attr(data-placeholder);
        color: #6c757d;
    }

    .select2-container--default .select2-selection--multiple .select2-selection__clear {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
    }

select.select2-hidden-accessible {
    display: none !important;
}

.select2-container .select2-dropdown {
    position: absolute !important;
    z-index: 3000 !important;
}

.select2-container--default .select2-results__options {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

label {
    font-weight: bold;
}

td.no-wrap {
    white-space: nowrap;
}
/* ===== Artikel-Zelle ===== */
/* ===== Artikel-Zelle ===== */
#tbl td.td-article .subdesc {
    display: block;
    font-size: .92em;
    color: #6c757d;
    margin-top: .15rem;
    overflow-wrap: anywhere;
}


/* Basis: Tabelle bleibt 100% breit */
@media (min-width:701px) {
    #tbl {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

        /* Default: Ellipsis – wird unten für relevante Spalten überschrieben */
        #tbl th, #tbl td {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

            /* Wichtige vordere Spalten NICHT abkürzen → umbrechen (auch Header) */
            #tbl th:nth-child(1), #tbl td:nth-child(1), /* Typ */
            #tbl th:nth-child(2), #tbl td:nth-child(2), /* Hersteller */
            #tbl th:nth-child(3), #tbl td:nth-child(3), /* Presssystem */
            #tbl th:nth-child(4), #tbl td:nth-child(4), /* Presskontur */
            #tbl th:nth-child(5), #tbl td:nth-child(5), /* Bauart */
            #tbl th:nth-child(6), #tbl td:nth-child(6), /* Zwischenzange */
            #tbl th:nth-child(8), #tbl td:nth-child(8), /* Artikel */
            #tbl th:nth-child(9), #tbl td:nth-child(9) /* Maschinen */ {
                white-space: normal;
                overflow: visible;
                text-overflow: clip;
                word-break: break-word;
                hyphens: auto;
            }

            /* Gas bleibt kompakt */
            #tbl th:nth-child(7), #tbl td:nth-child(7) {
                white-space: nowrap;
            }
}


/* Stufe A: 701–1200px – prozentuale Breiten (9 Spalten; 9. = Maschinen) */
@media (min-width:701px) and (max-width:1200px) {
    #tbl {
        font-size: .96rem;
    }

        #tbl th, #tbl td {
            padding: .45rem .55rem;
        }

            #tbl th:nth-child(1), #tbl td:nth-child(1) {
                width: 7%;
            }
            /* Typ */
            #tbl th:nth-child(2), #tbl td:nth-child(2) {
                width: 12%;
            }
            /* Hersteller */
            #tbl th:nth-child(3), #tbl td:nth-child(3) {
                width: 12%;
            }
            /* Presssystem */
            #tbl th:nth-child(4), #tbl td:nth-child(4) {
                width: 9%;
            }
            /* Presskontur */
            #tbl th:nth-child(5), #tbl td:nth-child(5) {
                width: 9%;
            }
            /* Bauart */
            #tbl th:nth-child(6), #tbl td:nth-child(6) {
                width: 9%;
            }
            /* Zwischenzange */
            #tbl th:nth-child(7), #tbl td:nth-child(7) {
                width: 5%;
            }
            /* Gas */
            #tbl th:nth-child(8), #tbl td:nth-child(8) {
                width: 18%;
            }
            /* Artikel */
            #tbl th:nth-child(9), #tbl td:nth-child(9),
            #tbl th.td-machines, #tbl td.td-machines {
                width: 19%;
            }
    /* Maschinen */
}


/* Stufe B: 701–960px – kompakter, mehr Platz für Artikel/Maschinen */
@media (min-width:701px) and (max-width:960px) {
    #tbl {
        font-size: .90rem;
        line-height: 1.25;
    }

        #tbl th, #tbl td {
            padding: .35rem .45rem;
        }

            #tbl th:nth-child(1), #tbl td:nth-child(1) {
                width: 6%;
            }

            #tbl th:nth-child(2), #tbl td:nth-child(2) {
                width: 11%;
            }

            #tbl th:nth-child(3), #tbl td:nth-child(3) {
                width: 11%;
            }

            #tbl th:nth-child(4), #tbl td:nth-child(4) {
                width: 8%;
            }

            #tbl th:nth-child(5), #tbl td:nth-child(5) {
                width: 8%;
            }

            #tbl th:nth-child(6), #tbl td:nth-child(6) {
                width: 8%;
            }

            #tbl th:nth-child(7), #tbl td:nth-child(7) {
                width: 5%;
            }

            #tbl th:nth-child(8), #tbl td:nth-child(8) {
                width: 22%;
            }
            /* Artikel */
            #tbl th:nth-child(9), #tbl td:nth-child(9),
            #tbl th.td-machines, #tbl td.td-machines {
                width: 21%;
            }
    /* Maschinen */
}


/* Stufe C: 701–860px – letzte Verdichtung */
@media (min-width:701px) and (max-width:860px) {
    #tbl {
        font-size: .86rem;
    }

        #tbl th, #tbl td {
            padding: .30rem .40rem;
        }

            #tbl th:nth-child(1), #tbl td:nth-child(1) {
                width: 6%;
            }
            /* Typ */
            #tbl th:nth-child(2), #tbl td:nth-child(2) {
                width: 11%;
            }
            /* Hersteller */
            #tbl th:nth-child(3), #tbl td:nth-child(3) {
                width: 10%;
            }
            /* Presssystem */
            #tbl th:nth-child(4), #tbl td:nth-child(4) {
                width: 8%;
            }
            /* Presskontur */
            #tbl th:nth-child(5), #tbl td:nth-child(5) {
                width: 8%;
            }
            /* Bauart */
            #tbl th:nth-child(6), #tbl td:nth-child(6) {
                width: 8%;
            }
            /* Zwischenzange */
            #tbl th:nth-child(7), #tbl td:nth-child(7) {
                width: 5%;
            }
            /* Gas */
            #tbl th:nth-child(8), #tbl td:nth-child(8) {
                width: 21%;
            }
            /* Artikel */
            #tbl th:nth-child(9), #tbl td:nth-child(9),
            #tbl th.td-machines, #tbl td.td-machines {
                width: 23%;
            }
    /* Maschinen */
}


/* Desktop/Tablet: Extra-Maschinen initial verstecken (Limit = 2) */
#tbl td.td-machines .mp-item.is-extra,
#tbl td.td-machines .mp-sep.is-extra,
.pz-ss td.td-machines .mp-item.is-extra,
.pz-ss td.td-machines .mp-sep.is-extra {
    display: none;
}


/* ===== Stack/Karten-Layout (≤700px) – unverändert ===== */
@media (max-width:700px) {
    #tbl {
        min-width: 0 !important;
        width: 100%;
        table-layout: auto;
    }

        #tbl thead {
            display: none;
        }

        #tbl tbody tr {
            display: grid;
            grid-template-columns: auto minmax(0,1fr);
            gap: .35rem .75rem;
            padding: .75rem;
            margin-bottom: .75rem;
            border: 1px solid #eee;
            border-radius: .75rem;
            background: #fff;
        }

        #tbl td {
            display: contents;
            white-space: normal;
        }

            #tbl td::before {
                content: attr(data-label);
                font-weight: 600;
                grid-column: 1;
                white-space: nowrap;
            }

            #tbl td > .cell-val, #tbl tbody tr > .cell-val {
                grid-column: 2;
                display: block;
                min-width: 0;
                overflow-wrap: anywhere;
            }

            #tbl td.is-empty {
                display: none;
            }

            #tbl td.no-wrap {
                white-space: normal;
            }

            #tbl td.td-machines .mp-sep {
                display: none;
            }

            #tbl td.td-machines .mp-item {
                display: inline;
                white-space: normal;
            }

                #tbl td.td-machines .mp-item:not(.last-visible):not(:last-child)::after {
                    content: ", ";
                }

                #tbl td.td-machines .mp-item.is-extra {
                    display: none;
                }

            #tbl td.td-machines .mp-more {
                margin-left: .25rem;
                font-size: inherit;
            }
}


/* ===== Stack/Karten-Layout (≤700px) ===== */
@media (max-width:700px) {
    #tbl {
        min-width: 0 !important;
        width: 100%;
        table-layout: auto;
    }

        #tbl thead {
            display: none;
        }

        #tbl tbody tr {
            display: grid;
            grid-template-columns: auto minmax(0,1fr);
            gap: .35rem .75rem;
            padding: .75rem;
            margin-bottom: .75rem;
            border: 1px solid #eee;
            border-radius: .75rem;
            background: #fff;
        }

        #tbl td {
            display: contents;
            white-space: normal;
        }

            #tbl td::before {
                content: attr(data-label);
                font-weight: 600;
                grid-column: 1;
                white-space: nowrap;
            }

            #tbl td > .cell-val, #tbl tbody tr > .cell-val {
                grid-column: 2;
                display: block;
                min-width: 0;
                overflow-wrap: anywhere;
            }

            #tbl td.is-empty {
                display: none;
            }

            #tbl td.no-wrap {
                white-space: normal;
            }

            #tbl td.td-machines .mp-sep {
                display: none;
            }

            #tbl td.td-machines .mp-item {
                display: inline;
                white-space: normal;
            }

                #tbl td.td-machines .mp-item:not(.last-visible):not(:last-child)::after {
                    content: ", ";
                }

                #tbl td.td-machines .mp-item.is-extra {
                    display: none;
                }

            #tbl td.td-machines .mp-more {
                margin-left: .25rem;
                font-size: inherit;
            }
}


/* ===== Sonstiges ===== */
.clean-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

    .clean-list li {
        margin: 0;
    }

.pz-footnotes li {
    scroll-margin-top: 80px;
}

/* Sticky-Header: bleibt beim Fenster-Scrollen oben */
/* Sticky-Header für Desktop/Tablet */
@media (min-width:701px) {
    #tbl {
        border-collapse: separate;
        border-spacing: 0;
    }

        #tbl thead th {
            position: sticky;
            top: var(--stickyTop, 0px); /* ggf. Abstand zur fixen Navbar, s. unten */
            z-index: 5;
            background: #eef2f7; /* deckend, damit nichts durchscheint */
        }

            #tbl thead th::after {
                content: "";
                position: absolute;
                left: 0;
                right: 0;
                bottom: -1px;
                height: 1px;
                background: rgba(0,0,0,.12);
            }
}

/* WICHTIG: kein overflow-y, sonst bricht sticky */
.table-responsive.table-wrap {
    display: block; /* bleibt */
    width: 100%;
    overflow-x: auto; /* nur horizontal scrollen */
    overflow-y: visible; /* WICHTIG: kein auto/hidden, sonst klebt sticky nicht */
    position: relative; /* hilft bei z-index stacking */
    -webkit-overflow-scrolling: touch; /* ok */
}

/* Falls vorhanden – nur anwenden, wenn nötig */
.content, .page, .container, main {
    overflow-y: visible !important;
}


/* ==== Robuste Sticky-Lösung: der Tabellen-Wrapper scrollt vertikal ==== */

/* Höhe anpassen, damit der Wrapper die Seite nicht überläuft.
   180px ist ein realistischer Puffer (Topbar, Filter, Abstände).
   Bei Bedarf diesen Wert ändern. */
:root {
    --stickyTop: 0px;
  
}



/* Wrapper erhält höheren Stapelkontext als der Header/Slider */
.table-responsive.table-wrap.stack,
.table-responsive.table-wrap,
.table-wrap {
    overflow-y: visible !important; /* sticky nicht blockieren */
    position: relative; /* neuer stacking context */
    z-index: 300; /* über dem Headerbild */
}

@media (min-width:701px) {
    #tbl, .pz-ss {
        border-collapse: separate;
        border-spacing: 0;
    }

        #tbl thead th,
        .pz-ss thead th {
            position: sticky;
            top: var(--stickyTop, 0px);
            z-index: 900002; /* über Bild/Slider */
            background: #eef2f7;
        }
}



/* Dauerhafter Sticky-Hotfix */
.table-responsive.table-wrap.stack,
.table-responsive.table-wrap,
.table-wrap,
.content,
.page,
.container,
main {
    overflow-y: visible !important;
    overflow-x: visible !important; /* nur, wenn nicht horizontal gescrollt wird */
    transform: none !important;
    filter: none !important;
    contain: none !important;
}
