/* ── Search Engine — Modal Styles ───────────────────────────────────────── */

/* Button injected into the WPLMS .topmenu (right-side header column).
   Matches the visual style of the LOGIN / Cart icons already there. */
.lse-topmenu-li {
    display: flex !important;
    align-items: center;
    position: relative;
    z-index: 9999;
}
.lse-topmenu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer !important;
    padding: 4px 6px;
    color: inherit;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.15s;
    position: relative;
    z-index: 9999;
    pointer-events: all !important;
}
.lse-topmenu-btn:hover { opacity: 1; }

/* Legacy nav button (kept for >=992px desktop nav, if injected via PHP) */
.lse-nav-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    color: inherit;
    line-height: 1;
    border-radius: 6px;
    transition: opacity 0.15s;
}
.lse-nav-search-btn:hover { opacity: 0.75; }

/* ── Ensure cart & topmenu items are always visible ───────────────────── */
header ul.topmenu,
header ul.topmenu > li {
    display: flex !important;
    align-items: center;
}
header ul.topmenu > li {
    flex-shrink: 0;
}
/* WooCommerce mini-cart link */
header a.vbpcart {
    display: flex !important;
    align-items: center;
}

/* ── Overlay ──────────────────────────────────────────────────────────── */
.lse-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: clamp(48px, 10vh, 120px);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}
.lse-overlay:not([hidden]) {
    opacity: 1;
    pointer-events: all;
}
/* hidden attr override — let transition run */
.lse-overlay[hidden] {
    display: flex !important;
    opacity: 0;
    pointer-events: none;
}

/* ── Modal box ────────────────────────────────────────────────────────── */
.lse-modal {
    width: min(640px, calc(100vw - 32px));
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(-12px) scale(0.98);
    transition: transform 0.2s ease;
    max-height: calc(100vh - 120px);
}
.lse-overlay:not([hidden]) .lse-modal {
    transform: translateY(0) scale(1);
}

/* ── Input row ────────────────────────────────────────────────────────── */
.lse-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.lse-input-icon {
    flex-shrink: 0;
    color: #888;
}
.lse-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 17px;
    font-family: inherit;
    color: #111;
    background: transparent;
    line-height: 1.4;
    caret-color: #007aff;
}
.lse-input::placeholder { color: #aaa; }
.lse-input::-webkit-search-cancel-button { display: none; }
.lse-kbd-esc {
    font-family: system-ui, sans-serif;
    font-size: 11px;
    color: #888;
    background: #f0f0f0;
    border-radius: 5px;
    padding: 2px 6px;
    border: 1px solid #ddd;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Results area ─────────────────────────────────────────────────────── */
.lse-results {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
    min-height: 60px;
}

/* Section header */
.lse-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #999;
    padding: 10px 18px 4px;
}

/* Single result row */
.lse-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 18px;
    cursor: pointer;
    border-radius: 8px;
    margin: 0 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}
.lse-result-item:hover,
.lse-result-item[aria-selected="true"] {
    background: #f5f5f5;
}
.lse-result-item.lse-result--active {
    background: #eef3ff;
}

/* Icon box */
.lse-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #555;
}

.lse-result-text {
    flex: 1;
    min-width: 0;
}
.lse-result-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111;
}
.lse-result-type {
    font-size: 12px;
    color: #888;
    margin-top: 1px;
}

/* Recent / Popular tag chips */
.lse-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 18px 12px;
}
.lse-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #444;
    background: #f4f4f4;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}
.lse-chip:hover { background: #eaeaea; }

/* Empty / spinner states */
.lse-state-msg {
    text-align: center;
    padding: 28px 18px;
    color: #999;
    font-size: 14px;
}
.lse-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-top-color: #555;
    border-radius: 50%;
    animation: lse-spin 0.6s linear infinite;
    margin: 20px auto;
}
@keyframes lse-spin { to { transform: rotate(360deg); } }

/* ── Footer ───────────────────────────────────────────────────────────── */
.lse-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
.lse-footer-hint {
    font-size: 11px;
    color: #bbb;
}
.lse-footer-hint kbd {
    font-family: inherit;
    background: #f4f4f4;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11px;
    color: #888;
}
.lse-footer-brand {
    font-size: 11px;
    color: #ccc;
    font-weight: 500;
}

/* ── Fallback floating button (shown when nav injection fails) ─────────── */
.lse-fab-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.28);
    transition: transform 0.15s, box-shadow 0.15s;
}
.lse-fab-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,0.36);
}
@media (prefers-color-scheme: dark) {
    .lse-fab-btn { background: #f5f5f5; color: #111; }
}

/* ── Dark-mode support ────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    .lse-modal           { background: #1c1c1e; color: #f5f5f5; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
    .lse-input-wrap,
    .lse-footer          { border-color: #2c2c2e; }
    .lse-input           { color: #f5f5f5; }
    .lse-input::placeholder { color: #666; }
    .lse-result-item:hover,
    .lse-result-item[aria-selected="true"] { background: #2c2c2e; }
    .lse-result-icon     { background: #2c2c2e; color: #aaa; }
    .lse-result-title    { color: #f5f5f5; }
    .lse-chip            { background: #2c2c2e; border-color: #3a3a3c; color: #ccc; }
    .lse-chip:hover      { background: #3a3a3c; }
    .lse-kbd-esc         { background: #2c2c2e; border-color: #3a3a3c; color: #888; }
    .lse-footer-hint kbd { background: #2c2c2e; border-color: #3a3a3c; }
}
