/* GO-FINDYOU Public Catalog 6.1.3
   Exakte Klassen aus resources/views/entries/show.php:
   aside.entry-sidebar.gfy81-monitor-sidebar
   section.gfy81-cockpit
*/

/* Elterncontainer erkennen, der article und die echte Sidebar enthält. */
body:has([data-entry-screenshot-open])
*:has(> article):has(> aside.entry-sidebar.gfy81-monitor-sidebar) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 330px !important;
    gap: 26px !important;
    align-items: start !important;
}

/* Hauptinhalt links. */
body:has([data-entry-screenshot-open])
*:has(> article):has(> aside.entry-sidebar.gfy81-monitor-sidebar)
> article {
    grid-column: 1 !important;
    min-width: 0 !important;
}

/* Exakte Sidebar rechts. */
body:has([data-entry-screenshot-open])
aside.entry-sidebar.gfy81-monitor-sidebar {
    grid-column: 2 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    align-self: start !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 330px !important;
    height: auto !important;
    min-height: 0 !important;
    position: sticky !important;
    top: 22px !important;
}

/* Neue Aktionskarten stehen innerhalb der echten Sidebar. */
body:has([data-entry-screenshot-open])
aside.entry-sidebar.gfy81-monitor-sidebar
> .gfy-pc61-sidebar {
    order: 1 !important;
    display: grid !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    position: static !important;
}

/* Das vorhandene Live-Cockpit direkt darunter. */
body:has([data-entry-screenshot-open])
aside.entry-sidebar.gfy81-monitor-sidebar
> .gfy81-cockpit {
    order: 2 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    position: static !important;
}

/* Weitere Monitor-Blöcke bleiben ebenfalls rechts und folgen darunter. */
body:has([data-entry-screenshot-open])
aside.entry-sidebar.gfy81-monitor-sidebar
> :not(.gfy-pc61-sidebar):not(.gfy81-cockpit) {
    order: 3 !important;
    width: 100% !important;
    max-width: none !important;
    position: static !important;
}

/* Frühere zu breite generische Regeln neutralisieren. */
body:has([data-entry-screenshot-open]) .gfy81-detail-grid,
body:has([data-entry-screenshot-open]) .gfy81-history-grid {
    grid-column: auto !important;
}

@media (max-width: 1050px) {
    body:has([data-entry-screenshot-open])
    *:has(> article):has(> aside.entry-sidebar.gfy81-monitor-sidebar) {
        grid-template-columns: 1fr !important;
    }

    body:has([data-entry-screenshot-open])
    *:has(> article):has(> aside.entry-sidebar.gfy81-monitor-sidebar)
    > article,
    body:has([data-entry-screenshot-open])
    aside.entry-sidebar.gfy81-monitor-sidebar {
        grid-column: 1 !important;
    }

    body:has([data-entry-screenshot-open])
    aside.entry-sidebar.gfy81-monitor-sidebar {
        max-width: none !important;
        position: static !important;
    }
}
