/**
 * Goxa Search AI - Estilos del chat IA
 * Panel flotante estilo asistente virtual
 */

/* ============================
   OVERLAY (mobile)
   ============================ */

.goxasearchai-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    animation: goxasearchai-fadeIn 0.2s ease;
}

/* ============================
   CONTENEDOR DEL CHAT
   ============================ */

.goxasearchai-chat {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 420px;
    height: 600px;
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: goxasearchai-slideUp 0.3s ease;
}

/* ============================
   HEADER DEL CHAT
   ============================ */

.goxasearchai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1c1c1c 0%, #2a2a2a 100%);
    color: #fff;
    flex-shrink: 0;
}

.goxasearchai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
}

.goxasearchai-chat-title .material-icons {
    color: #ffc700;
    font-size: 22px;
}

.goxasearchai-chat-actions {
    display: flex;
    gap: 4px;
}

.goxasearchai-chat-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.goxasearchai-chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ============================
   AREA DE MENSAJES
   ============================ */

.goxasearchai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

/* Scrollbar personalizada */
.goxasearchai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.goxasearchai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.goxasearchai-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ============================
   MENSAJES
   ============================ */

.goxasearchai-chat-msg {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: goxasearchai-fadeIn 0.2s ease;
}

.goxasearchai-chat-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.goxasearchai-chat-msg-ai {
    align-self: flex-start;
}

.goxasearchai-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.goxasearchai-chat-msg-ai .goxasearchai-chat-avatar {
    background: linear-gradient(135deg, #6ec1e4 0%, #4a9cc7 100%);
    color: #fff;
}

.goxasearchai-chat-msg-ai .goxasearchai-chat-avatar .material-icons {
    font-size: 16px;
}

.goxasearchai-chat-msg-user .goxasearchai-chat-avatar {
    background: #ffc700;
    color: #1c1c1c;
}

.goxasearchai-chat-msg-user .goxasearchai-chat-avatar .material-icons {
    font-size: 16px;
}

.goxasearchai-chat-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.goxasearchai-chat-msg-ai .goxasearchai-chat-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.goxasearchai-chat-msg-user .goxasearchai-chat-bubble {
    background: #ffc700;
    color: #1c1c1c;
    border-bottom-right-radius: 4px;
}

.goxasearchai-chat-bubble p {
    margin: 0 0 8px 0;
}

.goxasearchai-chat-bubble p:last-child {
    margin-bottom: 0;
}

/* ============================
   MARKDOWN EN CHAT
   ============================ */

.goxasearchai-md-link {
    color: #4a9cc7;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.goxasearchai-md-link:hover {
    color: #3a7ca5;
}

.goxasearchai-md-h2,
.goxasearchai-md-h3 {
    display: block;
    font-weight: 700;
    margin: 6px 0 4px;
    color: #1c1c1c;
}

.goxasearchai-md-h2 { font-size: 14px; }
.goxasearchai-md-h3 { font-size: 13px; }

.goxasearchai-md-li {
    display: block;
    padding-left: 12px;
    position: relative;
    margin: 2px 0;
}

.goxasearchai-md-li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: #ffc700;
    font-weight: 700;
}

.goxasearchai-chat-hint {
    font-size: 12px;
    color: #888;
    font-style: italic;
    margin-top: 6px !important;
}

/* ============================
   PRODUCTOS EN EL CHAT
   ============================ */

.goxasearchai-chat-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.goxasearchai-product-card {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.goxasearchai-product-card:hover {
    border-color: #ffc700;
    box-shadow: 0 2px 8px rgba(255, 199, 0, 0.15);
    transform: translateY(-1px);
}

.goxasearchai-product-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    flex-shrink: 0;
}

.goxasearchai-product-info {
    flex: 1;
    min-width: 0;
}

.goxasearchai-product-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.goxasearchai-product-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.goxasearchai-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #ffc700;
}

.goxasearchai-product-stock {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.goxasearchai-product-stock.available {
    background: #d4edda;
    color: #155724;
}

.goxasearchai-product-stock.unavailable {
    background: #f8d7da;
    color: #721c24;
}

.goxasearchai-product-ref {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

/* ============================
   INDICADOR DE ESCRIBIENDO
   ============================ */

.goxasearchai-chat-typing {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 20px 10px;
}

.goxasearchai-chat-typing .goxasearchai-chat-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #6ec1e4 0%, #4a9cc7 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.goxasearchai-chat-typing .goxasearchai-chat-avatar .material-icons {
    font-size: 14px;
}

.goxasearchai-chat-typing-dots {
    display: flex;
    gap: 4px;
    padding: 10px 16px;
    background: #fff;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.goxasearchai-chat-typing-dots span {
    width: 7px;
    height: 7px;
    background: #ccc;
    border-radius: 50%;
    animation: goxasearchai-bounce 1.4s infinite;
}

.goxasearchai-chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.goxasearchai-chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ============================
   INPUT DEL CHAT
   ============================ */

.goxasearchai-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

.goxasearchai-chat-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.goxasearchai-chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.goxasearchai-chat-input:focus {
    border-color: #6ec1e4;
}

.goxasearchai-chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: #6ec1e4;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.goxasearchai-chat-send-btn:hover {
    background: #5ab5d6;
    transform: scale(1.05);
}

.goxasearchai-chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ============================
   ANIMACIONES
   ============================ */

@keyframes goxasearchai-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes goxasearchai-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes goxasearchai-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* ============================
   BOTON FLOTANTE (FAB)
   ============================ */

.goxasearchai-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1c1c1c 0%, #2a2a2a 100%);
    color: #ffc700;
    border: none;
    cursor: pointer;
    z-index: 9997;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    animation: goxasearchai-fabPulse 2s infinite;
}

.goxasearchai-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.4);
}

.goxasearchai-fab .material-icons {
    font-size: 28px;
}

.goxasearchai-fab.goxtasearchai-fab-hidden {
    display: none;
}

@keyframes goxasearchai-fabPulse {
    0% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(255, 199, 0, 0.4); }
    100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 768px) {
    .goxasearchai-chat {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .goxasearchai-fab {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .goxasearchai-chat-header {
        padding: 12px 16px;
    }

    .goxasearchai-chat-messages {
        padding: 16px;
    }

    .goxasearchai-chat-input-area {
        padding: 10px 12px;
    }
}
