/* ============================================
   PatternFly Single Select with Search Widget
   ============================================ */

/* -----------------------------
   Main Container & Positioning
   ----------------------------- */

/* Main container must be relative for absolute positioning of dropdown */
.pf-v6-c-select.pf-searchable-select-single {
    position: relative;
    width: 100%;
    display: inline-block;
    z-index: 1; /* Establish stacking context */
}

/* When dropdown is open, increase stacking context */
.pf-v6-c-select.pf-searchable-select-single:has(.pf-v6-c-menu:not(.pf-m-hidden)) {
    z-index: 9998;
}

/* Ensure parent containers allow overflow for dropdown visibility */
.pf-v6-c-card:has(.pf-v6-c-select.pf-searchable-select-single) {
    overflow: visible;
}

.pf-v6-c-card:has(.pf-v6-c-select.pf-searchable-select-single) .pf-v6-c-card__body {
    overflow: visible;
}

/* Ensure modals and dialogs allow overflow for dropdowns */
.pf-v6-c-modal-box:has(.pf-v6-c-select.pf-searchable-select-single),
.pf-v6-c-modal-box .pf-v6-c-modal-box__body {
    overflow: visible;
}

/* Ensure form containers don't clip dropdowns */
.pf-v6-c-form:has(.pf-v6-c-select.pf-searchable-select-single) {
    overflow: visible;
}

/* -----------------------------
   Dropdown Menu Base Styles
   ----------------------------- */

/* Menu container - use fixed positioning to escape all container boundaries */
.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu {
    position: fixed; /* Fixed positioning escapes all parent containers */
    /* top, left, and width will be set by JavaScript */
    margin-top: 4px; /* Small gap between toggle and menu */
    max-height: 320px;
    overflow: hidden;
    z-index: 9999; /* Very high z-index to appear above modals and dialogs */
}

/* Hidden state */
.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu.pf-m-hidden {
    display: none;
}

/* Menu content wrapper */
.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__content {
    display: flex;
    flex-direction: column;
    max-height: 320px;
}

/* -----------------------------
   Search Input Area
   ----------------------------- */

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-select__menu-search {
    flex-shrink: 0;
    padding: 8px;
    background-color: var(--pf-t--global--background-color--secondary);
    border-bottom: 1px solid var(--pf-t--global--border-color--default);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-text-input-group__text-input {
    width: 100%;
    padding: 6px 12px;
    border: 1px solid var(--pf-t--global--border-color--default);
    border-radius: var(--pf-t--global--border-radius--default);
    background-color: var(--pf-t--global--background-color--primary);
    color: var(--pf-t--global--text--color--regular);
    font-size: 14px;
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-text-input-group__text-input:focus {
    outline: 2px solid var(--pf-t--global--color--brand--default);
    outline-offset: -2px;
    background-color: var(--pf-t--global--background-color--primary);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-text-input-group__text-input::placeholder {
    color: var(--pf-t--global--text--color--subtle);
    opacity: 0.7;
}

/* -----------------------------
   Options List & Menu Items
   ----------------------------- */

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__list {
    flex: 1 1 auto;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background-color: var(--pf-t--global--background-color--primary);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__list-item {
    margin: 0;
    padding: 0;
    background-color: var(--pf-t--global--background-color--primary);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__item {
    width: 100%;
    min-height: 40px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--pf-t--global--text--color--regular);
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__item:hover {
    background-color: var(--pf-t--global--background-color--secondary);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__item:focus {
    outline: 2px solid var(--pf-t--global--color--brand--default);
    outline-offset: -2px;
    background-color: var(--pf-t--global--background-color--secondary);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__item.pf-m-selected {
    background-color: var(--pf-t--global--color--brand--default);
    color: var(--pf-t--global--text--color--on-brand);
    font-weight: 600;
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__item-text {
    flex: 1;
}

/* -----------------------------
   Custom Scrollbar Styling
   ----------------------------- */

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__list::-webkit-scrollbar {
    width: 8px;
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__list::-webkit-scrollbar-track {
    background-color: var(--pf-t--global--background-color--secondary);
    border-radius: 4px;
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__list::-webkit-scrollbar-thumb {
    background-color: var(--pf-t--global--border-color--default);
    border-radius: 4px;
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-menu__list::-webkit-scrollbar-thumb:hover {
    background-color: var(--pf-t--global--border-color--hover);
}

/* -----------------------------
   Toggle Button Styling
   ----------------------------- */

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-select__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--pf-t--global--border-color--default);
    border-radius: var(--pf-t--global--border-radius--default);
    background-color: var(--pf-t--global--background-color--primary);
    color: var(--pf-t--global--text--color--regular);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-select__toggle:hover {
    border-color: var(--pf-t--global--border-color--hover);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-select__toggle:focus {
    outline: 2px solid var(--pf-t--global--color--brand--default);
    outline-offset: 2px;
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-select__toggle[aria-expanded="true"] {
    border-color: var(--pf-t--global--color--brand--default);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-select__toggle-text {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--pf-t--global--text--color--regular);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-select__toggle-text.pf-m-placeholder {
    color: var(--pf-t--global--text--color--subtle);
}

.pf-v6-c-select.pf-searchable-select-single .pf-v6-c-select__toggle-arrow {
    margin-left: 8px;
    color: var(--pf-t--global--text--color--subtle);
}

/* ============================================
   Proposal-Specific Styles
   (Keep for backward compatibility)
   ============================================ */

/* Table column width fixes for proposal allocations */
#allocations-table .pf-v6-c-table__table {
    table-layout: fixed;
    width: 100%;
}

/* Specific column width allocations */
#allocations-table th:nth-child(1), /* Resource */
#allocations-table td:nth-child(1) {
    width: 20%;
    min-width: 150px;
}

#allocations-table th:nth-child(2), /* Role */
#allocations-table td:nth-child(2) {
    width: 20%;
    min-width: 120px;
}

#allocations-table th:nth-child(3), /* Hours */
#allocations-table td:nth-child(3) {
    width: 12%;
    min-width: 80px;
}

#allocations-table th:nth-child(4), /* Rate */
#allocations-table td:nth-child(4) {
    width: 18%;
    min-width: 140px;
}

#allocations-table th:nth-child(5), /* Total Cost */
#allocations-table td:nth-child(5) {
    width: 18%;
    min-width: 120px;
}

#allocations-table th:nth-child(6), /* Actions */
#allocations-table td:nth-child(6) {
    width: 12%;
    min-width: 80px;
}

/* Ensure header text doesn't wrap and shows full content */
#allocations-table .pf-v6-c-table__th {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* Ensure table cells can expand to show full content */
#allocations-table .pf-v6-c-table__td {
    word-wrap: break-word;
    overflow: visible;
}

/* Additional spacing for proposal allocations sections */
.proposal-allocations-section {
    margin-top: 1rem !important;
    padding-top: 0.67rem !important;
    border-top: 1px solid var(--pf-v6-global--BorderColor--100) !important;
}

.proposal-allocations-section:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
}

/* Ensure generous spacing between major sections */
#allocations-table {
    margin-bottom: 1rem !important;
}

/* Add Team Member section spacing */
.add-team-member-section {
    margin-top: 1.33rem !important;
    margin-bottom: 1.33rem !important;
    padding-top: 0.67rem !important;
    padding-bottom: 0.33rem !important;
}

/* Cost Summary section spacing */
.cost-summary-section {
    margin-top: 1.33rem !important;
    padding-top: 0.83rem !important;
}
