/* =====================================================
   AI Search Command Palette (Cmd+K / Ctrl+K)
   Tailwind command-palette inspired design
   ===================================================== */

.cove-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 30px;
}

.cove-search-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
}

.cove-search-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: #fff;
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(17, 24, 39, 0.05),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 8px 10px -6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    animation: searchSlideIn 0.15s ease-out;
}

@keyframes searchSlideIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Input area */
.cove-search-input-wrap {
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #e5e7eb;
    gap: 12px;
}

.cove-search-icon {
    font-size: 20px;
    color: #9ca3af;
    flex-shrink: 0;
}

.cove-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: #111827;
    background: transparent;
    min-width: 0;
    padding: 14px 0;
    line-height: 1.5;
}

.cove-search-input::placeholder {
    color: #9ca3af;
}

.cove-search-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cove-search-badge kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: inherit;
    color: #9ca3af;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    line-height: 1.3;
}

/* Results */
.cove-search-results {
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    padding: 4px 0;
}

.cove-search-result-group {
    padding: 0 4px;
}

.cove-search-result-group + .cove-search-result-group {
    border-top: 1px solid #f3f4f6;
    margin-top: 2px;
    padding-top: 2px;
}

.cove-search-result-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    padding: 8px 16px 4px;
}

.cove-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin: 0 4px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: #374151;
    transition: background 0.08s;
}

.cove-search-result-item:hover,
.cove-search-result-item.active {
    background: #f3f4f6;
    color: #111827;
}

.cove-search-result-item.active {
    background: #eff6ff;
}

.cove-search-result-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f9fafb;
    color: #6b7280;
    flex-shrink: 0;
    font-size: 13px;
    border: 1px solid #e5e7eb;
}

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

.cove-search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cove-search-result-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 1px;
}

.cove-search-result-status {
    font-size: 11px;
    flex-shrink: 0;
}

/* Right-aligned action hint on hover */
.cove-search-result-item .search-result-action {
    display: none;
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
}

.cove-search-result-item:hover .search-result-action,
.cove-search-result-item.active .search-result-action {
    display: block;
}

/* Loading / Empty states */
.cove-search-loading,
.cove-search-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    flex-direction: column;
    color: #9ca3af;
}

.cove-search-loading .spinner-border {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 2px;
}

/* Footer with shortcuts */
.cove-search-shortcuts {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-top: 1px solid #f3f4f6;
    background: #f9fafb;
    font-size: 12px;
    color: #9ca3af;
}

.cove-search-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 12px;
    color: #6b7280;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.1s;
    cursor: pointer;
}

.cove-search-shortcut:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #3b82f6;
}

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

.cove-search-shortcuts .search-footer-hint kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 10px;
    font-family: inherit;
    color: #9ca3af;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .cove-search-overlay {
        padding: 12px;
    }
    .cove-search-container {
        max-height: 90vh;
        border-radius: 10px;
    }
}
