/**
 * Nookipedia · Spotlight Search (Cmd/Ctrl + K overlay)
 * Token-driven, calm glassmorphism. The header icon buttons and the full
 * results page (/suche) are styled by main.css / the page itself.
 */

/* ==========================================================================
   SPOTLIGHT OVERLAY
   ========================================================================== */
#spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 11vh 1rem 1rem;
    visibility: visible;
    opacity: 1;
    transition: opacity 0.28s ease, visibility 0.28s;
}

#spotlight-overlay.spotlight-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spotlight-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(40, 32, 20, 0.38);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1;
}

.spotlight-modal {
    position: relative;
    z-index: 2;
    background: var(--ac-surface);
    width: 100%;
    max-width: 640px;
    border-radius: var(--radius-lg);
    box-shadow: var(--ac-shadow-lg);
    border: 1px solid var(--ac-border);
    display: flex;
    flex-direction: column;
    max-height: 78vh;
    transform: scale(1) translateY(0);
    transition: transform 0.28s var(--ease-spring);
}

#spotlight-overlay.spotlight-hidden .spotlight-modal {
    transform: scale(0.96) translateY(-18px);
}

.spotlight-input-wrapper {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ac-border);
}

.spotlight-search-icon {
    font-size: 1.4rem;
    margin-right: 0.9rem;
    opacity: 0.7;
}

#spotlight-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ac-text);
    outline: none;
    padding: 0.45rem 0;
}

#spotlight-input::placeholder {
    color: var(--ac-text-muted);
    font-weight: 500;
    opacity: 0.7;
}

#spotlight-close {
    background: var(--ac-surface-2);
    color: var(--ac-text-muted);
    border: none;
    width: 34px; height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
#spotlight-close:hover,
#spotlight-close:focus-visible {
    background: var(--accent-soft);
    color: var(--accent-deep);
    outline: none;
}
#spotlight-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.spotlight-results {
    padding: 0.75rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.spotlight-results::-webkit-scrollbar { width: 8px; }
.spotlight-results::-webkit-scrollbar-track { background: transparent; }
.spotlight-results::-webkit-scrollbar-thumb { background: var(--ac-border-ink); border-radius: 10px; }

.spotlight-empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--ac-text-muted);
    font-size: 1.05rem;
    font-weight: 600;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--ac-text);
    transition: background 0.18s, transform 0.12s;
    border: 1px solid transparent;
    outline: none;
}

.search-result-item:hover, .search-result-item:focus {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.search-result-item:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.search-result-img {
    width: 48px;
    height: 48px;
    background: var(--ac-surface-2);
    border-radius: 50%;
    padding: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.search-result-img img {
    width: 100%; height: 100%;
    object-fit: contain;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.search-result-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 0.85rem;
    color: var(--ac-text-muted);
    font-weight: 600;
}

.search-result-badge {
    background: var(--ac-surface-2);
    color: var(--ac-text-muted);
    padding: 4px 11px;
    border-radius: 100px;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
    border: 1px solid var(--ac-border);
    flex-shrink: 0;
}
