/**
 * Estilos para el Asistente IA / Buscador Inteligente
 */

/* Contenedor del buscador en el header */
.ai-search-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: auto;
}

/* Input del buscador */
.ai-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 8px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 280px;
}

.ai-search-input-wrapper:hover,
.ai-search-input-wrapper:focus-within {
    box-shadow: 0 4px 20px rgba(139, 43, 226, 0.3);
    transform: translateY(-1px);
}

.ai-search-input-wrapper i.fa-robot {
    color: #8B2BE2;
    font-size: 1.2rem;
    margin-right: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.ai-search-input {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    font-size: 0.95rem;
    color: #333;
    font-family: inherit;
}

.ai-search-input::placeholder {
    color: #999;
    font-style: italic;
}

.ai-search-btn {
    background: linear-gradient(135deg, #8B2BE2, #6A0DAD);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.ai-search-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(139, 43, 226, 0.4);
}

.ai-search-btn i {
    color: white;
    font-size: 0.9rem;
}

/* Modal de resultados */
.ai-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.ai-search-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ai-search-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
    position: relative;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Header del modal */
.ai-search-modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8f5ff, #ffffff);
}

.ai-search-modal-header h3 {
    margin: 0;
    color: #8B2BE2;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-search-modal-header i.fa-robot {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

.ai-search-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ai-search-close:hover {
    background: #f0f0f0;
    color: #333;
    transform: rotate(90deg);
}

/* Body del modal */
.ai-search-modal-body {
    padding: 30px;
}

.ai-search-question {
    background: #f8f5ff;
    border-left: 4px solid #8B2BE2;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.ai-search-question strong {
    color: #8B2BE2;
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-search-question p {
    margin: 0;
    color: #555;
    font-size: 1.05rem;
    line-height: 1.6;
}

.ai-search-response {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    min-height: 120px;
}

.ai-search-response p {
    color: #333;
    line-height: 1.8;
    font-size: 1rem;
    margin-bottom: 15px;
}

/* Enlaces de la respuesta */
.ai-search-response .ai-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #8B2BE2, #6A0DAD);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    margin: 8px 8px 8px 0;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.ai-search-response .ai-link:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(139, 43, 226, 0.4);
}

.ai-search-response .ai-link i {
    font-size: 0.8rem;
}

/* Estado de carga */
.ai-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 40px;
    color: #8B2BE2;
}

.ai-search-loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.ai-search-loading-text {
    font-size: 1.1rem;
    color: #666;
}

/* Estado de error */
.ai-search-error {
    background: #fff5f5;
    border-left: 4px solid #e53e3e;
    padding: 20px;
    border-radius: 8px;
    color: #c53030;
}

.ai-search-error i {
    margin-right: 10px;
}

/* Sugerencias rápidas */
.ai-search-suggestions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.ai-search-suggestions h4 {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-search-suggestion-btn {
    display: inline-block;
    background: #f8f5ff;
    color: #8B2BE2;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin: 5px 5px 5px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e0d4f7;
}

.ai-search-suggestion-btn:hover {
    background: #8B2BE2;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 43, 226, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .ai-search-input-wrapper {
        width: 200px;
    }

    .ai-search-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .ai-search-modal-header,
    .ai-search-modal-body {
        padding: 20px;
    }

    .ai-search-response .ai-link {
        width: 100%;
        justify-content: center;
        margin: 8px 0;
    }
}

@media (max-width: 480px) {
    .ai-search-input-wrapper {
        width: 150px;
        padding: 6px 15px;
    }

    .ai-search-input {
        font-size: 0.85rem;
    }

    .ai-search-input::placeholder {
        font-size: 0.8rem;
    }

    .ai-search-btn {
        width: 28px;
        height: 28px;
    }
}

/* Animación de texto escribiéndose */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

.ai-typing-effect {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 2s steps(40, end);
}
