/* ============================================================
   ROBÔ DE ATENDIMENTO MARVINHO - CSS
============================================================ */

.marvi-chatbot-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-bubble-hint {
    background: #FFFFFF;
    color: #1F2229;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    border: 1px solid #ECE7E0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    animation: bounceSlow 3s infinite;
}

.chatbot-bubble-hint span {
    color: var(--marvi-red);
}

@keyframes bounceSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.chatbot-launch-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--marvi-red);
    color: #FFFFFF;
    border: 3px solid #FFFFFF;
    box-shadow: 0 8px 24px rgba(217, 26, 42, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.chatbot-launch-btn:hover {
    transform: scale(1.08);
    background: var(--marvi-red-dark);
}

.chatbot-launch-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Chat Window */
.marvi-chat-window {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 120px);
    background: #FFFFFF;
    border-radius: 22px;
    box-shadow: 0 15px 45px rgba(0,0,0,0.18);
    border: 1px solid #EAE6DF;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.marvi-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    background: linear-gradient(135deg, #D91A2A 0%, #A30C19 100%);
    color: #FFFFFF;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

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

.chat-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #FFFFFF;
    padding: 3px;
    position: relative;
}

.chat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #10B981;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
}

.chat-header-title h4 {
    font-size: 16px;
    color: #FFFFFF;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.chat-header-title span {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.8);
}

.chat-header-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #FFFFFF;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.chat-header-actions button:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Chat Body / Messages */
.chat-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: #F9F9FA;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

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

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

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

.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 1px solid #ECE7E0;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.45;
    position: relative;
}

.chat-msg.bot .chat-msg-bubble {
    background: #FFFFFF;
    color: #2D313A;
    border: 1px solid #EFEAE5;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.chat-msg.user .chat-msg-bubble {
    background: var(--marvi-red);
    color: #FFFFFF;
    border-top-right-radius: 4px;
    box-shadow: 0 2px 6px rgba(217, 26, 42, 0.2);
}

.chat-msg-bubble a.chat-btn-action {
    display: inline-block;
    background: var(--marvi-red);
    color: #FFF !important;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    margin-top: 8px;
    text-decoration: none;
}

.chat-msg.user .chat-msg-bubble a.chat-btn-action {
    background: #FFF;
    color: var(--marvi-red) !important;
}

.chat-msg-time {
    font-size: 10px;
    color: #9CA3AF;
    margin-top: 4px;
    text-align: right;
    display: block;
}

/* Chips / Quick Reply Options */
.chat-quick-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.chat-chip-btn {
    background: #FFFFFF;
    color: var(--marvi-red);
    border: 1px solid #F5C6CB;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chat-chip-btn:hover {
    background: var(--marvi-red);
    color: #FFFFFF;
    border-color: var(--marvi-red);
}

/* Typing Indicator */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #FFF;
    border-radius: 16px;
    border-top-left-radius: 4px;
    width: fit-content;
    border: 1px solid #ECE7E0;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    background: var(--marvi-red);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat Footer / Input */
.chat-footer {
    padding: 12px 16px;
    background: #FFFFFF;
    border-top: 1px solid #ECE7E0;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    background: #F3F4F6;
    border-radius: 30px;
    padding: 4px 6px 4px 16px;
    border: 1px solid #E5E7EB;
    transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--marvi-red);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(217, 26, 42, 0.1);
}

.chat-input-field {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13.5px;
    outline: none;
    color: #1F2229;
    padding: 6px 0;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--marvi-red);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    background: var(--marvi-red-dark);
}

@media (max-width: 768px) {
    .marvi-chatbot-launcher {
        right: 18px;
        bottom: 18px;
        gap: 8px;
    }

    .chatbot-launch-btn {
        width: 54px;
        height: 54px;
        font-size: 22px;
        box-shadow: 0 6px 20px rgba(217, 26, 42, 0.35);
    }

    .chatbot-bubble-hint {
        font-size: 12px;
        padding: 6px 12px;
    }

    .marvi-chat-window {
        position: fixed;
        right: 12px;
        left: 12px;
        bottom: 16px;
        width: auto;
        height: calc(100dvh - 32px);
        max-height: 620px;
        border-radius: 20px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    }
}

@media (max-width: 480px) {
    .marvi-chatbot-launcher {
        right: 14px;
        bottom: 14px;
    }

    .chatbot-bubble-hint {
        display: none; /* Em telas muito estreitas, oculta o balão de texto para não tampar links */
    }

    .marvi-chat-window {
        right: 8px;
        left: 8px;
        bottom: 10px;
        height: calc(100dvh - 20px);
        max-height: 94vh;
        border-radius: 18px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .chat-header-avatar {
        width: 38px;
        height: 38px;
    }

    .chat-header-title h4 {
        font-size: 15px;
    }

    .chat-header-title span {
        font-size: 11px;
    }

    .chat-header-actions button {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .chat-body {
        padding: 14px 12px;
        -webkit-overflow-scrolling: touch;
    }

    .chat-bubble {
        max-width: 90%;
        font-size: 13.5px;
        line-height: 1.45;
        padding: 10px 14px;
    }

    .chat-quick-options {
        gap: 6px;
    }

    .chat-quick-option {
        font-size: 13px;
        padding: 8px 12px;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
    }

    .chat-footer {
        padding: 10px 12px;
    }

    .chat-input-field {
        font-size: 16px !important; /* Previne auto-zoom indesejado no Safari/iOS */
    }

    .chat-send-btn {
        width: 40px;
        height: 40px;
        font-size: 15px;
    }
}
