/* ═══════════════════════════════════════════════════════════════════════════════
   22. BÚSQUEDA GLOBAL
   Búsqueda en todos los chats y mensajes
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Botón de búsqueda global en sidebar */
.global-search-btn {
    background: none;
    border: none;
    color: #8696a0;
    cursor: pointer;
    padding: 6px;
    font-size: 16px;
    transition: all 0.2s;
    border-radius: 50%;
}

.global-search-btn:hover {
    color: #00a884;
    background: rgba(0, 168, 132, 0.1);
}

/* Contenedor de búsqueda global */
.global-search-container {
    margin-bottom: 20px;
}

.global-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #111b21;
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #313d45;
    transition: border-color 0.2s;
}

.global-search-input-wrapper:focus-within {
    border-color: #00a884;
}

.global-search-input-wrapper i {
    color: #8696a0;
    font-size: 18px;
}

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

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

.global-search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 12px;
    background: #1a2328;
    border-radius: 8px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aebac1;
    font-size: 13px;
    cursor: pointer;
}

.filter-option input[type="checkbox"] {
    accent-color: #00a884;
    cursor: pointer;
}

.filter-option input[type="date"] {
    background: #111b21;
    border: 1px solid #313d45;
    border-radius: 4px;
    color: #e9edef;
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
}

.filter-option input[type="date"]:focus {
    border-color: #00a884;
}

.filter-option span {
    color: #8696a0;
}

/* Resultados de búsqueda global */
.global-search-results {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #313d45;
    border-radius: 8px;
    background: #111b21;
}

.global-search-results .search-hint {
    padding: 40px 20px;
    text-align: center;
    flex-direction: column;
    gap: 15px;
}

.global-search-results .search-hint i {
    font-size: 40px;
    opacity: 0.6;
}

.global-result-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid #313d45;
    cursor: pointer;
    transition: background 0.2s;
}

.global-result-item:hover {
    background: #1a2328;
}

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

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

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

.global-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.global-result-contact {
    color: #e9edef;
    font-weight: 500;
    font-size: 14px;
}

.global-result-date {
    color: #8696a0;
    font-size: 12px;
}

.global-result-message {
    color: #aebac1;
    font-size: 13px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.global-result-direction {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 6px;
}

.global-result-direction.sent {
    background: rgba(0, 168, 132, 0.2);
    color: #00a884;
}

.global-result-direction.received {
    background: rgba(0, 136, 204, 0.2);
    color: #0088cc;
}

/* Estadísticas de búsqueda */
.search-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #1a2328;
    border-bottom: 1px solid #313d45;
    color: #aebac1;
    font-size: 13px;
}

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

.search-stats strong {
    color: #e9edef;
}

/* Cargando búsqueda */
.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    color: #8696a0;
}

.search-loading i {
    font-size: 32px;
    margin-bottom: 15px;
    color: #00a884;
    animation: spin 1s linear infinite;
}

/* Responsive para búsqueda */
@media (max-width: 768px) {
    .chat-search-panel {
        position: absolute;
        top: 56px; /* Header más pequeño en móvil */
        left: 0;
        right: 0;
        max-height: 300px;
        z-index: 100;
        border-radius: 0;
    }
    
    .chat-search-results {
        max-height: 160px;
    }
    
    .chat-search-header {
        padding: 8px 12px;
    }
    
    .search-result-item {
        padding: 10px 12px;
    }
    
    .search-result-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .global-search-filters {
        flex-direction: column;
    }
    
    .filter-option {
        width: 100%;
    }
    
    .global-search-input-wrapper {
        flex-wrap: wrap;
    }
    
    .global-search-input-wrapper input {
        width: 100%;
    }
    
    .global-search-input-wrapper button {
        width: 100%;
        margin-top: 10px;
    }
}

