/* ============================================
   Casa Monet - Interactive FAQ Chatbot Styles
   ============================================ */

/* Chatbot Floating Launcher Container */
.cm-chatbot-launcher-wrap {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Tooltip bubble above launcher */
.cm-chatbot-prompt-bubble {
    background: #ffffff;
    color: #2c3e50;
    padding: 9px 15px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(64, 179, 216, 0.2);
    animation: cmFloatPrompt 3s ease-in-out infinite alternate;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.cm-chatbot-prompt-bubble:hover {
    transform: scale(1.04);
    box-shadow: 0 12px 30px rgba(64, 179, 216, 0.25);
}

.cm-chatbot-prompt-bubble .close-bubble {
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 4px;
    transition: color 0.2s;
}

.cm-chatbot-prompt-bubble .close-bubble:hover {
    color: #ef4444;
}

@keyframes cmFloatPrompt {
    0% { transform: translateY(0); }
    100% { transform: translateY(-5px); }
}

/* Main launcher button */
.cm-chatbot-launcher-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #40B3D8 0%, #1E96A0 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 25px rgba(30, 150, 160, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
    outline: none;
}

.cm-chatbot-launcher-btn:hover {
    transform: scale(1.08) rotate(4deg);
    box-shadow: 0 12px 32px rgba(30, 150, 160, 0.55);
}

.cm-chatbot-launcher-btn:active {
    transform: scale(0.95);
}

/* Badge dot */
.cm-chatbot-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 20px;
    height: 20px;
    background-color: #83C933;
    color: #ffffff;
    border-radius: 50%;
    border: 2px solid #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cmPulseBadge 2s infinite;
}

@keyframes cmPulseBadge {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(131, 201, 51, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(131, 201, 51, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(131, 201, 51, 0); }
}

/* Icons toggle inside launcher */
.cm-chatbot-launcher-btn .icon-open,
.cm-chatbot-launcher-btn .icon-close {
    position: absolute;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cm-chatbot-launcher-btn .icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.cm-chatbot-launcher-btn.is-active .icon-open {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.cm-chatbot-launcher-btn.is-active .icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* WhatsApp Floating Button Stack Adjustment */
.whatsapp-float-stacked {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 60px;
    height: 60px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
}

.whatsapp-float-stacked:hover {
    transform: scale(1.08);
    color: #FFF;
    box-shadow: 0 12px 30px rgba(37, 211, 102, 0.5);
}

/* ============================================
   Chatbot Main Window
   ============================================ */
.cm-chat-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cm-chat-window.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.cm-chat-header {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border-bottom: 2px solid #40B3D8;
}

.cm-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cm-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #40B3D8 0%, #83C933 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 20px;
    position: relative;
    box-shadow: 0 4px 12px rgba(64, 179, 216, 0.3);
}

.cm-chat-avatar .status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #22c55e;
    border: 2px solid #2c3e50;
    border-radius: 50%;
}

.cm-chat-title h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.cm-chat-title p {
    margin: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.cm-chat-title p span.dot-pulse {
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: #22c55e;
    border-radius: 50%;
}

.cm-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cm-chat-header-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s, color 0.2s;
}

.cm-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Chat Body (Messages Stream) */
.cm-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.cm-chat-body::-webkit-scrollbar {
    width: 5px;
}

.cm-chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Date / Security notice */
.cm-chat-date-divider {
    text-align: center;
    font-size: 0.72rem;
    color: #94a3b8;
    margin: 4px 0;
    font-weight: 600;
}

/* Message Rows */
.cm-msg-row {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: cmMsgFadeIn 0.25s ease-out;
}

@keyframes cmMsgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cm-msg-row.bot {
    align-self: flex-start;
}

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

.cm-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #40B3D8;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 2px;
}

.cm-msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.88rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}

.cm-msg-row.bot .cm-msg-bubble {
    background: #ffffff;
    color: #334155;
    border-top-left-radius: 4px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.cm-msg-row.user .cm-msg-bubble {
    background: linear-gradient(135deg, #40B3D8 0%, #1E96A0 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(30, 150, 160, 0.25);
}

.cm-msg-time {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
    text-align: right;
}

.cm-msg-row.user .cm-msg-time {
    color: rgba(255, 255, 255, 0.75);
}

/* Interactive Action Buttons inside Bot Bubble */
.cm-msg-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cm-msg-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

.cm-msg-action-btn.btn-wa {
    background: #25d366;
    color: #ffffff;
}

.cm-msg-action-btn.btn-wa:hover {
    background: #20ba5a;
    color: #ffffff;
    transform: translateY(-1px);
}

.cm-msg-action-btn.btn-link {
    background: #f0fdfa;
    color: #0d9488;
    border: 1px solid rgba(13, 148, 136, 0.25);
}

.cm-msg-action-btn.btn-link:hover {
    background: #ccfbf1;
    color: #0f766e;
    transform: translateY(-1px);
}

/* Quick Topic Pills Container */
.cm-quick-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.cm-chip-btn {
    background: #ffffff;
    color: #0f766e;
    border: 1px solid #99f6e4;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    text-align: left;
}

.cm-chip-btn:hover {
    background: #14b8a6;
    color: #ffffff;
    border-color: #14b8a6;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(20, 184, 166, 0.25);
}

/* Typing Indicator */
.cm-typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border-radius: 18px;
    border-top-left-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.cm-typing-dot {
    width: 7px;
    height: 7px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: cmBouncingDot 1.4s infinite ease-in-out both;
}

.cm-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.cm-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes cmBouncingDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; background-color: #40B3D8; }
}

/* Chat Footer & Input */
.cm-chat-footer {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.cm-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 6px 8px 6px 14px;
    border-radius: 30px;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s, background 0.2s;
}

.cm-chat-form:focus-within {
    border-color: #40B3D8;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(64, 179, 216, 0.15);
}

.cm-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.88rem;
    color: #334155;
}

.cm-chat-input::placeholder {
    color: #94a3b8;
}

.cm-chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #40B3D8 0%, #1E96A0 100%);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: transform 0.2s, background 0.2s;
}

.cm-chat-send-btn:hover {
    transform: scale(1.06);
}

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

.cm-chat-footer-brand {
    text-align: center;
    margin-top: 6px;
    font-size: 0.68rem;
    color: #94a3b8;
}

.cm-chat-footer-brand a {
    color: #40B3D8;
    text-decoration: none;
    font-weight: 600;
}

/* ============================================
   Mobile Responsiveness
   ============================================ */
@media (max-width: 576px) {
    .cm-chatbot-launcher-wrap {
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-float-stacked {
        bottom: 88px;
        right: 20px;
        width: 54px;
        height: 54px;
        font-size: 26px;
    }

    .cm-chatbot-launcher-btn {
        width: 54px;
        height: 54px;
        font-size: 23px;
    }

    .cm-chat-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        z-index: 2000;
    }

    .cm-chat-header {
        border-radius: 0;
        padding: 14px 16px;
    }
}
