/* Chatbot IA de Royaal — adaptado del plugin "Chatbot Sian" original.
   Colores alineados a la marca (var(--primary-color)). */
:root {
    --chatbot-ia-pad-top: 30px;
    --chatbot-ia-pad-bottom: 30px;
    --chatbot-ia-pad-side: 30px;
}

#rasa-chat-bubble {
    position: fixed;
    bottom: var(--chatbot-ia-pad-bottom);
    right: var(--chatbot-ia-pad-side);
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color, #D32F2F), #a81f1f);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.4);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    z-index: 9999;
    transition: all 0.3s ease;
}
#rasa-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(211, 47, 47, 0.5);
}
#rasa-chat-window {
    position: fixed;
    bottom: calc(var(--chatbot-ia-pad-bottom) + 72px);
    right: var(--chatbot-ia-pad-side);
    width: 380px;
    max-height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
}
@media (max-width: 480px) {
    #rasa-chat-window {
        width: 92%;
        right: 4%;
        bottom: calc(var(--chatbot-ia-pad-bottom) + 68px);
        max-height: 70vh;
    }
    #rasa-chat-bubble {
        bottom: var(--chatbot-ia-pad-bottom);
        right: 16px;
    }
}

body.chatbot-ia-left #rasa-chat-bubble,
body.chatbot-ia-left #rasa-chat-window {
    right: auto;
    left: var(--chatbot-ia-pad-side);
}
@media (max-width: 480px) {
    body.chatbot-ia-left #rasa-chat-window {
        right: auto;
        left: 4%;
    }
    body.chatbot-ia-left #rasa-chat-bubble {
        right: auto;
        left: 16px;
    }
}

#rasa-chat-header {
    background: linear-gradient(135deg, var(--primary-color, #D32F2F), #a81f1f);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#rasa-chat-header h3 { margin: 0; font-size: 18px; font-weight: 700; color: #fff; }
#rasa-chat-close { background: none; border: none; color: white; font-size: 24px; cursor: pointer; padding: 0; }

#rasa-chat-messages { flex: 1; padding: 14px 16px; overflow-y: auto; background: #f5f7fa; }

.rasa-msg-user {
    background: linear-gradient(135deg, var(--primary-color, #D32F2F), #a81f1f);
    color: white;
    padding: 10px 14px;
    border-radius: 16px 16px 4px 16px;
    margin-left: auto;
    margin-bottom: 8px;
    max-width: 80%;
    box-shadow: 0 2px 8px rgba(211,47,47,0.2);
    white-space: pre-line;
}
.rasa-msg-bot {
    background: white;
    color: #333;
    padding: 10px 14px;
    border-radius: 16px 16px 16px 4px;
    margin-bottom: 8px;
    max-width: 90%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    white-space: pre-line;
    font-size: 12.5px;
    line-height: 1.35;
}
.rasa-msg-bot p { margin: 0 0 8px 0; }
.rasa-msg-bot p:last-child { margin-bottom: 0; }

#rasa-chat-footer { padding: 15px; border-top: 1px solid #eee; display: flex; gap: 10px; background: white; }
#rasa-chat-input {
    flex: 1; padding: 12px 16px; border: 2px solid #eee; border-radius: 24px;
    outline: none; font-size: 15px; transition: border-color 0.2s;
}
#rasa-chat-input:focus { border-color: var(--primary-color, #D32F2F); }
#rasa-chat-send {
    width: 48px; height: 48px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, var(--primary-color, #D32F2F), #a81f1f);
    color: white; font-size: 20px; cursor: pointer;
    display: flex; justify-content: center; align-items: center; transition: all 0.2s ease;
}
#rasa-chat-send:hover { transform: scale(1.05); }

.rasa-typing {
    display: inline-flex; align-items: center; background: white; padding: 10px 14px;
    border-radius: 16px 16px 16px 4px; margin-bottom: 10px; width: fit-content;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.rasa-typing-text { font-size: 13px; color: #888; font-style: italic; animation: rasa-blink 1s ease-in-out infinite; }
@keyframes rasa-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.rasa-product-block { margin: 6px 0; }
.rasa-product-block:first-of-type { margin-top: 4px; }

.rasa-product-card {
    display: block; position: relative; border: 1px solid #eee; border-radius: 10px;
    padding: 8px 10px; background: #fafbfc; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    text-decoration: none; color: inherit; transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.rasa-product-card:hover { border-color: var(--primary-color, #D32F2F); box-shadow: 0 2px 8px rgba(211,47,47,0.12); }

.rasa-product-num {
    position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--primary-color, #D32F2F); color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(211,47,47,0.4);
}

.rasa-product-card-top {
    display: grid; grid-template-columns: 58px 1fr; grid-template-rows: auto auto;
    gap: 3px 9px; padding-right: 22px;
}
.rasa-product-img-col { grid-column: 1; grid-row: 1; }
.rasa-product-img { width: 58px; height: 58px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid #eee; display: block; }

.rasa-product-info { grid-column: 2; grid-row: 1; min-width: 0; display: flex; align-items: flex-start; }
.rasa-product-title { font-weight: 400; color: #222; margin: 0; font-size: 12.5px; line-height: 1.3; }

.rasa-product-price-col { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.rasa-product-price { color: var(--primary-color, #D32F2F); font-weight: 700; font-size: 12.5px; margin: 0; text-align: center; line-height: 1.2; }
.rasa-product-price-old { color: #aaa; font-weight: 400; font-size: 10.5px; text-decoration: line-through; display: block; text-align: center; line-height: 1.2; }

.rasa-stock-col { grid-column: 2; grid-row: 2; display: flex; align-items: center; }
.rasa-stock-badge { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 8px; white-space: nowrap; }
.rasa-stock-badge.en-stock { background: #e6f7ec; color: #1a8a4a; }
.rasa-stock-badge.sin-stock { background: #fdeaea; color: #c1181e; }

.rasa-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 10px;
    border-radius: 16px; font-size: 12px; font-weight: 600; text-decoration: none; border: none;
    cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; flex: 1;
    white-space: nowrap; line-height: 1;
}
.rasa-btn:hover { transform: translateY(-1px); }
.rasa-btn-icon { font-size: 13px; line-height: 1; }

.rasa-product-actions { display: flex; gap: 6px; margin-top: 5px; }

.rasa-btn-whatsapp { background: linear-gradient(135deg, #25D366, #1ebe5d); color: #fff; box-shadow: 0 2px 6px rgba(37,211,102,0.3); }

.rasa-btn-carrito { background: #2c2c2c; color: #fff; }
.rasa-btn-carrito:disabled { opacity: 0.85; cursor: default; transform: none; }
.rasa-btn-carrito.rasa-btn-success { background: linear-gradient(135deg, #25D366, #1ebe5d); }

.rasa-whatsapp-cta { margin-top: 8px; }
.rasa-whatsapp-cta .rasa-btn { width: 100%; padding: 9px 12px; font-size: 13px; }

.rasa-hint { font-size: 12px; color: #888; margin-top: 4px; margin-bottom: 0; }
