/* ═══════════════════════════════════════════════════════════════════════════════
   21. BÚSQUEDA EN CONVERSACIÓN
   Panel de búsqueda dentro del chat activo
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Panel de búsqueda en chat - posicionado como overlay */
.chat-search-panel {
    display: none;
    flex-direction: column;
    background: #202c33;
    border-bottom: 1px solid #313d45;
    animation: slideDown 0.3s ease;
    position: absolute;
    top: 60px; /* Debajo del header del chat */
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 350px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-radius: 0 0 8px 8px;
}

.chat-search-panel.active {
    display: flex;
}

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

.chat-search-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    background: #2a3942;
    flex-shrink: 0;
}

.close-search-btn {
    background: none;
    border: none;
    color: #aebac1;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-search-btn:hover {
    background: #313d45;
    color: #00a884;
}

.chat-search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #111b21;
    border-radius: 8px;
    padding: 8px 12px;
    gap: 12px;
}

.chat-search-input-wrapper i {
    color: #aebac1;
    font-size: 14px;
}

.chat-search-input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: #e9edef;
    font-size: 15px;
    outline: none;
}

.chat-search-input-wrapper input::placeholder {
    color: #8696a0;
}

.clear-search-btn {
    background: none;
    border: none;
    color: #8696a0;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.2s;
}

.clear-search-btn:hover {
    color: #e9edef;
}

.chat-search-results {
    max-height: 180px;
    overflow-y: auto;
    background: #111b21;
    flex-shrink: 1;
    overflow-x: hidden;
}

.search-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: #8696a0;
    font-size: 14px;
}

.search-hint i {
    color: #00a884;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #313d45;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #202c33;
}

.search-result-item.active {
    background: #2a3942;
    border-left: 3px solid #00a884;
}

.search-result-avatar {
    width: 40px;
    height: 40px;
    background: #00a884;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

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

.search-result-name {
    color: #e9edef;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
}

.search-result-message {
    color: #8696a0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-message mark {
    background: #f7c32e;
    color: #111b21;
    padding: 1px 2px;
    border-radius: 2px;
}

.search-result-date {
    color: #8696a0;
    font-size: 11px;
    white-space: nowrap;
}

.chat-search-navigation {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 16px;
    background: #2a3942;
    border-top: 1px solid #313d45;
    flex-shrink: 0;
    border-radius: 0 0 8px 8px;
}

.search-match-info {
    color: #8696a0;
    font-size: 13px;
    margin-right: auto;
}

.search-nav-btn {
    background: #313d45;
    border: none;
    color: #e9edef;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-nav-btn:hover {
    background: #00a884;
}

.search-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mensaje resaltado durante búsqueda */
.message.search-highlight {
    animation: highlightPulse 2s ease;
    box-shadow: 0 0 0 3px #00a884, 0 0 20px rgba(0, 168, 132, 0.3);
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 0 0 3px #00a884, 0 0 20px rgba(0, 168, 132, 0.3);
    }
    50% {
        box-shadow: 0 0 0 5px #00a884, 0 0 30px rgba(0, 168, 132, 0.5);
    }
}

.message .highlight-text {
    background: #f7c32e;
    color: #111b21;
    padding: 1px 2px;
    border-radius: 2px;
}

/* No hay resultados */
.no-search-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    color: #8696a0;
    text-align: center;
}

.no-search-results i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-search-results h4 {
    color: #e9edef;
    margin-bottom: 8px;
}

