/* =========================================================
   Elimys global header search bar (desktop + mobile)
   - Keeps all element IDs/classes used by IndexScripts.js
   - Pill shaped, prepended icon, soft focus ring, clean
     clear (×) button, themed submit button.
   ========================================================= */

:root {
    --elimys-search-radius: 999px;
    --elimys-search-border: #c9d2dc;
    --elimys-search-border-hover: #3A648A; /* lighter brand */
    --elimys-search-focus: #3A648A; /* lighter #3A648A */
    --elimys-search-focus-ring: rgba(91, 134, 176, 0.20);
    --elimys-search-bg: #ffffff;
    --elimys-search-bg-focus: #ffffff;
    --elimys-search-text: #1f2937;
    --elimys-search-placeholder: #6b7280;
    --elimys-search-icon: #4b5563;
}

/* ---------- Shared wrapper ---------- */
.elimys-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background-color: var(--elimys-search-bg);
    border: 1.5px solid var(--elimys-search-border);   /* thicker, more defined */
    border-radius: var(--elimys-search-radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);      /* subtle lift */
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.elimys-search:hover {
    border-color: var(--elimys-search-border-hover);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.elimys-search.is-focused,
.elimys-search:focus-within {
    background-color: var(--elimys-search-bg-focus);
    border-color: var(--elimys-search-focus);
    box-shadow: 0 0 0 4px var(--elimys-search-focus-ring),
                0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Leading search icon */
.elimys-search__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--elimys-search-icon);
    pointer-events: none;
    flex-shrink: 0;
}

.elimys-search__icon i {
    font-size: 0.95rem;
}

/* Input itself (overrides Bootstrap .form-control inside the pill) */
.elimys-search__input.form-control {
    flex: 1 1 auto;
    height: 44px;
    min-width: 0;
    padding: 0 8px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--elimys-search-text);
    font-size: 0.95rem;
    line-height: 1.4;
}

.elimys-search__input.form-control:focus {
    outline: none;
    box-shadow: none;
    background: transparent;
    color: var(--elimys-search-text);
}

.elimys-search__input::placeholder {
    color: var(--elimys-search-placeholder);
    opacity: 1;
}

/* Hide native search clear (we provide our own) */
.elimys-search__input::-webkit-search-decoration,
.elimys-search__input::-webkit-search-cancel-button,
.elimys-search__input::-webkit-search-results-button,
.elimys-search__input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
}

/* Clear (×) button */
.elimys-search__clear {
    display: none; /* JS toggles via .show()/.hide() */
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--elimys-search-icon);
    border-radius: 50%;
    transition: background-color .15s ease, color .15s ease;
    cursor: pointer;
}

.elimys-search__clear:hover,
.elimys-search__clear:focus {
    background-color: #eef1f4;
    color: #1f2937;
    outline: none;
}

/* Submit button on the trailing edge */
.elimys-search__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 3px 4px 3px 2px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--elimys-search-focus);     /* lighter brand */
    color: #fff;
    transition: background-color .15s ease, transform .1s ease, box-shadow .15s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.elimys-search__submit:hover {
    background-color: #3A648A;                        /* deepen on hover */
    box-shadow: 0 4px 10px rgba(58, 100, 138, 0.30);
}

.elimys-search__submit:active {
    transform: scale(0.96);
}

.elimys-search__submit:focus {
    outline: none;
    box-shadow: 0 0 0 4px var(--elimys-search-focus-ring);
}

.elimys-search__submit i {
    font-size: 0.9rem;
}

/* ---------- Desktop sizing ---------- */
.elimys-search--desktop {
    max-width: 560px;
    margin: 0 auto;
}

/* ---------- Mobile sizing ---------- */
.elimys-search--mobile {
    height: 44px;
}

.elimys-search--mobile .elimys-search__icon,
.elimys-search--mobile .elimys-search__submit {
    width: 40px;
    height: 40px;
}

.elimys-search--mobile .elimys-search__submit {
    margin: 2px 3px 2px 2px;
}

/* ---------- Autocomplete dropdown polish (jQuery UI) ---------- */
.ui-autocomplete {
    border: 1px solid var(--elimys-search-border) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12) !important;
    padding: 6px !important;
    background: #fff !important;
    z-index: 2000 !important;
    max-height: 360px;
    overflow-y: auto;
}

.ui-autocomplete .ui-menu-item {
    list-style: none;
}

.ui-autocomplete .ui-menu-item-wrapper,
.ui-autocomplete .ui-menu-item > div {
    padding: 8px 10px !important;
    border-radius: 8px !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--elimys-search-text) !important;
    cursor: pointer;
}

.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-autocomplete .ui-menu-item > div.ui-state-active,
.ui-autocomplete .ui-menu-item:hover > div {
    background-color: #f1f5f9 !important;
    color: var(--elimys-search-focus) !important;
}

.autocomplete-item {
    display: flex;
    flex-direction: column;
}

.autocomplete-item .course-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--elimys-search-text);
}

.autocomplete-item .category-subcategory {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 2px;
}