/**
 * Global Select2 theme — sharp edges, matches .form-input borders, purple dropdown hover.
 * Used across admin pages for searchable dropdowns.
 */

/* Single select — closed state (match .form-input: 1px #c2c2c2) */
.select2-container--default .select2-selection--single {
    border: 1px solid #c2c2c2 !important;
    border-radius: 0 !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    background-color: #ffffff !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1 !important;
    padding-left: 12px !important;
    padding-right: 36px !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    color: #000000 !important;
    text-align: left !important;
}

/* Hide clear (×) icon globally */
.select2-container--default .select2-selection--single .select2-selection__clear {
    display: none !important;
}

/* Placeholder */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #000000 !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    width: 100% !important;
}

/* Dropdown arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    right: 10px !important;
    width: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border: none !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='4 6 8 10 12 6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    transition: transform 0.2s ease-in-out !important;
    transform: rotate(0deg) !important;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    transform: rotate(180deg) !important;
}

.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--open .select2-selection--single {
    outline: none !important;
    /* restore purple focus border */
    border-color: #795ded !important;
    box-shadow: none !important;
}

/* Dropdown panel */
.select2-dropdown {
    border: 1px solid #d1d5db !important;
    border-radius: 0 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #d1d5db !important;
    border-radius: 0 !important;
    padding: 0.5rem;
    outline: none !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #795ded !important;
    box-shadow: none !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted[aria-selected]:hover {
    background-color: #8065ee !important;
    color: #ffffff !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #8065ee !important;
    color: #ffffff !important;
}

.select2-container--default .select2-results__option[aria-selected=true]:hover {
    background-color: #7354ee !important;
    color: #ffffff !important;
}


.report-select2-wrapper .select2-container--default .select2-selection--single {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238065ee' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='6.5' cy='6.5' r='4'/%3e%3cline x1='10' y1='10' x2='14' y2='14'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: 10px center !important;
    background-size: 20px 20px !important; 
    height: 48px !important;
}

/* Push text right to make room for larger icon */
.report-select2-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 38px !important; /* ← increased from 32px */
}

/* Column filter inputs: keep placeholder and icons in fixed positions */
/* Targets the inputs inside the filter table so layout remains constant */
#filter-table input[type="text"],
#filter-table input[type="number"],
#banned-filter-table input[type="text"],
#filter-table-reservations input[type="text"]:not(.res-restaurant-date-display) {
    padding-left: 28px !important; /* space for the search icon */
    padding-right: 32px !important; /* space for the clear button */
    text-align: center !important; /* keep placeholder centered */
    box-sizing: border-box !important;
}

#filter-table input[type="text"]::placeholder,
#filter-table input[type="number"]::placeholder,
#banned-filter-table input[type="text"]::placeholder,
#filter-table-reservations input[type="text"]:not(.res-restaurant-date-display)::placeholder {
    text-align: center !important;
    color: #6b7280 !important;
    opacity: 1 !important;
}

/* Date filter: no search/clear icons — symmetric padding */
#filter-table-reservations .res-restaurant-date-display {
    padding-left: 12px !important;
    padding-right: 12px !important;
    text-align: center !important;
    box-sizing: border-box !important;
    background-color: #ffffff !important;
    border: 1px solid #c2c2c2 !important;
    border-radius: 0 !important;
    height: 38px !important;
    line-height: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    color: #000000 !important;
    width: 100% !important;
    font-size: 0.75rem !important;
}

#filter-table-reservations .res-restaurant-date-display::placeholder {
    text-align: center !important;
    color: #000000 !important;
    font-weight: 600 !important;
    opacity: 1 !important;
}

#filter-table-reservations .res-restaurant-date-display:focus {
    text-align: center !important;
    border-color: #795ded !important;
    box-shadow: 0 0 0 3px rgba(121, 93, 237, 0.08) !important;
    outline: none !important;
}

/* Ensure the absolute icon and clear button positions don't shift layout */
#filter-table .relative .bi-search,
#banned-filter-table .relative .bi-search,
#filter-table-reservations .relative .bi-search {
    left: 8px !important;
    transform: translateY(-50%) !important;
}

#filter-table .filter-clear-btn,
#banned-filter-table .filter-clear-btn,
#filter-table-reservations .filter-clear-btn {
    right: 8px !important;
}

/* When input is focused, keep center alignment and fixed padding */
#filter-table input[type="text"]:focus,
#filter-table input[type="number"]:focus,
#banned-filter-table input[type="text"]:focus,
#filter-table-reservations input[type="text"]:not(.res-restaurant-date-display):focus {
    text-align: center !important;
    padding-left: 28px !important;
    padding-right: 32px !important;
}

/* Filter inputs: show purple focus like Select2 (visible when clicking) */
#filter-table input[type="text"]:focus,
#filter-table input[type="number"]:focus,
#banned-filter-table input[type="text"]:focus,
#filter-table-reservations input[type="text"]:not(.res-restaurant-date-display):focus {
    border-color: #795ded !important;
    /* subtle purple glow for visibility */
    box-shadow: 0 0 0 3px rgba(121, 93, 237, 0.08) !important;
    outline: none !important;
}

/* Make filter inputs match Select2 background/border/layout */
#filter-table input[type="text"],
#filter-table input[type="number"],
#banned-filter-table input[type="text"],
#filter-table-reservations input[type="text"]:not(.res-restaurant-date-display) {
    background-color: #ffffff !important;
    border: 1px solid #c2c2c2 !important;
    border-radius: 0 !important;
    height: 38px !important;
    line-height: 1 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    color: #000000 !important;
    width: 100% !important;
    font-size: 0.75rem !important;
}

/* Keep placeholder font-weight and color consistent with Select2 placeholder */
#filter-table input[type="text"]::placeholder,
#filter-table input[type="number"]::placeholder,
#banned-filter-table input[type="text"]::placeholder,
#filter-table-reservations input[type="text"]:not(.res-restaurant-date-display)::placeholder {
    color: #000000 !important;
    font-weight: 600 !important;
}

/* Ensure clear button and search icon remain above the input and do not affect layout */
#filter-table .relative .bi-search,
#filter-table .filter-clear-btn,
#banned-filter-table .relative .bi-search,
#banned-filter-table .filter-clear-btn,
#filter-table-reservations .relative .bi-search,
#filter-table-reservations .filter-clear-btn {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* Slightly increase z-index so icons stay visible on top of border shadows */
#filter-table .relative .bi-search,
#banned-filter-table .relative .bi-search,
#filter-table-reservations .relative .bi-search {
    z-index: 2 !important;
}

#filter-table .filter-clear-btn,
#banned-filter-table .filter-clear-btn,
#filter-table-reservations .filter-clear-btn {
    z-index: 2 !important;
}

/* Column filter Select2 dropdowns (status filters, etc.) */
#filter-table .column-filter-select {
    position: relative;
}

#filter-table .column-filter-select .select2-container:not(.select2-container--open) {
    z-index: auto !important;
}

#filter-table .column-filter-select .select2-container--default .select2-selection--single {
    height: 38px !important;
    background-image: none !important;
}

#filter-table .column-filter-select .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 8px !important;
    /* Reserve room for clear (×) + chevron so text never runs under icons */
    padding-right: 52px !important;
    text-align: left !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
}

#filter-table .column-filter-select.has-value .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-right: 64px !important;
}

/* App navigation menu Select2 */
.navigation-combo-select {
    position: relative;
    width: 100%;
}

.navigation-combo-select .select2-container:not(.select2-container--open) {
    z-index: auto !important;
}

.navigation-combo-select .navigation-combo-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    color: #866cee;
    pointer-events: none;
    font-size: 14px;
    line-height: 1;
}

.navigation-combo-select .select2-container--default .select2-selection--single,
.navigation-combo-select .select2-container--default .select2-selection--single:hover,
.navigation-combo-select .select2-container--default.select2-container--open .select2-selection--single,
.navigation-combo-select .select2-container--default.select2-container--focus .select2-selection--single {
    height: 48px !important;
    background-image: none !important;
    border: 2px solid #866cee !important;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

.navigation-combo-select .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 40px !important;
    padding-right: 46px !important;
    text-align: left !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 14px !important;
}

#filter-table .column-filter-select .select2-container--default .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
    justify-content: flex-start !important;
    text-align: left !important;
}

.navigation-combo-select .select2-container--default .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
    justify-content: flex-start !important;
    text-align: left !important;
}

.select2-results__option .navigation-combo-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.select2-results__option .navigation-combo-option i {
    color: #866cee;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.select2-container--default .select2-results__option--highlighted .navigation-combo-option i {
    color: #ffffff;
}

#filter-table .column-filter-select .filter-clear-btn {
    right: 28px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 5 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0 !important;
    border: 1px solid #d1d5db;
    background: #ffffff !important;
    color: #4b5563 !important;
    line-height: 1;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

#filter-table .column-filter-select .filter-clear-btn.hidden {
    display: none !important;
}

#filter-table .column-filter-select .filter-clear-btn i {
    font-size: 0.95rem !important;
    line-height: 1;
    color: inherit;
}

#filter-table .column-filter-select .filter-clear-btn:hover,
#filter-table .column-filter-select .filter-clear-btn:focus-visible {
    color: #111827 !important;
    border-color: #9ca3af;
    background: #f3f4f6 !important;
    outline: none;
}

#filter-table-reservations .res-filter-status-select,
.res-cal-status-filter .res-filter-status-select {
    position: relative;
}

#filter-table-reservations .res-filter-status-select .select2-container--default .select2-selection--single,
.res-cal-status-filter .res-filter-status-select .select2-container--default .select2-selection--single {
    height: 38px !important;
    background-image: none !important;
}

#filter-table-reservations .res-filter-status-select .select2-container--default .select2-selection--single .select2-selection__rendered,
.res-cal-status-filter .res-filter-status-select .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 12px !important;
    padding-right: 52px !important;
    text-align: center !important;
    justify-content: center !important;
}

#filter-table-reservations .res-filter-status-select .filter-clear-btn,
.res-cal-status-filter .res-filter-status-select .filter-clear-btn {
    right: 28px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 3 !important;
}
.navigation-combo-container {
    position: relative;
    z-index: 500;
}

.staff-role-combo-container {
    position: relative;
    z-index: 499;
    max-width: 260px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
}

.menu-hub {
    position: relative;
    z-index: 499;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 15px 15px 0;
    box-sizing: border-box;
}

.menu-hub-search-wrap {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
}

.menu-hub-search-inner {
    width: 100%;
}

.menu-hub-context {
    text-align: center;
    margin-bottom: 4px;
    padding: 0 4px;
}

.menu-hub-greeting {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.4rem;
    font-weight: 600;
    color: #000000;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.menu-hub-summary {
    margin-top: 6px;
}

.menu-hub-line {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45rem;
    color: #000000;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.menu-hub-line-muted {
    margin-top: 4px;
    color: #374151;
}

.menu-hub-line-demo {
    margin-top: 4px;
    font-size: 0.75rem;
    line-height: 1.3rem;
    color: #6b21a8;
}

.menu-hub-demo-badge {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 6px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b21a8;
    background: #f3efff;
    border: 1px solid #d8ccf9;
    vertical-align: middle;
    line-height: 1.3;
    white-space: nowrap;
}

.menu-hub-active-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
}

.menu-hub-active-label {
    color: #374151;
    font-size: 0.8125rem;
    font-weight: 500;
}

.menu-hub-role-form {
    display: inline-block;
    margin: 0;
    vertical-align: middle;
    max-width: 100%;
}

.menu-hub-role-select {
    width: 128px;
    max-width: 100%;
    vertical-align: middle;
}

.menu-hub-role-select .select2-container {
    width: 100% !important;
    max-width: 100%;
}

.menu-hub-role-select .select2-container--default .select2-selection--single,
.menu-hub-role-select .select2-container--default .select2-selection--single:hover,
.menu-hub-role-select .select2-container--default.select2-container--open .select2-selection--single,
.menu-hub-role-select .select2-container--default.select2-container--focus .select2-selection--single {
    height: 34px !important;
    min-height: 34px !important;
}

.menu-hub-role-select .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 32px !important;
    font-size: 12px !important;
    padding-left: 34px !important;
    padding-right: 28px !important;
}

.menu-hub-role-select .navigation-combo-search-icon {
    left: 11px;
    font-size: 12px;
}

@media (min-width: 640px) {
    .menu-hub-greeting {
        font-size: 1.25rem;
        line-height: 1.5rem;
    }

    .menu-hub-line,
    .menu-hub-active-label {
        font-size: 0.875rem;
    }

    .menu-hub-active-label {
        white-space: nowrap;
    }
}

@media (max-width: 639px) {
    .menu-hub {
        padding: 10px 10px 0;
    }

    .menu-hub-search-wrap {
        padding-left: 10px;
        padding-right: 10px;
    }

    .menu-hub-search-wrap.navigation-combo-container {
        margin-bottom: 12px;
    }

    .menu-hub-search-inner .navigation-combo-select,
    .menu-hub-search-inner .select2-container {
        width: 100% !important;
        max-width: 100%;
    }

    .menu-hub-context {
        padding: 0 2px;
    }

    .menu-hub-greeting {
        font-size: 1.0625rem;
        line-height: 1.35rem;
    }

    .menu-hub-active-row {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .menu-hub-active-label {
        text-align: center;
        line-height: 1.25rem;
    }

    .menu-hub-role-form {
        display: block;
        width: auto;
        max-width: 100%;
        margin: 0 auto;
    }

    .menu-hub-role-select {
        width: 136px;
        max-width: min(136px, calc(100vw - 48px));
        margin: 0 auto;
    }
}

@media (max-width: 400px) {
    .menu-hub {
        padding: 8px 8px 0;
    }

    .menu-hub-search-wrap {
        padding-left: 8px;
        padding-right: 8px;
    }

    .menu-hub-greeting {
        font-size: 1rem;
        line-height: 1.3rem;
    }

    .menu-hub-line,
    .menu-hub-active-label {
        font-size: 0.75rem;
        line-height: 1.35rem;
    }

    .menu-hub-role-select {
        width: 118px;
        max-width: min(118px, calc(100vw - 40px));
    }

    .menu-hub-role-select .select2-container--default .select2-selection--single .select2-selection__rendered {
        font-size: 11px !important;
        padding-left: 30px !important;
        padding-right: 24px !important;
    }

    .menu-hub-role-select .navigation-combo-search-icon {
        left: 9px;
        font-size: 11px;
    }
}

body:has(.modal:not(.hidden)) .navigation-combo-container {
    z-index: 1;
}

/* Topbar restaurant selector Select2 */
.restaurant-combo-select {
    position: relative;
    width: 100%;
}

.restaurant-combo-select .select2-container:not(.select2-container--open) {
    z-index: auto !important;
}

.restaurant-combo-select .restaurant-combo-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    color: #866cee;
    pointer-events: none;
    font-size: 14px;
    line-height: 1;
}

.restaurant-combo-select .select2-container--default .select2-selection--single,
.restaurant-combo-select .select2-container--default .select2-selection--single:hover,
.restaurant-combo-select .select2-container--default.select2-container--open .select2-selection--single,
.restaurant-combo-select .select2-container--default.select2-container--focus .select2-selection--single {
    height: 48px !important;
    background-image: none !important;
    border: 2px solid #866cee !important;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: #ffffff !important;
}

.restaurant-combo-select .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 40px !important;
    padding-right: 46px !important;
    text-align: left !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.restaurant-combo-select .select2-container--default .select2-selection--single .select2-selection__rendered .select2-selection__placeholder {
    justify-content: flex-start !important;
    text-align: left !important;
}

.select2-results__option .restaurant-combo-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.restaurant-combo-select .select2-selection__rendered .restaurant-combo-option,
.select2-results__option .restaurant-combo-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.restaurant-combo-select .select2-selection__rendered .restaurant-combo-option-logo,
.select2-results__option .restaurant-combo-option-logo {
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.select2-container--default .select2-results__option--highlighted .restaurant-combo-option-logo {
    border-color: rgba(255, 255, 255, 0.35);
}

.dark .restaurant-combo-select .select2-container--default .select2-selection--single,
.dark .restaurant-combo-select .select2-container--default .select2-selection--single:hover,
.dark .restaurant-combo-select .select2-container--default.select2-container--open .select2-selection--single,
.dark .restaurant-combo-select .select2-container--default.select2-container--focus .select2-selection--single {
    background-color: #1f2937 !important;
}

.dark .restaurant-combo-select .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f3f4f6 !important;
}
