/* Search in the academy (search.js): a bar in the middle of the header, and
   what it finds in a panel under it. The panel takes What's new's look
   (whats-new.css: .wn-panel); this is what is its own. */

/* ── The bar ─────────────────────────────────────────────────────────── */
.fs-bar {
    position: relative;
    flex: 0 1 440px;
    min-width: 0;
    height: 2.6rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.45rem 0 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.fs-bar[hidden] { display: none; }
.fs-bar:hover { background: #fff; border-color: var(--border-strong, #c9cfcc); }
.fs-bar:focus-within {
    background: #fff;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(47, 122, 229, 0.14);
}
.fs-bar-icon { flex: none; font-size: 1.15rem; color: var(--text-muted); }
.fs-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--text-main);
    font: 400 0.95rem/1.2 var(--font-sans);
    text-overflow: ellipsis;
    outline: none;
}
.fs-input::placeholder { color: var(--text-soft, #7d8782); opacity: 1; }
/* The bar has Esc and Cancel; a native × as well reads as one too many. */
.fs-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.fs-key {
    flex: none;
    min-width: 1.5rem;
    padding: 0.18rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font: 600 0.75rem/1 var(--font-sans);
    text-align: center;
}
.fs-bar:focus-within .fs-key { visibility: hidden; }
.fs-cancel {
    display: none;
    flex: none;
    padding: 0.4rem 0.55rem;
    border: 0;
    background: transparent;
    color: var(--accent-blue);
    font: 600 0.92rem/1 var(--font-sans);
    cursor: pointer;
}
/* No "/" key on a touch screen. */
@media (hover: none), (max-width: 900px) { .fs-key { display: none; } }

/* ── The results ─────────────────────────────────────────────────────── */
.fs-panel { width: 540px; }

.fs-count {
    margin: 0;
    padding: 0.75rem 1.1rem 0.1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.fs-count:empty { display: none; }

.fs-results {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0.45rem 0.6rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.fs-item {
    width: 100%;
    display: grid;
    grid-template-columns: 2.25rem 1fr auto;
    gap: 0.75rem;
    align-items: start;
    padding: 0.7rem 0.65rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.fs-item--term { grid-template-columns: 2.25rem 1fr; cursor: default; }
button.fs-item:hover,
.fs-item.is-active { background: rgba(35, 77, 111, 0.07); }
button.fs-item:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: -2px; }
.fs-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--bg-alt);
    color: var(--accent-blue);
    font-size: 1.1rem;
}
.fs-body { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; }
.fs-kind { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.01em; color: var(--text-muted); }
.fs-title { font-size: 0.98rem; font-weight: 600; line-height: 1.3; color: var(--text-main); }
.fs-line {
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.fs-item--term .fs-line { -webkit-line-clamp: unset; display: block; }
.fs-results mark { background: rgba(199, 154, 82, 0.28); color: inherit; border-radius: 3px; padding: 0 1px; }
.fs-go { align-self: center; font-size: 0.9rem; color: var(--text-muted); opacity: 0; transition: opacity 0.15s ease; }
button.fs-item:hover .fs-go,
.fs-item.is-active .fs-go { opacity: 1; color: var(--accent-blue); }

.fs-empty, .fs-none { padding: 0.9rem 0.7rem 0.5rem; font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }
.fs-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.fs-empty > span { margin-right: 0.15rem; }
.fs-suggest {
    padding: 0.32rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: transparent;
    color: var(--text-main);
    font: 500 0.84rem/1 var(--font-sans);
    cursor: pointer;
}
.fs-suggest:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

/* ── Phones ──────────────────────────────────────────────────────────────
   The bar fills the space between the logo and the buttons. In use, it
   spreads over the whole header with a Cancel, and the results fill the
   screen under it. */
@media (max-width: 600px) {
    .fs-bar { flex: 1 1 auto; height: 2.45rem; padding-left: 0.75rem; margin: 0; }
    .fs-bar-icon { font-size: 1.05rem; }
    .fs-input { font-size: 16px; }          /* 16px: iPhone does not zoom in */
    .fs-bar.is-open {
        position: absolute;
        left: 12px;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 3;
    }
    .fs-bar.is-open .fs-cancel { display: block; }
    body.fs-open .site-header .dashboard-brand-group,
    body.fs-open .site-header .dash-header-right { visibility: hidden; }
    .fs-panel {
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-height: none;
        border-width: 1px 0 0;
        border-radius: 0;
        box-shadow: none;
        animation: none;
    }
}

/* ── Dark ────────────────────────────────────────────────────────────── */
.dark .fs-bar { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.16); }
.dark .fs-bar:hover { background: rgba(255, 255, 255, 0.1); }
.dark .fs-bar:focus-within { background: #111827; border-color: #93b8d8; box-shadow: 0 0 0 3px rgba(147, 184, 216, 0.18); }
.dark .fs-bar-icon, .dark .fs-key { color: #a7b0bd; }
.dark .fs-key { border-color: #4b5563; }
.dark .fs-input { color: #f9fafb; }
.dark .fs-input::placeholder { color: #8b95a3; }
.dark .fs-cancel { color: #93b8d8; }
.dark .fs-title { color: #f9fafb; }
.dark .fs-line, .dark .fs-kind, .dark .fs-count, .dark .fs-empty, .dark .fs-none { color: #a7b0bd; }
.dark .fs-icon { background: #111827; color: #93b8d8; }
.dark button.fs-item:hover, .dark .fs-item.is-active { background: rgba(255, 255, 255, 0.06); }
.dark .fs-results mark { background: rgba(217, 164, 65, 0.3); }
.dark .fs-suggest { border-color: #4b5563; color: #f9fafb; }
.dark .fs-suggest:hover { border-color: #93b8d8; color: #93b8d8; }
.dark .fs-go { color: #93b8d8; }

/* The card a search result leads to, on the Learn tab (FBALessons.show). */
.mini-lesson-card.is-found { box-shadow: 0 0 0 3px rgba(47, 122, 229, 0.45); transition: box-shadow 0.3s ease; }
