/**
 * Spotlight Search - macOS-style global search
 */

/* =============================================================================
   OVERLAY
   ============================================================================= */

.spotlight-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.spotlight-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* =============================================================================
   CONTAINER
   ============================================================================= */

.spotlight-container {
    position: fixed;
    top: 15%;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    width: 90%;
    max-width: 680px;
    max-height: 70vh;
    background: var(--bg-card, #fff);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
}

.spotlight-overlay.open .spotlight-container {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* =============================================================================
   SEARCH INPUT
   ============================================================================= */

.spotlight-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.spotlight-icon {
    color: var(--text-muted, #9ca3af);
    flex-shrink: 0;
}

.spotlight-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    font-weight: 400;
    background: transparent;
    color: var(--text-primary, #111827);
}

.spotlight-input::placeholder {
    color: var(--text-muted, #9ca3af);
}

.spotlight-kbd {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted, #9ca3af);
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 6px;
}

/* =============================================================================
   CONTENT AREA
   ============================================================================= */

.spotlight-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

/* =============================================================================
   SECTIONS
   ============================================================================= */

.spotlight-section {
    padding: 0 12px;
    margin-bottom: 16px;
}

.spotlight-section:last-child {
    margin-bottom: 0;
}

.spotlight-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #9ca3af);
}

.spotlight-section-title svg {
    width: 14px;
    height: 14px;
}

/* =============================================================================
   QUICK NAVIGATION GRID
   ============================================================================= */

.spotlight-nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0 8px;
}

.spotlight-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary, #111827);
    transition: all 0.15s ease;
}

.spotlight-nav-item:hover {
    background: var(--bg-hover, #f3f4f6);
    transform: translateY(-2px);
}

.spotlight-nav-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: white;
}

.spotlight-nav-icon--orders { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.spotlight-nav-icon--purchases { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.spotlight-nav-icon--warehouse { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.spotlight-nav-icon--production { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.spotlight-nav-icon--reports { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
.spotlight-nav-icon--settings { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); }
.spotlight-nav-icon--org { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); }
.spotlight-nav-icon--legal { background: linear-gradient(135deg, #059669 0%, #047857 100%); }

.spotlight-nav-label {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

/* =============================================================================
   SEARCH RESULTS
   ============================================================================= */

.spotlight-results {
    padding: 0 8px;
}

.spotlight-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary, #111827);
    transition: background 0.1s ease;
}

.spotlight-result:hover,
.spotlight-result.selected {
    background: var(--bg-hover, #f3f4f6);
}

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

.spotlight-result-icon--order {
    background: #dbeafe;
    color: #2563eb;
}

.spotlight-result-icon--counterparty {
    background: #d1fae5;
    color: #059669;
}

.spotlight-result-icon--nomenclature {
    background: #fef3c7;
    color: #d97706;
}

.spotlight-result-icon--invoice {
    background: #ede9fe;
    color: #7c3aed;
}

.spotlight-result-icon--purchase {
    background: #d1fae5;
    color: #10b981;
}

.spotlight-result-icon--contract {
    background: #fce7f3;
    color: #db2777;
}

.spotlight-result-icon--receipt {
    background: #e0f2fe;
    color: #0284c7;
}

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

.spotlight-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.spotlight-result-type {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 4px;
}

.spotlight-result-arrow {
    color: var(--text-muted, #9ca3af);
    opacity: 0;
    transition: opacity 0.1s ease;
}

.spotlight-result:hover .spotlight-result-arrow,
.spotlight-result.selected .spotlight-result-arrow {
    opacity: 1;
}

/* =============================================================================
   ORGANIZATION TREE
   ============================================================================= */

.spotlight-org-tree {
    padding: 0 8px;
}

.spotlight-org-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary, #111827);
    transition: background 0.1s ease;
}

.spotlight-org-item:hover {
    background: var(--bg-hover, #f3f4f6);
}

.spotlight-org-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: white;
    border-radius: 8px;
    flex-shrink: 0;
}

.spotlight-org-name {
    font-size: 14px;
    font-weight: 500;
}

.spotlight-org-meta {
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

/* =============================================================================
   EMPTY & LOADING STATES
   ============================================================================= */

.spotlight-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted, #9ca3af);
}

.spotlight-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.spotlight-empty-text {
    font-size: 14px;
}

.spotlight-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.spotlight-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color, #e5e7eb);
    border-top-color: var(--primary-color, #2563eb);
    border-radius: 50%;
    animation: spotlight-spin 0.8s linear infinite;
}

@keyframes spotlight-spin {
    to { transform: rotate(360deg); }
}

/* =============================================================================
   FOOTER
   ============================================================================= */

.spotlight-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f9fafb);
    font-size: 12px;
    color: var(--text-muted, #9ca3af);
}

.spotlight-footer-hint {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spotlight-footer-hint kbd {
    padding: 2px 6px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 4px;
    font-size: 11px;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    .spotlight-container {
        top: 10%;
        width: 95%;
        max-height: 80vh;
    }

    .spotlight-nav-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .spotlight-input {
        font-size: 16px;
    }

    .spotlight-kbd {
        display: none;
    }
}

@media (max-width: 480px) {
    .spotlight-nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .spotlight-nav-item {
        padding: 12px 8px;
    }

    .spotlight-nav-icon {
        width: 36px;
        height: 36px;
    }
}
