/**
 * SEARCH ENGINE STYLES
 * Estilos para el panel de resultados de búsqueda
 * 
 * @author MrGreen Development Team
 * @version 1.0.0
 */

/* ===== PANEL DE RESULTADOS ===== */
.search-results-panel {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    z-index: 9998 !important; /* Justo debajo del header (10000) pero por encima del contenido */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    border: none;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    min-width: 100%;
    width: 100%;
    display: block !important;
    margin: 0;
    padding: 0;
}

.search-results-panel.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ===== CONTENIDO ===== */
.search-results-content {
    padding: 8px 0;
}

/* ===== CATEGORÍA ===== */
.search-results-category {
    margin-bottom: 8px;
}

.search-results-category:last-child {
    margin-bottom: 0;
}

.search-results-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
}

.search-results-category-header > span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-results-category-header i {
    font-size: 11px;
    opacity: 0.8;
}

.search-results-category-items {
    display: flex;
    flex-direction: column;
}

/* Botones de gestión de historial */
.search-history-clear-btn,
.search-history-delete-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-history-clear-btn:hover,
.search-history-delete-btn:hover {
    background: #f3f4f6;
    color: #ef4444;
}

.search-result-item-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 8px;
}

.search-result-item-wrapper .search-result-item {
    flex: 1;
    margin: 0;
}

.search-history-delete-btn {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.search-result-item-wrapper:hover .search-history-delete-btn {
    opacity: 1;
}

/* ===== ITEM DE RESULTADO ===== */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: #111827;
    transition: background-color 0.15s ease;
    cursor: pointer;
    border-radius: 8px;
    margin: 2px 8px;
}

.search-result-item:hover,
.search-result-item.is-selected {
    background-color: #f3f4f6;
}

.search-result-item:active {
    background-color: #e5e7eb;
}

/* Avatar/Icono */
.search-result-avatar,
.search-result-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

.search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-icon {
    background: #e5e7eb;
    color: #6b7280;
    font-size: 16px;
}

/* Información */
.search-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.search-result-subtitle {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* ===== FOOTER ===== */
.search-results-footer {
    border-top: 1px solid #e5e7eb;
    padding: 12px 16px;
    margin-top: 8px;
}

.search-results-view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    text-decoration: none;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.search-results-view-all:hover {
    background-color: #f3f4f6;
}

.search-results-view-all i {
    font-size: 12px;
    color: #6b7280;
}

/* ===== ESTADOS ===== */
.search-results-loading,
.search-results-error,
.search-results-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.search-results-loading i,
.search-results-error i,
.search-results-empty i {
    font-size: 32px;
    margin-bottom: 12px;
    color: #9ca3af;
}

.search-results-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #53fc1b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.search-results-error {
    color: #dc2626;
}

.search-results-error i {
    color: #dc2626;
}

/* ===== SCROLLBAR ===== */
.search-results-panel::-webkit-scrollbar {
    width: 8px;
}

.search-results-panel::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 4px;
}

.search-results-panel::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.search-results-panel::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== MODO OSCURO ===== */
.dark-mode .search-results-panel {
    background: var(--color-surface-primary) !important;
    border-top-color: rgba(255, 255, 255, 0.1) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

.dark-mode .search-result-item {
    color: #E4E6EB !important;
}

.dark-mode .search-result-item:hover,
.dark-mode .search-result-item.is-selected {
    background-color: #3A3B3C !important;
}

.dark-mode .search-result-item:active {
    background-color: #4A4B4C !important;
}

.dark-mode .search-result-avatar {
    background: #3A3B3C !important;
    border: 1px solid #4A4B4C;
}

.dark-mode .search-result-icon {
    background: #3A3B3C !important;
    color: #B0B3B8 !important;
    border: 1px solid #4A4B4C;
}

.dark-mode .search-result-title {
    color: #E4E6EB !important;
    font-weight: 500;
}

.dark-mode .search-result-subtitle {
    color: #B0B3B8 !important;
}

.dark-mode .search-results-category-header {
    color: #B0B3B8 !important;
    font-weight: 600;
}

.dark-mode .search-results-category-header i {
    color: #9ca3af !important;
}

.dark-mode .search-history-clear-btn,
.dark-mode .search-history-delete-btn {
    color: #9ca3af;
}

.dark-mode .search-history-clear-btn:hover,
.dark-mode .search-history-delete-btn:hover {
    background: #3A3B3C !important;
    color: #ef4444 !important;
}

.dark-mode .search-results-footer {
    border-top-color: #3A3B3C !important;
}

.dark-mode .search-results-view-all {
    color: #E4E6EB !important;
}

.dark-mode .search-results-view-all:hover {
    background-color: #3A3B3C !important;
    color: #53fc1b !important;
}

.dark-mode .search-results-view-all i {
    color: #53fc1b !important;
}

.dark-mode .search-results-loading,
.dark-mode .search-results-error,
.dark-mode .search-results-empty {
    color: #B0B3B8 !important;
}

.dark-mode .search-results-loading i,
.dark-mode .search-results-empty i {
    color: #9ca3af !important;
}

.dark-mode .search-results-error i {
    color: #ef4444 !important;
}

.dark-mode .search-results-spinner {
    border-color: #3A3B3C !important;
    border-top-color: #53fc1b !important;
}

.dark-mode .search-results-panel::-webkit-scrollbar-track {
    background: #18191A !important;
}

.dark-mode .search-results-panel::-webkit-scrollbar-thumb {
    background: #3A3B3C !important;
}

.dark-mode .search-results-panel::-webkit-scrollbar-thumb:hover {
    background: #4A4B4C !important;
}

/* ===== PROMPT DE REGISTRO ===== */
.search-results-signup-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.search-results-signup-icon {
    font-size: 48px;
    color: #53fc1b;
    margin-bottom: 16px;
}

.search-results-signup-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.search-results-signup-text {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
    max-width: 400px;
    line-height: 1.5;
}

.search-results-signup-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.search-results-signup-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.search-results-signup-btn-primary {
    background: #53fc1b;
    color: #111827;
}

.search-results-signup-btn-primary:hover {
    background: #45d816;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(83, 252, 27, 0.3);
}

.search-results-signup-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.search-results-signup-btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

/* Modo oscuro - Prompt de registro */
.dark-mode .search-results-signup-title {
    color: #E4E6EB !important;
}

.dark-mode .search-results-signup-text {
    color: #B0B3B8 !important;
}

.dark-mode .search-results-signup-btn-secondary {
    background: #3A3B3C !important;
    color: #E4E6EB !important;
    border-color: #4A4B4C !important;
}

.dark-mode .search-results-signup-btn-secondary:hover {
    background: #4A4B4C !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .search-results-panel {
        max-height: 400px;
    }
    
    .search-result-item {
        padding: 12px 16px;
    }
    
    .search-result-avatar,
    .search-result-icon {
        width: 36px;
        height: 36px;
    }
    
    .search-results-signup-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .search-results-signup-btn {
        width: 100%;
        justify-content: center;
    }
}

