/* Search Overlay */
.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}

.search-overlay.is-active {
    display: flex;
}

.search-overlay-box {
    background: #fff;
    border-radius: 12px;
    width: 95%;
    max-width: 620px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    animation: search-fade-in 0.15s ease-out;
}

@keyframes search-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Input area */
.search-overlay-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    gap: 10px;
}

.search-overlay-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: #888;
}

.search-overlay-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    background: transparent;
    font-family: inherit;
    color: #333;
}

.search-overlay-input::placeholder {
    color: #aaa;
}

.search-overlay-kbd {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: #999;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: inherit;
}

/* Results area */
.search-overlay-results {
    overflow-y: auto;
    padding: 8px;
    flex: 1;
}

/* Zero state */
.search-zero-state {
    padding: 8px;
}

.search-zero-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 8px 8px;
}

.search-zero-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.search-zero-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.1s;
}

.search-zero-link:hover {
    background: #f2f4f7;
    color: #333;
    text-decoration: none;
}

.search-zero-emoji {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Result items */
.search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    gap: 10px;
    transition: background 0.1s;
    cursor: pointer;
}

.search-result-item:hover,
.search-result-item.is-selected {
    background: #f2f4f7;
    text-decoration: none;
    color: #333;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-desc {
    font-size: 0.82rem;
    color: #777;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Type badges */
.search-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 2px;
}

.search-badge--chord { background: #e8f0fe; color: #1a73e8; }
.search-badge--scale { background: #e6f4ea; color: #1e8e3e; }
.search-badge--lesson { background: #fef0e1; color: #e37400; }
.search-badge--tool { background: #f3e8fd; color: #8430ce; }
.search-badge--term { background: #f1f3f4; color: #5f6368; }

/* Direct match (chord/scale resolver) */
.search-direct-match {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 4px 0 8px;
    border-radius: 8px;
    background: #e8f0fe;
    text-decoration: none;
    color: #1a73e8;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.1s;
}

.search-direct-match:hover {
    background: #d2e3fc;
    text-decoration: none;
    color: #1a73e8;
}

.search-direct-arrow {
    margin-left: auto;
    font-size: 1.1rem;
}

/* Footer hint */
.search-overlay-footer {
    border-top: 1px solid #eee;
    padding: 8px 16px;
    display: flex;
    gap: 16px;
    font-size: 0.72rem;
    color: #999;
}

.search-overlay-footer kbd {
    font-size: 0.68rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1px 4px;
    font-family: inherit;
}

/* Loading state */
.search-loading {
    text-align: center;
    padding: 24px;
    color: #999;
    font-size: 0.9rem;
}

/* No results */
.search-no-results {
    text-align: center;
    padding: 24px;
    color: #999;
    font-size: 0.9rem;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .search-overlay {
        padding-top: 0;
        align-items: stretch;
    }

    .search-overlay-box {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        width: 100%;
    }

    .search-zero-links {
        grid-template-columns: 1fr;
    }

    .search-overlay-footer {
        display: none;
    }
}
