/* ========================================================
   ELEVATE METRICS — MODERN AI CHATBOT SYSTEM (CSS)
   ======================================================== */

.elevate-chatbot-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: inherit;
}

/* 1. Floating Launcher Button */
.chatbot-trigger-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.chatbot-toggle-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #197838 0%, #008EFE 100%);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -4px rgba(0, 142, 254, 0.5), 0 0 0 1.5px rgba(255, 255, 255, 0.25);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    outline: none;
    animation: botContinuousFloat 3.5s ease-in-out infinite;
}

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

.chatbot-toggle-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(25, 120, 56, 0.5), rgba(0, 142, 254, 0.6));
    z-index: -1;
    animation: botAuraPulse 2.4s infinite cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 0.6;
    pointer-events: none;
}

.chatbot-toggle-btn::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 142, 254, 0.45);
    z-index: -2;
    animation: botRipple 2.4s infinite cubic-bezier(0.25, 0.8, 0.25, 1);
    animation-delay: 0.6s;
    pointer-events: none;
}

@keyframes botAuraPulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 0.25; }
    100% { transform: scale(1.28); opacity: 0; }
}

@keyframes botRipple {
    0% { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.45); opacity: 0; }
}

.chatbot-toggle-btn:hover {
    animation-play-state: paused;
    transform: scale(1.08) translateY(-4px) !important;
    box-shadow: 0 16px 32px -4px rgba(0, 142, 254, 0.65), 0 0 0 2.5px rgba(25, 120, 56, 0.5);
}

.chatbot-toggle-btn .toggle-icon-bot {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
    animation: botIconTease 3.2s ease-in-out infinite;
    transform-origin: center center;
}

@keyframes botIconTease {
    0%, 62%, 100% {
        transform: scale(1) rotate(0deg);
    }
    70% {
        transform: scale(1.15) rotate(-12deg);
    }
    78% {
        transform: scale(1.15) rotate(12deg);
    }
    86% {
        transform: scale(1.08) rotate(-6deg);
    }
    94% {
        transform: scale(1.04) rotate(3deg);
    }
}

.chatbot-toggle-btn:hover .toggle-icon-bot {
    animation-play-state: paused;
    transform: scale(1.1) rotate(6deg);
}

.chatbot-toggle-btn .toggle-icon-close {
    display: none;
}

.elevate-chatbot-root.open .chatbot-toggle-btn {
    animation: none;
}

.elevate-chatbot-root.open .chatbot-toggle-btn::before,
.elevate-chatbot-root.open .chatbot-toggle-btn::after {
    animation: none;
    opacity: 0;
}

.elevate-chatbot-root.open .chatbot-toggle-btn .toggle-icon-bot {
    display: none;
}

.elevate-chatbot-root.open .chatbot-toggle-btn .toggle-icon-close {
    display: block;
}

.chatbot-live-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 13px;
    height: 13px;
    background: #10B981;
    border: 2.5px solid #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 0 8px #10B981;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Teaser Notification Bubble */
.chatbot-teaser-bubble {
    position: absolute;
    bottom: calc(100% + 14px);
    right: 0;
    width: 270px;
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--border-color, rgba(0,0,0,0.1));
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.15), 0 0 15px rgba(0, 142, 254, 0.12);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 10;
}

.chatbot-teaser-bubble.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chatbot-teaser-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: var(--bg-card, #FFFFFF);
    border-right: 1px solid var(--border-color, rgba(0,0,0,0.1));
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.1));
    transform: rotate(45deg);
}

.teaser-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.teaser-sparkle {
    font-size: 1.15rem;
}

.teaser-text {
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--text-main, #0F172A);
}

.teaser-text strong {
    display: block;
    color: #008EFE;
    margin-bottom: 2px;
}

.teaser-text span {
    color: var(--text-muted, #64748B);
    font-size: 0.78rem;
}

.teaser-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted, #94A3B8);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.teaser-close-btn:hover {
    color: #F2201F;
}

/* 2. Chat Window Modal */
.chatbot-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--bg-card, #FFFFFF);
    border: 1px solid var(--border-color, rgba(0,0,0,0.1));
    border-radius: 20px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.25), 0 0 25px rgba(0, 142, 254, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.92);
    transform-origin: bottom right;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.elevate-chatbot-root.open .chatbot-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, #197838 0%, #008EFE 100%);
    color: #FFFFFF;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-avatar-wrap {
    position: relative;
}

.chatbot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

.chatbot-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-name {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.chatbot-verified-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.chatbot-status-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 1px;
}

.chatbot-status-text span {
    color: #A7F3D0;
    font-weight: 700;
}

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

.chatbot-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #FFFFFF;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Chat Messages Thread */
.chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    background: var(--bg-surface, #F8FAFC);
}

.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 88%;
    animation: msgFadeIn 0.3s ease;
}

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

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

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

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(0, 142, 254, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.user-msg .msg-avatar {
    background: rgba(25, 120, 56, 0.15);
}

.msg-bubble {
    display: flex;
    flex-direction: column;
}

.bot-msg .msg-text {
    background: var(--bg-card, #FFFFFF);
    color: var(--text-main, #0F172A);
    border: 1px solid var(--border-color, rgba(0,0,0,0.08));
    border-radius: 16px 16px 16px 4px;
    padding: 12px 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.user-msg .msg-text {
    background: linear-gradient(135deg, #197838 0%, #008EFE 100%);
    color: #FFFFFF;
    border-radius: 16px 16px 4px 16px;
    padding: 12px 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0, 142, 254, 0.25);
}

.msg-text strong {
    color: #008EFE;
}

[data-theme="dark"] .msg-text strong {
    color: #38BDF8;
}

.user-msg .msg-text strong {
    color: #FFFFFF;
}

.msg-time {
    font-size: 0.68rem;
    color: var(--text-muted, #94A3B8);
    margin-top: 4px;
    padding: 0 4px;
}

.user-msg .msg-time {
    text-align: right;
}

/* Action Buttons inside Bot Message */
.chat-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chat-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.25s ease;
}

.chat-action-btn.btn-primary-action {
    background: #008EFE;
    color: #FFFFFF;
}

.chat-action-btn.btn-primary-action:hover {
    background: #0077D6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 142, 254, 0.35);
}

.chat-action-btn.btn-whatsapp-action {
    background: #25D366;
    color: #FFFFFF;
}

.chat-action-btn.btn-whatsapp-action:hover {
    background: #1EBE5B;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

/* Quick Suggestion Chips */
.chat-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.chat-chip {
    background: var(--bg-card, #FFFFFF);
    border: 1px solid rgba(0, 142, 254, 0.25);
    border-radius: 20px;
    padding: 6px 11px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-main, #0F172A);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    outline: none;
}

.chat-chip:hover {
    background: rgba(0, 142, 254, 0.1);
    border-color: #008EFE;
    color: #008EFE;
    transform: translateY(-2px);
}

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-surface, #F8FAFC);
    border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.05));
    font-size: 0.78rem;
    color: var(--text-muted, #64748B);
}

.typing-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(0, 142, 254, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #008EFE;
    animation: typingDot 1.4s infinite ease-in-out both;
}

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

@keyframes typingDot {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Chat Footer & Input Form */
.chatbot-footer {
    padding: 12px 14px;
    background: var(--bg-card, #FFFFFF);
    border-top: 1px solid var(--border-color, rgba(0,0,0,0.08));
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chatbot-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface, #F1F5F9);
    border: 1px solid var(--border-color, rgba(0,0,0,0.1));
    border-radius: 12px;
    padding: 4px 6px 4px 12px;
    transition: border-color 0.2s;
}

.chatbot-input-wrap:focus-within {
    border-color: #008EFE;
    box-shadow: 0 0 0 2px rgba(0, 142, 254, 0.15);
}

.chatbot-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 0.88rem;
    color: var(--text-main, #0F172A);
    outline: none;
    font-family: inherit;
}

.chatbot-input::placeholder {
    color: var(--text-muted, #94A3B8);
    font-size: 0.82rem;
}

.chatbot-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #008EFE;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.chatbot-send-btn:hover {
    background: #197838;
    transform: scale(1.05);
}

.chatbot-footnote {
    font-size: 0.66rem;
    color: var(--text-muted, #94A3B8);
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .elevate-chatbot-root {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: 0;
        border-radius: 16px;
    }

    .chatbot-teaser-bubble {
        width: calc(100vw - 80px);
        right: 0;
    }
}
