/* ==========================================
   ESTILOS DO SISTEMA DE PESQUISA GLOBAL
   ========================================== */

.search-bar-box {
    position: relative;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: 500px;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1049; /* Abaixo de modais (999999), alinhado com dropdowns padrão */
    display: none;
}

.search-category {
    padding: 10px 15px;
    font-weight: 600;
    font-size: 12px;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover {
    background: #f8f9fa;
    text-decoration: none;
    transform: translateX(3px);
}

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

.search-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    font-size: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

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

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

.search-item-title mark {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

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

/* Estados especiais */
.search-result-item.loading,
.search-result-item.error,
.search-result-item.no-results {
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.search-result-item.loading i,
.search-result-item.error i,
.search-result-item.no-results i {
    font-size: 24px;
    margin-right: 8px;
}

.search-result-item.error {
    color: #dc3545;
}

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

.search-results-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 8px;
}

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

/* Ícones por categoria */
.search-category:nth-child(1) ~ .search-result-item .search-item-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.search-result-item:has(.bx-user) .search-item-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.search-result-item:has(.bx-store) .search-item-icon {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.search-result-item:has(.bx-shopping-bag) .search-item-icon {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.search-result-item:has(.bx-wrench) .search-item-icon {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Indicador de atalho */
.search-control::placeholder {
    opacity: 0.6;
}

/* Tema escuro */
html.dark-theme .search-results-dropdown {
    background: #1e1e1e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

html.dark-theme .search-category {
    background: #2a2a2a;
    color: #b0b0b0;
    border-bottom-color: #333;
}

html.dark-theme .search-result-item {
    border-bottom-color: #333;
    color: #e0e0e0;
}

html.dark-theme .search-result-item:hover {
    background: #2a2a2a;
}

html.dark-theme .search-item-title {
    color: #e0e0e0;
}

html.dark-theme .search-item-subtitle {
    color: #909090;
}

html.dark-theme .search-result-item.loading,
html.dark-theme .search-result-item.no-results {
    color: #909090;
}

/* Animação de entrada */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results-dropdown {
    animation: slideDown 0.2s ease-out;
}

/* Responsivo */
@media (max-width: 768px) {
    .search-results-dropdown {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        max-height: calc(100vh - 80px);
    }
}
