/* ================================================
   RENOSTTER — CHATBOT.CSS
   Assistente IA Rita · SDR Widget
   ================================================ */

/* ─── Popup de boas-vindas ─────────────────────── */
.chat-welcome-popup {
    position: fixed;
    bottom: 100px;
    right: 28px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 16px 56px rgba(0, 0, 0, 0.16);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 9998;
    max-width: 300px;
    cursor: pointer;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(0, 174, 239, 0.15);
}

.chat-welcome-popup.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.cwp-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

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

.cwp-text strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0A0E1A;
    margin-bottom: 3px;
}

.cwp-text p {
    font-size: 0.78rem;
    color: #6B7280;
    line-height: 1.4;
    margin: 0;
}

.cwp-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 0.75rem;
    color: #9CA3AF;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
}

.cwp-close:hover {
    color: #374151;
}

/* ─── Botão flutuante ──────────────────────────── */
.chat-toggle-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00AEEF, #0088CC);
    border: none;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 174, 239, 0.45);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: white;
}

.chat-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(0, 174, 239, 0.6);
}

.chat-toggle-btn.active {
    background: linear-gradient(135deg, #FF6B00, #E55A00);
    box-shadow: 0 8px 32px rgba(255, 107, 0, 0.45);
}

.chat-toggle-icon {
    position: absolute;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle-icon.close-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.chat-toggle-btn.active .open-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.chat-toggle-btn.active .close-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Badge de notificação */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #FF6B00;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulseBadge 1.5s ease-in-out infinite;
}

@keyframes pulseBadge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ─── Widget principal ─────────────────────────── */
.chat-widget {
    position: fixed;
    bottom: 108px;
    right: 28px;
    width: 380px;
    max-height: 580px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
    z-index: 9997;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.85) translateY(24px);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(0, 174, 239, 0.12);
}

.chat-widget.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ─── Header ───────────────────────────────────── */
.chat-header {
    background: linear-gradient(135deg, #0A0E1A 0%, #1F2937 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.chat-bot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 174, 239, 0.4);
    overflow: hidden;
    background: #000;
}

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

.chat-header-info strong {
    display: block;
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
    margin-top: 1px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #4ADE80;
    border-radius: 50%;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

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

.chat-wa-link {
    width: 32px;
    height: 32px;
    background: rgba(37, 211, 102, 0.15);
    color: #4ADE80;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-wa-link:hover {
    background: rgba(37, 211, 102, 0.3);
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* ─── Body / Mensagens ─────────────────────────── */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: #F8FAFF;
}

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

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

.chat-body::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

/* ─── Mensagens ────────────────────────────────── */
.chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: fadeInMsg 0.3s ease both;
}

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

@keyframes fadeInMsg {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: #000;
}

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

.chat-bubble {
    max-width: 82%;
    padding: 11px 15px;
    border-radius: 18px;
    font-size: 0.875rem;
    line-height: 1.55;
    word-break: break-word;
}

.chat-msg.bot .chat-bubble {
    background: white;
    color: #1F2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(0, 174, 239, 0.08);
}

.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, #00AEEF, #0088CC);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 174, 239, 0.3);
}

.chat-bubble strong {
    font-weight: 700;
}

/* ─── Typing ───────────────────────────────────── */
.typing-bubble {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 14px 18px;
}

.typing-bubble span {
    width: 7px;
    height: 7px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typingDot 1.2s ease-in-out infinite;
}

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

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

@keyframes typingDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ─── Quick Replies ────────────────────────────── */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-left: 36px;
    animation: fadeInMsg 0.3s ease 0.1s both;
}

.qr-btn {
    background: white;
    color: #00AEEF;
    border: 1.5px solid #00AEEF;
    padding: 7px 14px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.qr-btn:hover:not(:disabled) {
    background: #00AEEF;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 174, 239, 0.3);
}

.qr-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/* ─── Input ────────────────────────────────────── */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: white;
    border-top: 1px solid #F3F4F6;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1.5px solid #E5E7EB;
    border-radius: 50px;
    padding: 10px 18px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    color: #1F2937;
    background: #F9FAFB;
    outline: none;
    transition: all 0.2s;
}

.chat-input:focus {
    border-color: #00AEEF;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.1);
}

.chat-input::placeholder {
    color: #9CA3AF;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00AEEF, #0088CC);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 174, 239, 0.35);
}

.chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0, 174, 239, 0.5);
}

/* ─── Footer ───────────────────────────────────── */
.chat-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: #F9FAFB;
    border-top: 1px solid #F3F4F6;
    font-size: 0.7rem;
    color: #9CA3AF;
    flex-shrink: 0;
}

.chat-footer strong {
    color: #6B7280;
}

.chat-footer a {
    color: #00AEEF;
    font-weight: 600;
    transition: color 0.2s;
    text-decoration: none;
    cursor: pointer;
}

.chat-footer a:hover {
    color: #0088CC;
}

/* ─── Mobile ───────────────────────────────────── */
@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 96px;
        max-height: 72vh;
        border-radius: 20px;
    }

    .chat-toggle-btn {
        right: 16px;
        bottom: 20px;
    }

    .chat-welcome-popup {
        right: 12px;
        max-width: calc(100vw - 24px);
    }
}