.autosuggest-dropdown {
    position: absolute;
    right: 0;
    width: 360px;
    max-width: 30vw;
    left: -50px !important;
    background: #fff;
    border: 1px solid #e6edf6;
    border-radius: 16px;
    list-style: none;
    margin: 0;
    padding: 8px 0;
    z-index: 1000;
    max-height: 380px;
    overflow-y: auto;
    box-shadow: 0 16px 40px rgba(13, 32, 55, 0.16);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .12s ease, transform .12s ease;
}

.autosuggest-dropdown:not(:empty) {
    opacity: 1;
    transform: translateY(0);
}

.autosuggest-group-label {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8397ad;
}

.autosuggest-group {
    list-style: none;
    margin: 0;
    padding: 0;
}

.autosuggest-row {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    cursor: pointer;
    transition: background-color .12s ease;
}

.autosuggest-row:hover,
.autosuggest-row.is-active {
    background-color: #f0f7ff;
}

.autosuggest-media {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    overflow: hidden;
    background: #f0f4f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.autosuggest-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.autosuggest-icon {
    color: #0d5eaf;
    font-size: 16px;
}

.autosuggest-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.autosuggest-title {
    color: #17324d;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autosuggest-title strong {
    color: #0d5eaf;
    font-weight: 800;
}

.autosuggest-subtitle {
    color: #8397ad;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autosuggest-loading,
.autosuggest-empty {
    padding: 14px 16px;
    color: #8397ad;
    text-align: center;
}

.autosuggest-dropdown.is-loading .autosuggest-loading {
    animation: autosuggest-pulse 1s ease-in-out infinite;
}

@keyframes autosuggest-pulse {

    0%,
    100% {
        opacity: .4;
    }

    50% {
        opacity: 1;
    }
}

/* ------------------------------------------------------------------ */
/* Global search results page (/search/index.php) - same visual       */
/* language as the header autosuggest dropdown above.                 */
/* Everything below is scoped to #page-search-index so it cannot      */
/* affect any other page.                                             */
/* ------------------------------------------------------------------ */

#page-search-index h1 {
    color: #17324d;
    font-weight: 800;
}

#page-search-index .collapsible-actions {
    margin-bottom: 12px;
}

#page-search-index .collapsible-actions a {
    color: #0d5eaf;
    font-weight: 700;
    text-decoration: none;
}

#page-search-index .fheader {
    background: #f0f7ff;
    border: 1px solid #e6edf6;
    border-radius: 14px;
    padding: 12px 18px;
    margin-bottom: 4px;
    font-weight: 700;
    color: #17324d;
}

#page-search-index fieldset.collapsible {
    border: 1px solid #e6edf6;
    border-top: none;
    border-radius: 0 0 14px 14px;
    padding: 16px 18px;
    margin-bottom: 18px;
    background: #fff;
}

#page-search-index input[type="text"],
#page-search-index select {
    border: 1px solid #e6edf6;
    border-radius: 10px;
    padding: 8px 12px;
}

#page-search-index .btn-primary {
    background-color: #0d5eaf;
    border-color: #0d5eaf;
    border-radius: 12px;
    font-weight: 700;
    padding: 10px 22px;
}

#page-search-index .btn-primary:hover {
    background-color: #094a8a;
    border-color: #094a8a;
}

#page-search-index .search-results-count {
    font-size: 15px;
    font-weight: 700;
    color: #17324d;
    margin: 18px 0 14px;
}

/* Neutralise Moodle's own boxed panels (e.g. around "Top results") so every
   section reads as one continuous flow instead of nested grey boxes. */
#page-search-index .card,
#page-search-index .box,
#page-search-index .generalbox,
#page-search-index .collapsible-region,
#page-search-index .bg-light {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#page-search-index h2 {
    font-size: 18px;
    margin: 28px 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e6edf6;
}

/* Category tabs (All / Course content / Courses). */
#page-search-index #core-search-areas {
    margin: 20px 0 18px;
    border-bottom: 2px solid #e6edf6;
    background: transparent;
    padding: 0;
}

#page-search-index #core-search-areas .nav-link,
#page-search-index #core-search-areas a {
    color: #5b6b80;
    font-weight: 600;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 8px 16px 10px;
    background: transparent !important;
}

#page-search-index #core-search-areas .nav-link.active,
#page-search-index #core-search-areas .active a,
#page-search-index #core-search-areas li.active a {
    color: #0d5eaf;
    border-bottom-color: #0d5eaf;
}

/* Pagination - lighter, consistent whether it appears above or below the list. */
#page-search-index .pagination {
    margin: 18px 0;
    justify-content: center;
}

#page-search-index .pagination .page-item .page-link {
    border: none;
    border-radius: 999px;
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 3px;
    padding: 0;
    color: #5b6b80;
    background: transparent;
    font-weight: 600;
}

#page-search-index .pagination .page-item.active .page-link {
    background-color: #0d5eaf;
    color: #fff;
}

#page-search-index .pagination .page-item:not(.active) .page-link:hover {
    background-color: #f0f4f9;
}

#page-search-index .alert {
    border: 1px solid #e6edf6;
    border-radius: 14px;
    padding: 22px 20px;
    text-align: center;
    font-weight: 600;
    color: #17324d;
    background-color: #f7fafd;
}

#page-search-index h2,
#page-search-index h3 {
    color: #17324d;
    font-weight: 800;
}

#page-search-index .search-results {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#page-search-index .search-results hr {
    display: none;
}

#page-search-index .result {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: #fff;
    border: 1px solid #e6edf6;
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 6px 18px rgba(13, 32, 55, .05);
    transition: box-shadow .12s ease, border-color .12s ease;
}

#page-search-index .result:hover {
    border-color: #0d5eaf;
    box-shadow: 0 10px 26px rgba(13, 32, 55, .09);
}

#page-search-index .result-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f0f4f9;
    color: #0d5eaf;
    font-size: 15px;
}

#page-search-index .result-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

#page-search-index .result-body {
    min-width: 0;
    flex: 1 1 auto;
}

#page-search-index .result-title {
    font-size: 16px;
    font-weight: 700;
    color: #17324d;
}

#page-search-index .result-title a {
    color: inherit;
    text-decoration: none;
}

#page-search-index .result-title a:hover {
    color: #0d5eaf;
    text-decoration: underline;
}

#page-search-index .result-content {
    margin: 8px 0 0 !important;
    font-size: 13px;
    color: #5b6b80;
}

#page-search-index .result-context-info {
    margin: 12px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
}

#page-search-index .result-context-chip {
    display: inline-block;
    color: #5b6b80;
    background: #f0f4f9;
    border-radius: 999px;
    padding: 4px 12px;
    text-decoration: none;
}

#page-search-index .result-context-chip:hover {
    background: #0d5eaf;
    color: #fff;
    text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* Our own results page (local/autosuggest/results.php).               */
/* Scoped to .autosuggest-results-page - a wrapper div we render       */
/* ourselves, so this can never collide with any Moodle core markup.  */
/* ------------------------------------------------------------------ */

.autosuggest-results-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 10px 40px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f9ff;
}

.autosuggest-results-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.autosuggest-results-input {
    flex: 1 1 auto;
    border: 1px solid #e6edf6;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
}

.autosuggest-results-input:focus {
    outline: none;
    border-color: #0d5eaf;
}

.autosuggest-results-submit {
    background-color: #0d5eaf;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0 24px;
    font-weight: 700;
}

.autosuggest-results-submit:hover {
    background-color: #094a8a;
}

.autosuggest-results-heading {
    color: #17324d;
    font-weight: 800;
    font-size: 26px;
    margin: 0 0 6px;
}

.autosuggest-results-count {
    color: #8397ad;
    font-size: 14px;
    margin-bottom: 24px;
}

.autosuggest-results-empty {
    background: #f7fafd;
    border: 1px solid #e6edf6;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    color: #17324d;
    font-weight: 600;
}

.autosuggest-results-group-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8397ad;
    margin: 24px 0 10px;
}

.autosuggest-results-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.autosuggest-results-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #e6edf6;
    border-radius: 16px;
    padding: 14px 18px;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(13, 32, 55, .05);
    transition: box-shadow .12s ease, border-color .12s ease;
}

.autosuggest-results-row:hover {
    border-color: #0d5eaf;
    box-shadow: 0 10px 26px rgba(13, 32, 55, .09);
    text-decoration: none;
}

.autosuggest-results-media {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    background: #f0f4f9;
    color: #0d5eaf;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.autosuggest-results-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.autosuggest-results-text {
    min-width: 0;
}

.autosuggest-results-title {
    color: #17324d;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autosuggest-results-subtitle {
    color: #8397ad;
    font-size: 13px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autosuggest-results-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 32px;
}

.autosuggest-results-pagerlink {
    color: #0d5eaf;
    font-weight: 700;
    text-decoration: none;
}

.autosuggest-results-pagerlink:hover {
    text-decoration: underline;
}

.autosuggest-results-pagerinfo {
    color: #8397ad;
    font-size: 13px;
}

@media (max-width: 600px) {
    .autosuggest-results-form {
        flex-direction: column;
    }
}

#page-local-autosuggest-results, #page-local-autosuggest-results .main-content{
    background: #f5f9ff !important;
}