/* ==================== SEARCH OVERLAY ==================== */
.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 680px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: translateY(-10px) scale(0.98);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.search-overlay.active .search-modal {
    transform: translateY(0) scale(1);
}

/* ==================== SEARCH INPUT ==================== */
.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.search-input-wrap i {
    font-size: 1.15rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.05rem;
    font-family: inherit;
    color: var(--text);
    font-weight: 450;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.search-shortcut {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.search-shortcut kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ==================== SEARCH RESULTS ==================== */
.search-results {
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.08) transparent;
}

.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }

.search-empty {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.search-empty i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
    display: block;
}

.search-empty p {
    font-size: 0.95rem;
    margin: 0;
}

.search-group-title {
    padding: 10px 20px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg);
    border-top: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1;
}

.search-group-title:first-child {
    border-top: none;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover,
.search-result-item.selected {
    background: var(--bg-secondary);
}

.search-result-item.selected {
    background: var(--accent-glow);
}

.search-result-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.search-result-icon.page-instruction {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.search-result-icon.page-algorithms {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.search-result-icon.page-techdocs {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.search-result-icon.page-integration {
    background: rgba(245, 184, 27, 0.1);
    color: #f5b81b;
}

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

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title mark {
    background: rgba(245, 184, 27, 0.3);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.search-result-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.search-result-page {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.search-result-page.page-instruction {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.search-result-page.page-algorithms {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.search-result-page.page-techdocs {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.search-result-page.page-integration {
    background: rgba(245, 184, 27, 0.1);
    color: #f5b81b;
}

/* ==================== SEARCH FOOTER ==================== */
.search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-footer-hints {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-footer-hint {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-footer-hint kbd {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.65rem;
    font-family: inherit;
    font-weight: 600;
}

/* ==================== SEARCH TRIGGER BUTTON ==================== */
.search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-trigger:hover {
    background: var(--card);
    border-color: var(--border);
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.search-trigger i {
    font-size: 0.85rem;
}

.search-trigger-text {
    display: none;
}

.search-trigger kbd {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.68rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .search-trigger-text {
        display: inline;
    }
}

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

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

    .search-input-wrap {
        padding: 12px 16px;
    }

    .search-footer {
        padding: 8px 16px;
    }
}
