/* Chatbot Styles */
:root {
    --chatbot-primary: #0D3327; /* Verde oscuro */
    --chatbot-secondary: #B08840; /* Dorado */
    --chatbot-accent: #6E2537; /* Burdeos */
    --chatbot-text: #333;
    --chatbot-text-light: #f5f3eb;
    --chatbot-bg: #fff;
    --chatbot-user-msg: #f0f8ff;
    --chatbot-assistant-msg: #f8f8f8;
    --chatbot-border-radius: 16px;
    --chatbot-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    --chatbot-transition: all 0.3s ease;
}

/* Contenedor principal */
#chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
}

/* Botón para abrir el chatbot */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #1a4d3a 100%);
    color: var(--chatbot-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    transition: var(--chatbot-transition);
}

.chatbot-toggle:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.chatbot-toggle-icon {
    width: 28px;
    height: 28px;
}

/* Ventana del chatbot */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 550px;
    background: var(--chatbot-bg);
    border-radius: var(--chatbot-border-radius);
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: var(--chatbot-transition);
    pointer-events: none;
    border: 1px solid rgba(13, 51, 39, 0.1);
}

.chatbot-window.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Cabecera del chatbot */
.chatbot-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #1a4d3a 100%);
    color: var(--chatbot-text-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-logo {
    width: 30px;
    height: auto;
}

.chatbot-title span {
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 16px;
    color: var(--chatbot-secondary);
}

.chatbot-close {
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chatbot-secondary);
    transition: var(--chatbot-transition);
}

.chatbot-close:hover {
    transform: rotate(90deg);
    color: var(--chatbot-text-light);
}

/* Área de mensajes */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--chatbot-bg);
}

/* Estilos de mensajes */
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    animation: fadeIn 0.3s ease;
    position: relative;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, #1a4d3a 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: #f8f8f8;
    border: 1px solid #eaeaea;
    color: var(--chatbot-text);
    border-bottom-left-radius: 4px;
}

.message.loading {
    align-self: flex-start;
    background: transparent;
    padding: 8px;
}

.message-content {
    line-height: 1.5;
    font-size: 14px;
    word-break: break-word;
}

.message.assistant .message-content a {
    color: var(--chatbot-accent);
    text-decoration: underline;
    transition: var(--chatbot-transition);
}

.message.assistant .message-content a:hover {
    color: var(--chatbot-primary);
}

/* Sugerencias */
.chatbot-suggestions {
    padding: 0 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 100px;
    overflow-y: auto;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eaeaea;
}

.suggestion-item {
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 12px;
    color: var(--chatbot-text);
    cursor: pointer;
    transition: var(--chatbot-transition);
    border: 1px solid #e0e0e0;
    white-space: nowrap;
}

.suggestion-item:hover {
    background: var(--chatbot-primary);
    color: white;
}

/* Área de input */
.chatbot-input {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #eaeaea;
}

.chatbot-input input {
    flex: 1;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: var(--chatbot-transition);
}

.chatbot-input input:focus {
    outline: none;
    border-color: var(--chatbot-secondary);
    box-shadow: 0 0 0 2px rgba(176, 136, 64, 0.1);
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-secondary) 0%, #d4a853 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--chatbot-transition);
    flex-shrink: 0;
}

.chatbot-send svg {
    width: 18px;
    height: 18px;
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(176, 136, 64, 0.3);
}

/* Productos relacionados */
.products-message {
    max-width: 100% !important;
}

.related-products {
    width: 100%;
}

.related-products h4 {
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 15px;
    color: var(--chatbot-primary);
}

.related-products .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    width: 100%;
}

.related-products .product-item {
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    transition: var(--chatbot-transition);
    background: white;
}

.related-products .product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.related-products .product-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
}

.related-products .product-info {
    padding: 10px;
}

.related-products h5 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-products .price {
    display: block;
    color: var(--chatbot-accent);
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 8px;
}

.related-products .view-product {
    display: block;
    text-align: center;
    padding: 5px;
    background: var(--chatbot-primary);
    color: white;
    border-radius: 4px;
    font-size: 11px;
    transition: var(--chatbot-transition);
}

.related-products .view-product:hover {
    background: var(--chatbot-accent);
}

/* Animación de los puntos de carga */
.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ccc;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos responsive */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: 500px;
        right: 0;
        bottom: 70px;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
        right: 10px;
        bottom: 10px;
    }
}