/* =====================================================
   UTILITIES
   Helper classes, z-index fixes, and misc utilities
   ===================================================== */

/* === Z-INDEX HIERARCHY === */

/* Cards base z-index */
.mtc-card {
    z-index: 1;
    position: relative;
}

/* Ensure header stays on top */
.elementor-location-header,
header,
.site-header,
#masthead {
    z-index: 9999;
}

/* === SELECT2 Z-INDEX FIXES === */

/* Fix Select2 dropdown z-index issues - must appear above filters */
.select2-dropdown {
    z-index: 99999 !important;
}

/* Ensure Select2 container has proper positioning */
.select2-container--open .select2-dropdown {
    z-index: 99999 !important;
}

/* Fix Select2 dropdown positioning issues */
.select2-container--default.select2-container--open {
    z-index: 99999 !important;
}

/* When dropdown is appended to body (position: absolute), set fixed width */
body > .select2-container.select2-container--open {
    width: 240px !important;
}

/* Ensure dropdown itself matches container width */
body > .select2-container .select2-dropdown {
    width: 240px !important;
}

/* Critical: Allow Select2 to break out of filter container */
#mtc-filters .select2-container {
    position: relative;
    z-index: 10;
}

/* When Select2 is open, increase z-index further */
#mtc-filters .select2-container--open {
    z-index: 99999 !important;
}

/* Ensure dropdown appears above all filter elements */
#mtc-filters .select2-dropdown {
    z-index: 99999 !important;
}

/* Prevent popup from moving when Select2 opens */
.mtc-filter-popup-body .select2-container {
    position: relative;
}

.mtc-filter-popup-body .select2-dropdown {
    z-index: 99999 !important;
}

/* === SELECT2 DROPDOWN SCROLLING FIX === */

/* Ensure Select2 results list is scrollable */
.select2-results__options {
    max-height: 300px;
    overflow-y: auto;
}

/* Fix for Krajina (country) filter scrollbar - apply to all country selects */
.mtc-country-select + .select2-container .select2-results__options {
    max-height: 300px;
    overflow-y: auto !important;
}

/* Ensure dropdown container allows scrolling */
.select2-container--default .select2-results > .select2-results__options {
    max-height: 300px;
    overflow-y: auto;
}
