/* ========================================
   ORBIT GLOBAL SEARCH
   ======================================== */

/* Search Modal Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* Search Container */
.search-container {
    width: 600px;
    max-width: 90vw;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 243, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(0, 243, 255, 0.1);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.search-overlay.show .search-container {
    transform: scale(1) translateY(0);
}

/* Search Input */
.search-input-wrapper {
    position: relative;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-input-wrapper i {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #00f3ff;
}

.search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 50px 14px 50px;
    font-size: 16px;
    color: #fff;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(0, 243, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.1);
}

.search-input::placeholder {
    color: #64748b;
}

.search-close {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.search-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Search Filters */
.search-filters {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.search-filter {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-filter:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.3);
}

.search-filter.active {
    background: rgba(0, 243, 255, 0.15);
    border-color: rgba(0, 243, 255, 0.5);
    color: #00f3ff;
}

.search-filter i {
    font-size: 14px;
}

/* Search Results */
.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.search-result-item {
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.search-result-item:hover,
.search-result-item.selected {
    background: rgba(0, 243, 255, 0.1);
}

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

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

.search-result-icon.product {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.search-result-icon.quote {
    background: rgba(0, 243, 255, 0.15);
    color: #00f3ff;
}

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

.search-result-icon.invoice {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
}

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

.search-result-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title mark {
    background: rgba(0, 243, 255, 0.3);
    color: #00f3ff;
    padding: 0 2px;
    border-radius: 2px;
}

.search-result-subtitle {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-badge {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}

/* Empty State */
.search-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.search-empty i {
    font-size: 48px;
    color: #334155;
    margin-bottom: 16px;
    opacity: 0.5;
}

.search-empty p {
    margin: 0;
    font-size: 14px;
}

.search-empty.no-results p {
    color: #94a3b8;
}

/* Search Footer */
.search-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #64748b;
}

.search-shortcuts {
    display: flex;
    gap: 12px;
}

.search-shortcut {
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-shortcut kbd {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #94a3b8;
}

/* Loading State */
.search-loading {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.search-loading i {
    font-size: 32px;
    color: #00f3ff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Category Headers */
.search-category-header {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

.search-category-header:first-child {
    margin-top: 0;
}

/* Scrollbar */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 243, 255, 0.3);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-overlay {
        padding-top: 5vh;
    }

    .search-container {
        width: 95vw;
    }

    .search-input {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    .search-results {
        max-height: 60vh;
    }

    .search-shortcuts {
        display: none;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {

    .search-overlay,
    .search-container,
    .search-result-item {
        transition: none;
    }

    .search-loading i {
        animation: none;
    }
}