/**
 * AGSS dropdown visibility — prevent Bootstrap action menus clipped by panel/table overflow.
 * Load after agss-layout-spacing.css. Does not change button/menu colors or sizes.
 */

:root {
    --z-dropdown: 1100;
}

/* -------------------------------------------------------------------------- */
/* Stacking — menus above cards, tables, and nav                                 */
/* -------------------------------------------------------------------------- */
.btn-group {
    position: relative;
}

.btn-group.show,
.btn-group.show > .dropdown-toggle {
    z-index: var(--z-dropdown, 1100);
}

.btn-group.show .dropdown-menu,
.dropdown-menu.show {
    z-index: calc(var(--z-dropdown, 1100) + 1);
}

/* -------------------------------------------------------------------------- */
/* Panel shells (boxes.css sets overflow:hidden on cards)                        */
/* -------------------------------------------------------------------------- */
.white-bg:has(.btn-group),
.white-bg:has(.dropdown-toggle),
.job-summary-top-stack,
.job-summary-customer-header-card,
.crm-card:has(.btn-group),
.ff-card:has(.btn-group),
.ff-panel:has(.btn-group),
.shadow:has(.btn-group) {
    overflow: visible;
}

/* CSR Customer Summary cards (.wrapper .card — boxes.css overflow:hidden) */
.wrapper .card:has(.btn-group),
.form-1600 .card:has(.btn-group),
.form-1400 .card:has(.btn-group),
.form-1200 .card:has(.btn-group),
.form-1000 .card:has(.btn-group),
.form-800 .card:has(.btn-group),
.form-600 .card:has(.btn-group),
.form-450 .card:has(.btn-group),
.form-fullscreen .card:has(.btn-group),
.overview-general-notes-card:has(.btn-group) {
    overflow: visible;
}

/* Modals — only while open so body scroll/layout stays contained */
.modal-content:has(.btn-group.show),
.modal-body:has(.btn-group.show) {
    overflow: visible;
}

/* -------------------------------------------------------------------------- */
/* Tables — row/header/cell clipping                                             */
/* -------------------------------------------------------------------------- */
.tablestyle:has(.btn-group.show),
.tablestyle tr:has(.btn-group.show),
.tablestyle th:has(.btn-group.show),
.tablestyle td:has(.btn-group.show) {
    overflow: visible;
}

/* Notes / simple tables (e.g. Customer Summary General Notes .bottomborder) */
.bottomborder:has(.btn-group.show),
table.bottomborder:has(.btn-group.show),
.bottomborder tr:has(.btn-group.show),
.bottomborder td:has(.btn-group.show) {
    overflow: visible;
}

/* -------------------------------------------------------------------------- */
/* Scroll wrappers — relax only while menu is open                               */
/* -------------------------------------------------------------------------- */
.overflowscroll:has(.btn-group.show),
.overflowscroll:has(.dropdown.show),
.scrollable-Sec:has(.btn-group.show),
.scroll-tabel:has(.btn-group.show),
.scroll-tabel1:has(.btn-group.show),
.tabulator:has(.btn-group.show) {
    overflow: visible;
}

/* -------------------------------------------------------------------------- */
/* Open-state fallback for any remaining hidden ancestors                        */
/* -------------------------------------------------------------------------- */
.white-bg:has(.btn-group.show),
.white-bg:has(.dropdown.show),
.filters:has(.btn-group.show),
.summary-card:has(.btn-group.show),
.center.white-bg:has(.btn-group.show),
.job-summary-top-stack:has(.btn-group.show),
.job-summary-customer-header-card:has(.btn-group.show) {
    overflow: visible;
}

.wrapper .card:has(.btn-group.show),
.form-1600 .card:has(.btn-group.show),
.form-1400 .card:has(.btn-group.show),
.form-1200 .card:has(.btn-group.show),
.form-1000 .card:has(.btn-group.show),
.form-800 .card:has(.btn-group.show),
.form-600 .card:has(.btn-group.show),
.form-450 .card:has(.btn-group.show),
.form-fullscreen .card:has(.btn-group.show),
.overview-general-notes-card:has(.btn-group.show) {
    overflow: visible;
}

/* -------------------------------------------------------------------------- */
/* Header toolbars — dropdown not clipped by flex row                            */
/* -------------------------------------------------------------------------- */
.job-summary-header-actions,
.job-summary-header-toolbar,
.job-summary-header-toolbar .job-summary-header-actions {
    overflow: visible;
}

.job-summary-header-actions > .btn-group.show {
    z-index: calc(var(--z-dropdown, 1100) + 2);
}

/* -------------------------------------------------------------------------- */
/* Quote / Invoice line items — ff-quote-option-card + quote-line-items-table  */
/* (af-quote-invoice-mobile.css loads in partials after layout; reinforce here)  */
/* -------------------------------------------------------------------------- */
.ff-quote-option-card:has(.btn-group),
.ff-quote-option-card:has(.btn-group.show),
.white-bg.ff-quote-option-card:has(.btn-group),
.white-bg.ff-quote-option-card.af-invoice-mobile-wrap:has(.btn-group),
.af-invoice-mobile-wrap.ff-quote-option-card:has(.btn-group) {
    overflow: visible !important;
}

.ff-quote-option-card > .quote-line-items-table:has(.btn-group),
.ff-quote-option-card > .quote-line-items-table:has(.btn-group.show),
.ff-quote-option-card:has(.btn-group.show) > .quote-line-items-table,
.ff-quote-option-card > .tablestyle.quote-line-items-table:has(.btn-group),
.white-bg.ff-quote-option-card > .quote-line-items-table:has(.btn-group),
.white-bg.ff-quote-option-card.af-invoice-mobile-wrap > .quote-line-items-table:has(.btn-group) {
    overflow: visible !important;
}

.quote-line-items-table:has(.btn-group),
.quote-line-items-table:has(.btn-group.show),
.quote-line-items-table tr:has(.btn-group.show),
.quote-line-items-table td:has(.btn-group.show),
.quote-line-items-table th:has(.btn-group.show) {
    overflow: visible !important;
}

#partialview:has(.btn-group.show),
.form-1200:has(.btn-group.show) {
    overflow: visible;
}
