/* ============================================
   GLOBAL SEARCH DROPDOWN STYLES
   ============================================ */

/* Search Dropdown Container */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 500px;
    overflow-y: auto;
    z-index: var(--z-modal);
    display: none;
}

.search-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Clear Search Button */
.topbar__search-clear {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: none;
}

.topbar__search-clear:hover {
    background: #f1f3f5;
    color: #212529;
}

.topbar__search-clear.show {
    display: block;
}

/* Loading State */
.search-loading {
    padding: 32px 24px;
    text-align: center;
    color: #6c757d;
    display: none;
}

.search-loading.show {
    display: block;
}

/* Group Headers */
.search-group {
    border-bottom: 1px solid #f0f0f0;
}

.search-group:last-child {
    border-bottom: none;
}

.search-group-header {
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6c757d;
    background: #f8f9fa;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-group-count {
    margin-left: auto;
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

/* Search Items */
.search-item {
    padding: 12px 16px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-item:hover,
.search-item.active {
    background: #f8f9fa;
    border-left-color: #0d6efd;
}

.search-item-icon {
    width: 36px;
    height: 36px;
    background: #e7f1ff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d6efd;
    font-size: 16px;
    flex-shrink: 0;
}

.search-item-icon.icon-producto {
    background: #e7f1ff;
    color: #0d6efd;
}

.search-item-icon.icon-cliente {
    background: #d1e7dd;
    color: #198754;
}

.search-item-icon.icon-movimiento {
    background: #fff3cd;
    color: #ffc107;
}

.search-item-icon.icon-factura {
    background: #f8d7da;
    color: #dc3545;
}

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

.search-item-title {
    font-weight: 500;
    font-size: 14px;
    color: #212529;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-item-description {
    font-size: 12px;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-item-meta {
    font-size: 11px;
    color: #adb5bd;
    margin-left: auto;
    flex-shrink: 0;
}

/* Highlight matched text */
mark.highlight {
    background: #fff3cd;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
    color: #212529;
}

/* Empty State */
.search-empty {
    padding: 48px 24px;
    text-align: center;
    color: #6c757d;
    display: none;
}

.search-empty.show {
    display: block;
}

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

.search-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.search-empty-text {
    font-size: 14px;
    color: #6c757d;
}

/* Footer with Keyboard Shortcuts */
.search-footer {
    padding: 10px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 11px;
    color: #6c757d;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-footer kbd {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 2px 5px;
    font-family: monospace;
    font-size: 10px;
    margin: 0 2px;
}

/* Responsive */
@media (max-width: 767px) {
    .search-dropdown {
        max-height: 400px;
        left: -16px;
        right: -16px;
        border-radius: 0;
    }

    .search-footer {
        font-size: 10px;
        gap: 8px;
    }

    .topbar__search-kbd {
        display: none;
    }
}

/* Scrollbar custom */
.search-dropdown::-webkit-scrollbar {
    width: 8px;
}

.search-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.search-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
