/**
 * asistente_ia.css
 * 
 * Estilos para el Asistente de Regalos Inteligente y Buscador Conversacional con Google Gemini IA
 * Tienda IORO - Identidad visual Oro (#d4af37) y Dark Navy (#0b101e / #141c29).
 */

/* --- BOTÓN FLOTANTE TRIGGER CON LOGO IORO --- */
.btn-asistente-ia-flotante {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99990;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(20, 28, 41, 0.96) 0%, rgba(11, 16, 30, 0.98) 100%);
    border: 1.5px solid rgba(212, 175, 55, 0.65);
    color: #ffffff;
    padding: 6px 16px 6px 7px;
    border-radius: 35px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 16px rgba(212, 175, 55, 0.3);
    cursor: pointer;
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pulseOroIA 3.5s infinite;
    backdrop-filter: blur(8px);
}

.btn-asistente-ia-flotante:hover {
    transform: translateY(-3px) scale(1.04);
    border-color: #d4af37;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65), 0 0 24px rgba(212, 175, 55, 0.5);
}

.btn-asistente-ia-flotante:active {
    transform: scale(0.96);
}

.asistente-ia-flotante-icon-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asistente-ia-flotante-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #0b101e;
    border: 1px solid rgba(212, 175, 55, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.btn-asistente-ia-flotante:hover .asistente-ia-flotante-logo {
    transform: rotate(10deg) scale(1.08);
}

.asistente-ia-sparkle-badge {
    position: absolute;
    bottom: -2px;
    right: -3px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #f59e0b);
    color: #0b101e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    border: 1.5px solid #0b101e;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.7);
}

.asistente-ia-sparkle-badge i {
    animation: spinSparkle 4s linear infinite;
}

.asistente-ia-flotante-txt-wrap {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.15;
}

.asistente-ia-flotante-title {
    color: #f8fafc;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.asistente-ia-flotante-sub {
    color: #d4af37;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

@keyframes pulseOroIA {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.6), 0 8px 24px rgba(0, 0, 0, 0.5);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(212, 175, 55, 0), 0 8px 24px rgba(0, 0, 0, 0.5);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0), 0 8px 24px rgba(0, 0, 0, 0.5);
    }
}

@keyframes spinSparkle {
    0% { transform: rotate(0deg); }
    15% { transform: rotate(15deg) scale(1.15); }
    30% { transform: rotate(-10deg); }
    45% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* En móviles, ocultar el botón flotante (ahora vive integrado en la barra de navegación inferior) */
@media (max-width: 768px) {
    .btn-asistente-ia-flotante,
    #btnAbrirAsistenteIA {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* --- OVERLAY & MODAL CONTENEDOR DEL CHAT --- */
.asistente-ia-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 16, 30, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100020;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.asistente-ia-overlay.abierto {
    opacity: 1;
    visibility: visible;
}

.asistente-ia-modal {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 390px;
    max-width: calc(100vw - 30px);
    height: 580px;
    max-height: calc(100vh - 50px);
    background: #141c29;
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 18px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 30px rgba(212, 175, 55, 0.15);
    z-index: 100030;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
}

.asistente-ia-modal.abierto {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Mobile drawer mode */
@media (max-width: 768px) {
    .asistente-ia-modal {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 85vh;
        height: 85dvh;
        max-height: 85dvh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        border-left: none;
        border-right: none;
        transform: translateY(100%);
        z-index: 100030;
    }
    .asistente-ia-modal.abierto {
        transform: translateY(0);
    }
}

/* --- CUANDO EL CHAT ESTÁ ACTIVO EN MÓVIL: OCULTAR BARRAS INFERIORES PARA QUE NO SUBAN CON EL TECLADO --- */
body.asistente-ia-activo .bottom-nav-bar,
body.asistente-ia-activo .filtros-container,
body.asistente-ia-activo .btn-asistente-ia-flotante {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* --- HEADER DEL ASISTENTE --- */
.asistente-ia-header {
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.asistente-ia-perfil {
    display: flex;
    align-items: center;
    gap: 10px;
}

.asistente-ia-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0b101e;
    border: 1.5px solid rgba(212, 175, 55, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
    flex-shrink: 0;
}

.asistente-avatar-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
}

.asistente-avatar-sparkle {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #f59e0b);
    color: #0b101e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    border: 1.5px solid #0f172a;
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.7);
}

.asistente-ia-info h4 {
    margin: 0;
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.asistente-ia-status {
    font-size: 0.72rem;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 4px;
}

.asistente-ia-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px #22c55e;
}

.btn-cerrar-asistente-ia {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.btn-cerrar-asistente-ia:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* --- SUGERENCIAS RÁPIDAS (CHIPS) --- */
.asistente-ia-chips-scroll {
    display: flex;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid #1e293b;
    overflow-x: auto;
    scrollbar-width: none;
}

.asistente-ia-chips-scroll::-webkit-scrollbar {
    display: none;
}

.asistente-chip-btn {
    white-space: nowrap;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.25);
    color: #cbd5e1;
    font-size: 0.72rem;
    padding: 4px 9px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.asistente-chip-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
    color: #fff;
}

/* --- ÁREA DE MENSAJES --- */
.asistente-ia-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.mensaje-burbuja {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.86rem;
    line-height: 1.45;
    word-break: break-word;
}

.mensaje-burbuja.usuario {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-bottom-right-radius: 3px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.mensaje-burbuja.asistente {
    align-self: flex-start;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-bottom-left-radius: 3px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

/* Animación escribiendo (Typing Indicator) */
.asistente-escribiendo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.asistente-escribiendo span {
    width: 6px;
    height: 6px;
    background: #d4af37;
    border-radius: 50%;
    animation: typingBounce 1.2s infinite ease-in-out;
}

.asistente-escribiendo span:nth-child(2) {
    animation-delay: 0.2s;
}

.asistente-escribiendo span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-5px); opacity: 1; }
}

/* --- TARJETAS DE PRODUCTOS RECOMENDADOS EN CHAT --- */
.asistente-productos-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.asistente-prod-card {
    background: #141c29;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    transition: border-color 0.2s, transform 0.2s;
}

.asistente-prod-card:hover {
    border-color: #d4af37;
    transform: translateX(2px);
}

.asistente-prod-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: #0f172a;
    border: 1px solid #334155;
    flex-shrink: 0;
}

.asistente-prod-detalles {
    flex: 1;
    min-width: 0;
}

.asistente-prod-nombre {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.asistente-prod-precio {
    color: #22c55e;
    font-weight: 700;
    font-size: 0.8rem;
}

.asistente-prod-acciones {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.btn-asistente-3d {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #ffffff;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s;
}

.btn-asistente-3d:hover {
    opacity: 0.9;
}

.btn-asistente-ver {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s, color 0.2s;
}

.btn-asistente-ver:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: #d4af37;
    color: #d4af37;
}

/* --- BARRA DE ENTRADA (INPUT) --- */
.asistente-ia-footer {
    padding: 10px 14px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-asistente-ia {
    flex: 1;
    background: #141c29;
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 9px 14px;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.input-asistente-ia:focus {
    border-color: #d4af37;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

.btn-enviar-asistente-ia {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4af37, #f59e0b);
    color: #0b101e;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    flex-shrink: 0;
}

.btn-enviar-asistente-ia:hover {
    transform: scale(1.08);
}

.btn-enviar-asistente-ia:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
