/* Shared Figma-derived select component. Native selects are hidden only after
   JavaScript has created a fully functional replacement. */
.ijmbe-custom-select {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    color: #353534;
}

.ijmbe-custom-select__native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}

.ijmbe-custom-select__trigger {
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: var(--ijmbe-select-height, auto);
    min-height: 0;
    padding: 0 42px 0 14px;
    box-sizing: border-box;
    align-items: center;
    border: 1.5px solid #3f4144;
    border-radius: 14px;
    outline: 0;
    background: #fff;
    color: #353534;
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.ijmbe-custom-select__trigger::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 18px;
    width: 9px;
    height: 9px;
    border-right: 2px solid #3f4144;
    border-bottom: 2px solid #3f4144;
    transform: translateY(-70%) rotate(45deg);
    transform-origin: center;
    transition: transform 160ms ease;
    pointer-events: none;
}

.ijmbe-custom-select.is-open .ijmbe-custom-select__trigger::after {
    transform: translateY(-30%) rotate(225deg);
}

.ijmbe-custom-select__trigger:hover:not(:disabled) {
    border-color: #303236;
    background: #fff;
}

.ijmbe-custom-select__trigger:focus-visible,
.ijmbe-custom-select.is-open .ijmbe-custom-select__trigger {
    border-color: var(--ijmbe-info-100, #347296);
    box-shadow: 0 0 0 3px rgba(52, 114, 150, 0.28);
}

/* Match only the Student Clearance Study Centre control to its neighbouring
   payment fields. The native select remains the no-JavaScript fallback. */
.ijmbe-v2-clearance-form #clearance-study_centre + .ijmbe-custom-select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.ijmbe-v2-clearance-form #clearance-study_centre + .ijmbe-custom-select .ijmbe-custom-select__trigger {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 46px;
    min-height: 46px;
    padding: 10px 42px 10px 14px;
    border: 1px solid #8b8f94;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1.4;
}

.ijmbe-custom-select__value {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

.ijmbe-custom-select.is-placeholder .ijmbe-custom-select__value {
    color: #626262;
}

.ijmbe-custom-select.is-disabled .ijmbe-custom-select__trigger,
.ijmbe-custom-select__trigger:disabled {
    border-color: #94a3b8;
    background: #f3f4f6;
    color: #64748b;
    cursor: not-allowed;
    opacity: 1;
}

.ijmbe-custom-select.is-disabled .ijmbe-custom-select__trigger::after {
    border-color: #64748b;
}

.ijmbe-custom-select.is-invalid .ijmbe-custom-select__trigger {
    border-color: #b42318;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

.ijmbe-custom-select-menu {
    position: absolute;
    z-index: 10000;
    top: calc(100% + 4px);
    left: 0;
    display: none;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 6px 0;
    border: 1px solid #e1e3e6;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    box-sizing: border-box;
    overflow: hidden;
}

/* The academic card was intentionally rounded with clipped overflow, which
   also clipped its absolutely positioned option menus. Lift only this card
   while one of its selects is open; field dimensions and grid tracks remain
   untouched. */
.ijmbe-v2-full-registration #academic-qualification {
    overflow: visible;
}

.ijmbe-v2-full-registration #academic-qualification.is-dropdown-layer-open {
    position: relative;
    z-index: 2000;
}

.ijmbe-v2-full-registration #academic-qualification .ijmbe-custom-select.is-open {
    z-index: 2010;
}

.ijmbe-v2-full-registration #academic-qualification .ijmbe-custom-select-menu {
    z-index: 2020;
}

/* These two preceding registration panels use the same clipped card shell.
   Lift only the panel containing the currently open select so its menu can
   paint above the following section; closing restores the normal layering. */
.ijmbe-v2-full-registration #study-center.is-dropdown-layer-open,
.ijmbe-v2-full-registration #preferred-academic-details.is-dropdown-layer-open {
    position: relative;
    z-index: 2000;
    overflow: visible;
}

.ijmbe-v2-full-registration #study-center .ijmbe-custom-select.is-open,
.ijmbe-v2-full-registration #preferred-academic-details .ijmbe-custom-select.is-open {
    z-index: 2010;
}

.ijmbe-v2-full-registration #study-center .ijmbe-custom-select-menu,
.ijmbe-v2-full-registration #preferred-academic-details .ijmbe-custom-select-menu {
    z-index: 2020;
}

.ijmbe-custom-select-menu.is-above {
    top: auto;
    bottom: calc(100% + 4px);
}

.ijmbe-custom-select-menu.is-open {
    display: block;
}

.ijmbe-custom-select-options {
    max-height: min(320px, calc(100vh - 32px));
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #90b3b8 transparent;
}

.ijmbe-custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.ijmbe-custom-select-options::-webkit-scrollbar-track {
    background: transparent;
}

.ijmbe-custom-select-options::-webkit-scrollbar-thumb {
    border: 2px solid #fff;
    border-radius: 999px;
    background: #90b3b8;
}

.ijmbe-custom-select-option {
    display: flex;
    width: 100%;
    min-height: 48px;
    padding: 13px 18px;
    align-items: center;
    box-sizing: border-box;
    background: #fff;
    color: #303236;
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    cursor: pointer;
}

.ijmbe-custom-select-option:hover,
.ijmbe-custom-select-option.is-highlighted,
.ijmbe-custom-select-option[aria-selected="true"] {
    background: #fff6ed;
}

.ijmbe-custom-select-option.is-highlighted {
    box-shadow: inset 3px 0 0 var(--ijmbe-info-100, #347296);
}

.ijmbe-custom-select-option[aria-disabled="true"] {
    background: #f8fafc;
    color: #8a939f;
    cursor: not-allowed;
}

/* The registration result grid deliberately gives grade fields a compact
   track. Keep the chevron allowance compact without changing that track. */
.ijmbe-v2-full-registration .olevelsubject .ijmbe-custom-select__trigger {
    padding-right: 34px;
    padding-left: 14px;
}

.ijmbe-v2-full-registration .olevelsubject .ijmbe-custom-select__trigger::after {
    right: 12px;
}

.admin-body .ijmbe-custom-select__trigger {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: var(--ijmbe-select-height, auto);
    min-height: 0;
    padding: 0 36px 0 12px;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--admin-border-strong, #d0d5dd);
    border-radius: var(--admin-radius-sm, 8px);
    background: #fff;
    color: var(--admin-text, #1f2937);
    font-size: 13px;
    box-sizing: border-box;
    transform: none;
}

.admin-body .ijmbe-custom-select__trigger::after {
    right: 14px;
    width: 8px;
    height: 8px;
}

.admin-body .ijmbe-custom-select__trigger:hover:not(:disabled) {
    border-color: #9aa8b8;
    background: #fff;
    transform: none;
}

.admin-body .ijmbe-custom-select__trigger:focus-visible,
.admin-body .ijmbe-custom-select.is-open .ijmbe-custom-select__trigger {
    border-color: var(--admin-primary, #203f42);
    outline: 3px solid rgba(32, 63, 66, 0.22);
    outline-offset: 1px;
    box-shadow: none;
    transform: none;
}

.admin-body .ijmbe-custom-select-menu {
    right: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-color: var(--admin-border-strong, #d0d5dd);
    border-radius: var(--admin-radius-sm, 8px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.admin-body .ijmbe-custom-select-option {
    min-height: 44px;
    padding: 11px 14px;
    font-size: 13px;
}

@media (max-width: 767.98px) {
    .ijmbe-custom-select__trigger {
        padding-right: 40px;
    }

    .ijmbe-custom-select-menu {
        border-radius: 14px;
    }

    .ijmbe-custom-select-options {
        max-height: 280px;
    }

    .ijmbe-custom-select-option,
    .admin-body .ijmbe-custom-select-option {
        min-height: 46px;
        padding: 12px 14px;
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ijmbe-custom-select__trigger,
    .ijmbe-custom-select__trigger::after {
        transition: none;
    }
}
