/**
 * Finder Search Pro v1.6.0 — Frontend
 * v3.5.0 hybrid: Concept 3 (draggable centered modal) + Concept 5 (live
 * results with icons, active row green tint, meta tags) + keyboard nav.
 */

/* FLOATING LAUNCHER BUTTON
   v5.7.1 — Brand refresh. The previous old-identity green
   (linear-gradient #00a52e → #008626) has been replaced by the locked
   v5.6.8 rebrand palette: a solid teal core (#008194) ringed by a
   slowly rotating sage→teal conic gradient. The ring is a ::before
   pseudo-element masked into a thin band; the button itself never
   rotates, so the magnifier icon stays naturally upright and any
   JS-set positioning transform (used by center-left / center-right
   placements) is preserved. */
#deiso-finder-float-btn {
    position: fixed;
    z-index: 999998;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #008194;
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow:
        0 8px 24px rgba(0, 129, 148, 0.38),
        inset 0 0 0 2px rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    line-height: 1;
    padding: 0;
    isolation: isolate;
}
/* Rotating sage→teal conic ring. Uses the mask-composite trick to
   keep only the outer ring visible; the inner content area is masked
   out so the teal core shows through. z-index: -1 sits the ring
   behind the button background within the isolated stacking context. */
#deiso-finder-float-btn::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    padding: 4px;
    background: conic-gradient(from 0deg, #63976B, #2D8B8A, #008194, #63976B);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    z-index: -1;
    animation: deiso-finder-ring-spin 6s linear infinite;
    pointer-events: none;
}
@keyframes deiso-finder-ring-spin {
    to { transform: rotate(360deg); }
}
#deiso-finder-float-btn:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow:
        0 14px 34px rgba(0, 129, 148, 0.48),
        inset 0 0 0 2px rgba(255, 255, 255, 0.14);
}
#deiso-finder-float-btn:active { transform: translateY(0) scale(1); }

/* Respect users who prefer reduced motion — freeze the rotating ring. */
@media (prefers-reduced-motion: reduce) {
    #deiso-finder-float-btn::before {
        animation: none;
    }
}

/* BACKDROP */
.deiso-finder-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 41, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
.deiso-finder-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* MODAL — Concept 3 shell, centered on launch */
.deiso-finder-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    z-index: 1000000;
    width: 92%;
    max-width: 560px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #0a1929;
}
/* v3.5.21 — Batch 4 Item #3: ONLY font-family inherits to children.
   The previous merged block accidentally applied opacity:0 +
   pointer-events:none + box-shadow + overflow + transition to every
   descendant via the universal `*` selector, hiding all modal contents
   even when the modal was open. Now restricted to font-family. */
.deiso-finder-modal *,
.deiso-finder-modal *::before,
.deiso-finder-modal *::after {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}
.deiso-finder-modal.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
/* v3.5.21 — Defensive override: force children visible when modal is open.
   Guards against any future external CSS that might hide modal interior
   via inherited opacity or pointer-events on children. */
.deiso-finder-modal.is-open *,
.deiso-finder-modal.is-open *::before,
.deiso-finder-modal.is-open *::after {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* v3.7.7 — ID-based defensive override. Wins against any cached older
   version of THIS file (the pre-v3.5.21 buggy merged universal selector
   that applied opacity:0 to all descendants), and against any external
   CSS — theme, optimizer plugin, lazy-fade library — that tries to keep
   modal children invisible. Higher specificity than the class-based
   override above; uses visibility on top of opacity so even a
   visibility:hidden rule can't keep content hidden.

   v3.7.8 — REMOVED the bare `#deiso-finder-modal,` selector that was at
   the start of this list. It forced opacity:1 + visibility:visible +
   pointer-events:auto on the modal element WITHOUT requiring `.is-open`,
   which (a) made the modal appear by default on every page load and
   (b) prevented the close button and Escape key from hiding it (the
   JS still removed .is-open correctly but this CSS kept overriding).
   The override now correctly applies ONLY when .is-open is present. */
#deiso-finder-modal.is-open,
#deiso-finder-modal.is-open *,
#deiso-finder-modal.is-open *::before,
#deiso-finder-modal.is-open *::after {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}
.deiso-finder-modal.has-moved {
    transform: none;
}
.deiso-finder-modal.is-dragging {
    transition: none;
}

/* DRAG HEADER */
.deiso-finder-drag-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    background: linear-gradient(90deg, #0a1929 0%, #0f162a 100%);
    cursor: move;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    color: #ffffff;
}
.deiso-finder-drag-handle::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #00a52e 30%, #00a52e 70%, transparent 100%);
}
.deiso-finder-drag-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.deiso-finder-drag-dots {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}
.deiso-finder-drag-dots span {
    width: 12px;
    height: 1.5px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 1px;
    display: block;
}
.deiso-finder-modal-title {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 500;
    letter-spacing: 0.3px;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}
.deiso-finder-modal-title strong {
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
}
.deiso-finder-close {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
    border: none;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: all 0.15s ease;
}
.deiso-finder-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

/* BODY */
.deiso-finder-body {
    padding: 18px 18px 4px;
}
.deiso-finder-search-wrap {
    position: relative;
}
.deiso-finder-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #70909e;
    pointer-events: none;
    z-index: 2;
}
/* F4 (v3.5.3) + FND1 (v3.5.9) — Force padding-left to clear the
   icon. Professional font stack + proper hierarchy: search input
   larger than modal title for clear typographic rhythm. */
.deiso-finder-search-input {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e0e6ed;
    color: #0a1929;
    padding: 14px 14px 14px 44px !important;
    border-radius: 10px;
    font-size: 15px !important;
    outline: none;
    transition: all 0.18s ease;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    box-sizing: border-box;
    text-indent: 0 !important;
    letter-spacing: -0.1px;
}
.deiso-finder-search-input:focus {
    border-color: #00a52e;
    box-shadow: 0 0 0 3px rgba(0, 165, 46, 0.18);
}
.deiso-finder-search-input::placeholder {
    color: #94a3a8;
    font-weight: 400;
}

/* RESULTS — Concept 5 */
.deiso-finder-results {
    list-style: none;
    margin: 14px 0 0;
    /* v5.4.2 FINDER-FIX — last result was being clipped because max-height
       was a fixed 280px (about 5 rows). Switched to viewport-relative
       (min(60vh, 520px)) so up to ~9 rows fit on a normal screen, plus extra
       bottom padding so the final row never sits flush against the edge. */
    padding: 8px 8px 18px;
    max-height: min(60vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 1px solid #f0f4f7;
}
.deiso-finder-results:empty {
    display: none;
}
.deiso-finder-results::-webkit-scrollbar { width: 6px; }
.deiso-finder-results::-webkit-scrollbar-track { background: transparent; }
.deiso-finder-results::-webkit-scrollbar-thumb {
    background: rgba(0, 165, 46, 0.35);
    border-radius: 3px;
}
.deiso-finder-results::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 165, 46, 0.55);
}

.deiso-finder-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #0a1929;
    cursor: pointer;
    text-decoration: none;
    margin: 2px 0;
    transition: background 0.12s ease;
    list-style: none;
}
.deiso-finder-result:hover,
.deiso-finder-result.is-active {
    background: rgba(0, 165, 46, 0.07);
    color: #0a1929;
}
.deiso-finder-result-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(39, 93, 126, 0.08);
    color: #275d7e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}
.deiso-finder-result:hover .deiso-finder-result-icon,
.deiso-finder-result.is-active .deiso-finder-result-icon {
    background: rgba(0, 165, 46, 0.14);
    color: #008626;
}
.deiso-finder-result-text {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* X2 — matched-term highlight inside result titles.
   The ink is the module's existing hover colour (#008626, the same value
   already used by .deiso-finder-result:hover .deiso-finder-result-icon) and
   the tint reuses the existing hover green rgba(0, 165, 46, ...). No new
   colour values are introduced. Applies to a single word and to every
   matched token of a sentence, and to fuzzy matches, since the spans are
   supplied by the server. */
.deiso-finder-result .deiso-finder-hl {
    background: rgba(0, 165, 46, 0.14);
    color: #008626;
    font-weight: 700;
    padding: 0 2px;
    margin: 0 -1px;
    border-radius: 3px;
    text-decoration: none;
}
/* Keep the highlight legible while the row is hovered or keyboard-active:
   the row tint deepens, so the highlight tint deepens with it. */
.deiso-finder-result:hover .deiso-finder-hl,
.deiso-finder-result.is-active .deiso-finder-hl {
    background: rgba(0, 165, 46, 0.22);
    color: #008626;
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-result .deiso-finder-hl {
    background: rgba(0, 165, 46, 0.22);
    color: #00a52e;
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-result:hover .deiso-finder-hl,
.deiso-finder-modal.deiso-finder-dark .deiso-finder-result.is-active .deiso-finder-hl {
    background: rgba(0, 165, 46, 0.32);
    color: #00a52e;
}

.deiso-finder-result-meta {
    font-size: 10px;
    color: #94a3a8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.deiso-finder-empty {
    padding: 18px 14px;
    text-align: center;
    color: #94a3a8;
    font-size: 12.5px;
    font-style: italic;
}
.deiso-finder-loading {
    padding: 18px 14px;
    text-align: center;
    color: #6b7c8a;
    font-size: 12.5px;
}

/* FOOTER hints */
/* X7 — the footer keeps its original flex/space-between layout untouched,
   so it renders correctly whether the markup has two children (a browser
   still running a cached older finder.js) or three (current finder.js).
   Switching this to a fixed three-column grid would have left ESC sitting
   in the middle column for anyone on a stale script. The count is centred
   by taking it out of flow instead, which the two-child layout never sees. */
.deiso-finder-foot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px 14px;
    border-top: 1px solid #f0f4f7;
    font-size: 10.5px;
    color: #6b7c8a;
    background: #fafbfc;
}
.deiso-finder-foot-left {
    display: flex;
    gap: 14px;
}
.deiso-finder-foot-key {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.deiso-finder-foot-count {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.deiso-finder-foot-count b {
    color: #008626;
    font-weight: 600;
}
.deiso-finder-foot-count.is-empty {
    color: #94a3a8;
}
.deiso-finder-kbd {
    background: #ffffff;
    border: 1px solid #d6dde3;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 10px;
    color: #0a1929;
    font-weight: 600;
    box-shadow: 0 1px 0 rgba(10, 25, 41, 0.04);
}

/* Very narrow screens cannot fit all three footer groups on one line, so
   the count steps aside rather than colliding with the key hints. */
@media (max-width: 430px) {
    .deiso-finder-foot-count {
        display: none;
    }
}

/* MOBILE — full-screen, drag disabled */
/* X1 (v9.0.0) — the result list could not be scrolled on a phone once the
   Max Results ceiling was raised above roughly ten rows.

   Root cause: the results <ul> is emitted INSIDE .deiso-finder-body (see
   the modal template in finder-*.js), so it is a grandchild of the modal,
   not a direct flex child of it. The previous rules here applied
   `flex: 1` to .deiso-finder-results as if it were a direct child — that
   declaration was inert, because its actual parent (.deiso-finder-body)
   was a plain block container. At the same time `max-height: none`
   removed the only height constraint the list had (the desktop
   `min(60vh, 520px)`), and `.deiso-finder-body { flex-shrink: 0 }` pinned
   the body at its full content height. The list therefore grew past the
   modal's own height, .deiso-finder-modal's `overflow: hidden` clipped
   it, the footer was pushed off the bottom of the screen, and every row
   below the fold became unreachable — no inner scroll existed, and the
   modal is position:fixed so the page could not scroll to them either.

   Fix: make .deiso-finder-body a real flex column that takes the space
   between the header and the footer, give the list `min-height: 0` so a
   flex item is actually allowed to shrink below its content height (the
   default `min-height: auto` is what prevents the scroll container from
   ever forming), and hold the header, search field and footer at their
   natural size. Height is additionally expressed in dvh so the mobile
   browser's address bar is accounted for and the final row is never left
   underneath it. Desktop is untouched — everything below stays inside
   this max-width: 720px block. */
@media (max-width: 720px) {
    .deiso-finder-modal {
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    .deiso-finder-modal.is-open {
        transform: none !important;
    }
    .deiso-finder-drag-handle {
        cursor: default;
        flex: 0 0 auto;
    }
    .deiso-finder-drag-dots {
        display: none;
    }
    /* Takes all remaining height and becomes the column that the search
       field and the scrolling list share. min-height: 0 is required — a
       flex item defaults to min-height: auto, which refuses to shrink
       below its content and is exactly what defeated the scroll before. */
    .deiso-finder-body {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }
    .deiso-finder-search-wrap {
        flex: 0 0 auto;
    }
    .deiso-finder-results {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .deiso-finder-foot {
        flex: 0 0 auto;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }
    #deiso-finder-float-btn {
        width: 48px;
        height: 48px;
    }
}

/* DARK MODE OPTION */
.deiso-finder-modal.deiso-finder-dark {
    background: #0f162a;
    color: #ffffff;
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-search-input {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-results {
    border-color: rgba(255, 255, 255, 0.08);
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-result {
    color: #ffffff;
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-result:hover,
.deiso-finder-modal.deiso-finder-dark .deiso-finder-result.is-active {
    background: rgba(0, 165, 46, 0.18);
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-foot {
    background: #0a1929;
    color: rgba(255, 255, 255, 0.55);
    border-color: rgba(255, 255, 255, 0.08);
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-kbd {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}
.deiso-finder-modal.deiso-finder-dark .deiso-finder-foot-count b {
    color: #00a52e;
}

/* LEGACY BAR — hidden, kept for back-compat */
#deiso-finder-bar { display: none !important; }
