/* ===========================================================
   Global portal search: navbar button, overlay + results page
   =========================================================== */

/* --- Navbar search button (matches the existing .nav-icon-btn look) --- */
.nav-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: var(--muted-foreground, #6b7280);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-search-btn:hover {
    color: var(--primary, #2563eb);
    background: var(--accent, rgba(0, 0, 0, 0.05));
}

.nav-search-btn svg {
    width: 18px;
    height: 18px;
}

.nav-search-btn--mobile {
    margin-right: 2px;
}

/* --- Search overlay --- */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001; /* above the fixed navbar (z-index: 9999) */
    display: none;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    padding: 12vh 16px 16px;
}

.search-overlay.open {
    display: block;
}

body.search-open {
    overflow: hidden;
}

.search-overlay__panel {
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    animation: searchPop 0.15s ease-out;
}

@keyframes searchPop {
    from { transform: translateY(-8px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.search-overlay__form {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #eef0f3;
}

.search-overlay__icon {
    display: inline-flex;
    color: #6b7280;
    flex: 0 0 auto;
}

.search-overlay__form input {
    flex: 1 1 auto;
    border: none;
    outline: none;
    font-size: 18px;
    background: transparent;
    color: #111827;
}

.search-overlay__close {
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 4px;
}

.search-overlay__close:hover { color: #374151; }

.search-overlay__results {
    max-height: 60vh;
    overflow-y: auto;
}

.search-overlay__loading,
.search-overlay__empty {
    padding: 20px 22px;
    color: #6b7280;
    font-size: 14px;
}

.search-overlay__list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.search-overlay__item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 14px;
}

.search-overlay__item-main {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 22px;
    text-decoration: none;
    color: #111827;
    transition: background-color 0.15s ease;
}

.search-overlay__item-main:hover {
    background: #f5f7fa;
}

.search-overlay__item-dl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #2563eb;
    color: #2563eb;
    background: #fff;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.search-overlay__item-dl:hover {
    background: #2563eb;
    color: #fff;
}

.search-overlay__item-type {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2563eb;
    margin-bottom: 2px;
}

.search-overlay__item-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.search-overlay__item-snippet {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-overlay__all {
    display: block;
    text-align: center;
    padding: 12px;
    font-weight: 600;
    font-size: 14px;
    color: #2563eb;
    text-decoration: none;
    border-top: 1px solid #eef0f3;
}

.search-overlay__all:hover { background: #f5f7fa; }

/* --- Full results page --- */
.search-page {
    padding-top: 32px;
    padding-bottom: 64px;
}

.search-page__title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 18px;
}

.search-page__form {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 640px;
    border: 1px solid #d7dbe0;
    border-radius: 12px;
    padding: 8px 14px;
    margin-bottom: 26px;
}

.search-page__icon { display: inline-flex; color: #6b7280; }

.search-page__form input {
    flex: 1 1 auto;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
}

.search-page__submit {
    border: none;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
}

.search-page__submit:hover { background: #1d4ed8; }

.search-page__hint,
.search-page__empty,
.search-page__count {
    color: #6b7280;
    margin-bottom: 20px;
}

.search-group { margin-bottom: 30px; }

.search-group__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-group__badge {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    background: #eff4ff;
    border-radius: 999px;
    padding: 2px 9px;
}

.search-results { list-style: none; margin: 0; padding: 0; }

.search-result { border-bottom: 1px solid #eef0f3; }

.search-result__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.search-result__link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 6px;
    text-decoration: none;
    color: #111827;
    flex: 1 1 auto;
    min-width: 0;
}

.search-result__link:hover { background: #f8fafc; }

.search-result__download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px solid #2563eb;
    border-radius: 8px;
    color: #2563eb;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.search-result__download:hover {
    background: #2563eb;
    color: #fff;
}

.search-result__download svg { width: 16px; height: 16px; }

.search-result__icon {
    display: inline-flex;
    color: #2563eb;
    flex: 0 0 auto;
    margin-top: 2px;
}

.search-result__title { display: block; font-size: 16px; font-weight: 600; }

.search-result__snippet {
    display: block;
    font-size: 14px;
    color: #6b7280;
    margin-top: 3px;
}
