/* ═══════════════════════════════════════════════════════════════
   BALANCE CODE — AI CHATBOT PREMIUM WIDGET
   Glassmorphism • Dark Theme • RTL/LTR • Responsive
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    --cb-bg-deep: #080f12;
    --cb-bg-glass: rgba(10, 26, 31, 0.92);
    --cb-bg-header: linear-gradient(135deg, #0d2226 0%, #0a1a1f 100%);
    --cb-bg-msg-bot: rgba(22, 56, 62, 0.88);
    --cb-bg-msg-user: linear-gradient(135deg, #00c7af 0%, #009f8b 100%);
    --cb-bg-input: rgba(18, 45, 50, 0.6);
    --cb-bg-input-focus: rgba(21, 53, 56, 0.8);
    --cb-accent: #00c7af;
    --cb-accent-glow: rgba(0, 199, 175, 0.25);
    --cb-accent-soft: rgba(0, 199, 175, 0.08);
    --cb-text: #eaf5f3;
    --cb-text-sec: #8eb5ad;
    --cb-text-muted: #8baca6;
    --cb-border: rgba(0, 199, 175, 0.12);
    --cb-border-strong: rgba(0, 199, 175, 0.22);
    --cb-font: 'IBM Plex Sans Arabic', sans-serif;
    --cb-radius-lg: 22px;
    --cb-radius-md: 16px;
    --cb-radius-sm: 10px;
    --cb-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 199, 175, 0.08);
    --cb-shadow-fab: 0 8px 32px rgba(0, 199, 175, 0.35);
}

/* ═══════════════════════════════════════
   FAB BUTTON
   ═══════════════════════════════════════ */
#chatbot-fab {
    position: fixed;
    bottom: 24px;
    z-index: 10000;
    width: 110px;
    height: 185px;
    border: none;
    background: transparent !important;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none !important;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* RTL: bottom-left / LTR: bottom-right */
[dir="rtl"] #chatbot-fab { left: 24px; right: auto; }
[dir="ltr"] #chatbot-fab { right: 24px; left: auto; }
#chatbot-fab { left: 24px; right: auto; } /* default RTL fallback */

#chatbot-fab::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 212, 179, 0.4), rgba(0, 160, 138, 0.1));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
    display: none;
}

#chatbot-fab:hover {
    transform: scale(1.08) translateY(-4px);
    filter: drop-shadow(0 12px 24px rgba(0, 199, 175, 0.5));
}

#chatbot-fab .chatbot-fab-avatar {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease-in-out;
    animation: robotFloat 3.5s ease-in-out infinite;
}
#chatbot-fab .fa-chevron-down { display: none; }

#chatbot-fab.active {
    animation: none;
    background: var(--cb-bg-glass) !important;
    border: 1.5px solid var(--cb-border-strong) !important;
    color: var(--cb-accent) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
    transform: rotate(0deg);
    width: 48px;
    height: 48px;
    border-radius: 14px;
    filter: none !important;
}
#chatbot-fab.active .chatbot-fab-avatar { display: none; }
#chatbot-fab.active .fa-chevron-down { display: block; font-size: 18px; }

/* ═══════════════════════════════════════
   HYDRO RIPPLE WATER EFFECT
   ═══════════════════════════════════════ */
.chatbot-ripple-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    pointer-events: none;
    z-index: -1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatbot-fab.active .chatbot-ripple-container {
    display: none !important;
}

.chatbot-ripple-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(0, 199, 175, 0.5);
    background: radial-gradient(circle, rgba(0, 199, 175, 0.15) 0%, rgba(99, 102, 241, 0.05) 50%, transparent 70%);
    opacity: 0;
    animation: hydroRipple 3.6s cubic-bezier(0.1, 0.4, 0.2, 1) infinite;
    pointer-events: none;
}

.chatbot-ripple-ring.ring-1 {
    animation-delay: 0s;
}
.chatbot-ripple-ring.ring-2 {
    animation-delay: 1.2s;
}
.chatbot-ripple-ring.ring-3 {
    animation-delay: 2.4s;
}

/* ═══════════════════════════════════════
   SEQUENTIAL SOAP BUBBLE STREAM (سلسلة دوائر الصابون المتتالية)
   ═══════════════════════════════════════ */
.chatbot-bubble-stream-container {
    position: fixed;
    bottom: 120px;
    z-index: 9999;
    pointer-events: none; /* Layout overlay: does not block clicks on page content */
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 12px;
}

[dir="rtl"] .chatbot-bubble-stream-container { left: 35px; right: auto; }
[dir="ltr"] .chatbot-bubble-stream-container { right: 35px; left: auto; align-items: flex-end; }
.chatbot-bubble-stream-container { left: 35px; right: auto; } /* fallback */

.stream-word-bubble {
    position: relative;
    pointer-events: auto; /* Active pointer events for popping on hover */
    background: linear-gradient(135deg, rgba(8, 24, 28, 0.95) 0%, rgba(14, 43, 50, 0.97) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(0, 199, 175, 0.55);
    border-radius: 40px;
    padding: 10px 20px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 199, 175, 0.25),
        inset 0 1px 1px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    max-width: 290px;
    animation: streamFloatFlyUp 7s cubic-bezier(0.22, 0.7, 0.25, 1) forwards;
    will-change: transform, opacity;
}

/* Hovering over any bubble pops it immediately without opening chat! */
.stream-word-bubble:hover {
    animation: bubblePopInstant 0.25s ease-out forwards !important;
}

.stream-word-bubble:hover .stream-bubble-burst-particles span {
    animation: particleBurstOut 0.35s ease-out forwards;
}

.stream-word-bubble.popping {
    animation: bubblePopInstant 0.25s ease-out forwards !important;
}

.stream-word-bubble.popping .stream-bubble-burst-particles span {
    animation: particleBurstOut 0.35s ease-out forwards;
}

.stream-bubble-reflection-top {
    position: absolute;
    top: 2px;
    left: 15%;
    width: 70%;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 179, 0.6), rgba(255, 255, 255, 0.8), rgba(0, 212, 179, 0.6), transparent);
    border-radius: 10px;
    filter: blur(1px);
    pointer-events: none;
}

.stream-bubble-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 2;
}

.stream-bubble-sparkle {
    color: #00f0d4;
    font-size: 14px;
    filter: drop-shadow(0 0 6px #00c7af);
}

.stream-bubble-text {
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* Burst particles for instant popping */
.stream-bubble-burst-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.stream-bubble-burst-particles span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: radial-gradient(circle, #00f0d4 0%, rgba(255, 255, 255, 0.9) 100%);
    border-radius: 50%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
}

.stream-bubble-burst-particles span:nth-child(1) { --ptx: -30px; --pty: -30px; }
.stream-bubble-burst-particles span:nth-child(2) { --ptx: 30px; --pty: -25px; }
.stream-bubble-burst-particles span:nth-child(3) { --ptx: -35px; --pty: 10px; }
.stream-bubble-burst-particles span:nth-child(4) { --ptx: 35px; --pty: 10px; }
.stream-bubble-burst-particles span:nth-child(5) { --ptx: -15px; --pty: 30px; }
.stream-bubble-burst-particles span:nth-child(6) { --ptx: 20px; --pty: 30px; }

@keyframes hydroRipple {
    0% {
        transform: scale(0.6);
        opacity: 0.85;
        border-color: rgba(0, 212, 179, 0.7);
        box-shadow: 0 0 20px rgba(0, 199, 175, 0.4), inset 0 0 10px rgba(0, 199, 175, 0.2);
    }
    40% {
        opacity: 0.5;
        border-color: rgba(0, 199, 175, 0.4);
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
        border-color: rgba(99, 102, 241, 0);
        box-shadow: 0 0 40px rgba(0, 199, 175, 0);
    }
}

@keyframes streamFloatUp {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.3) rotate(0deg);
    }
    15% {
        opacity: 1;
    }
}

@keyframes bubblePop {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1.5);
    }
    50% {
        transform: scale(1.35);
        opacity: 0.8;
        border-color: rgba(0, 240, 212, 1);
        filter: brightness(2);
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
        filter: brightness(3);
    }
}

@keyframes particleBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

@keyframes sparkleSpin {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.25); }
}

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

@keyframes fabPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 199, 175, 0.35); }
    50% { box-shadow: 0 8px 32px rgba(0, 199, 175, 0.15), 0 0 0 14px rgba(0, 199, 175, 0.06); }
}

/* ═══════════════════════════════════════
   CHAT WINDOW
   ═══════════════════════════════════════ */
#chatbot-window {
    position: fixed;
    bottom: 96px;
    z-index: 9999;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: var(--cb-font);

    /* Glassmorphism */
    background: var(--cb-bg-glass);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--cb-border-strong);
    border-radius: var(--cb-radius-lg);
    box-shadow: var(--cb-shadow);

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.92);
    transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.35s;
}

/* RTL: bottom-left / LTR: bottom-right */
[dir="rtl"] #chatbot-window { left: 24px; right: auto; }
[dir="ltr"] #chatbot-window { right: 24px; left: auto; }
#chatbot-window { left: 24px; right: auto; } /* default RTL */

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

/* ── Inner glow overlay ── */
#chatbot-window::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 120px;
    background: linear-gradient(180deg, rgba(0, 199, 175, 0.04) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
    border-radius: var(--cb-radius-lg) var(--cb-radius-lg) 0 0;
}

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */
.chatbot-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--cb-bg-header);
    border-bottom: 1px solid var(--cb-border-strong);
}

.chatbot-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(0, 199, 175, 0.1);
    border: 1px solid var(--cb-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    overflow: hidden;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 199, 175, 0.2);
}

.chatbot-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: inherit;
}

.chatbot-header-info {
    flex: 1;
    min-width: 0;
}

.chatbot-header-title {
    color: var(--cb-text);
    font-weight: 700;
    font-size: 15px;
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.chatbot-header-status {
    color: var(--cb-text-sec);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-header-status::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
    animation: statusBlink 2s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chatbot-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--cb-text-muted);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cb-text);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ═══════════════════════════════════════
   MESSAGES AREA
   ═══════════════════════════════════════ */
.chatbot-messages {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;

    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 199, 175, 0.15) transparent;
}
.chatbot-messages::-webkit-scrollbar { width: 5px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 199, 175, 0.15);
    border-radius: 10px;
}
.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 199, 175, 0.25);
}

/* ── Message Containers ── */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: msgAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

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

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

/* ── Avatar ── */
.chatbot-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: rgba(0, 199, 175, 0.12);
    border: 1px solid var(--cb-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
    overflow: hidden;
    padding: 3px;
}

/* ── Content wrapper ── */
.chatbot-msg-content {
    display: flex;
    flex-direction: column;
}

/* ── Message Bubbles ── */
.chatbot-msg-bubble {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
}

.chatbot-msg-bubble a {
    color: var(--cb-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* User bubble */
.chatbot-msg-user .chatbot-msg-bubble {
    background: var(--cb-bg-msg-user);
    color: #fff;
    border-radius: var(--cb-radius-md) var(--cb-radius-md) 6px var(--cb-radius-md);
    box-shadow: 0 4px 16px rgba(0, 199, 175, 0.2);
}
[dir="ltr"] .chatbot-msg-user .chatbot-msg-bubble {
    border-radius: var(--cb-radius-md) var(--cb-radius-md) var(--cb-radius-md) 6px;
}

/* Bot bubble */
.chatbot-msg-bot .chatbot-msg-bubble {
    background: var(--cb-bg-msg-bot);
    color: var(--cb-text);
    border: 1px solid var(--cb-border-strong);
    border-radius: var(--cb-radius-md) var(--cb-radius-md) var(--cb-radius-md) 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
[dir="ltr"] .chatbot-msg-bot .chatbot-msg-bubble {
    border-radius: var(--cb-radius-md) var(--cb-radius-md) 6px var(--cb-radius-md);
}

/* Welcome message special style */
.chatbot-msg-welcome .chatbot-msg-bubble {
    border-color: rgba(0, 199, 175, 0.25);
    background: linear-gradient(135deg, rgba(0, 199, 175, 0.08) 0%, rgba(18, 45, 50, 0.85) 100%);
}

/* ── Timestamp ── */
.chatbot-msg-time {
    font-size: 10.5px;
    color: var(--cb-text-muted);
    margin-top: 5px;
    padding: 0 6px;
}
.chatbot-msg-user .chatbot-msg-time { text-align: end; }

/* ═══════════════════════════════════════
   TYPING INDICATOR
   ═══════════════════════════════════════ */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    background: var(--cb-bg-msg-bot);
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-radius-md) var(--cb-radius-md) var(--cb-radius-md) 6px;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    background: var(--cb-accent);
    border-radius: 50%;
    opacity: 0.6;
    animation: typingDot 1.4s ease-in-out infinite both;
}
.chatbot-typing span:nth-child(1) { animation-delay: 0s; }
.chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }

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

/* ═══════════════════════════════════════
   INPUT AREA
   ═══════════════════════════════════════ */
.chatbot-input-area {
    position: relative;
    z-index: 2;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--cb-border-strong);
    background: rgba(8, 15, 18, 0.6);
}

/* Gradient top border */
.chatbot-input-area::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 199, 175, 0.3), transparent);
}

.chatbot-input-wrapper { flex: 1; }

#chatbot-input {
    width: 100%;
    background: var(--cb-bg-input);
    border: 1.5px solid var(--cb-border);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--cb-text);
    font-family: var(--cb-font);
    font-size: 14px;
    outline: none;
    transition: all 0.25s ease;
}
#chatbot-input:focus {
    background: var(--cb-bg-input-focus);
    border-color: rgba(0, 199, 175, 0.45);
    box-shadow: 0 0 0 3px rgba(0, 199, 175, 0.15);
}
#chatbot-input::placeholder {
    color: var(--cb-text-muted);
    font-size: 13px;
}

#chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #00d4b3 0%, #009f8b 100%);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 3px 12px rgba(0, 199, 175, 0.25);
}
#chatbot-send:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 199, 175, 0.35);
}
#chatbot-send:active {
    transform: scale(0.96);
}

[dir="rtl"] #chatbot-send i { transform: rotate(180deg); }

/* ═══════════════════════════════════════
   LEAD COLLECTION FORM
   ═══════════════════════════════════════ */
.chatbot-lead-form {
    background: linear-gradient(135deg, rgba(0, 199, 175, 0.06) 0%, rgba(18, 45, 50, 0.8) 100%);
    border: 1px solid var(--cb-border-strong);
    border-radius: var(--cb-radius-sm);
    padding: 18px;
    margin-top: 6px;
}

.chatbot-lead-prompt {
    color: var(--cb-text);
    font-size: 13px;
    margin: 0 0 14px 0;
    line-height: 1.6;
    font-weight: 500;
}

.chatbot-lead-field {
    margin-bottom: 12px;
}
.chatbot-lead-field label {
    display: block;
    color: var(--cb-text-sec);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}
.chatbot-lead-field input {
    width: 100%;
    background: var(--cb-bg-input);
    border: 1.5px solid var(--cb-border);
    border-radius: var(--cb-radius-sm);
    padding: 10px 14px;
    color: var(--cb-text);
    font-size: 14px;
    outline: none;
    font-family: var(--cb-font);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chatbot-lead-field input:focus {
    border-color: rgba(0, 199, 175, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 199, 175, 0.08);
}

.chatbot-lead-submit {
    width: 100%;
    background: linear-gradient(135deg, #00d4b3 0%, #009f8b 100%);
    color: #fff;
    border: none;
    border-radius: var(--cb-radius-sm);
    padding: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--cb-font);
    transition: all 0.25s;
    box-shadow: 0 3px 12px rgba(0, 199, 175, 0.2);
}
.chatbot-lead-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 199, 175, 0.3);
}

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */
@keyframes msgAppear {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

/* ═══════════════════════════════════════
   QUICK REPLY CHIPS
   ═══════════════════════════════════════ */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 2px 0;
    animation: msgAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

.chatbot-quick-chip {
    background: var(--cb-accent-soft);
    color: var(--cb-accent);
    border: 1.5px solid rgba(0, 199, 175, 0.2);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-family: var(--cb-font);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    line-height: 1.3;
}

.chatbot-quick-chip:hover {
    background: rgba(0, 199, 175, 0.15);
    border-color: var(--cb-accent);
    color: var(--cb-text);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0, 199, 175, 0.15);
}

.chatbot-quick-chip:active {
    transform: translateY(0) scale(0.97);
}

/* Welcome Quick Action chips — slightly larger */
.chatbot-welcome-chip {
    padding: 10px 18px;
    font-weight: 600;
    font-size: 13.5px;
}

/* ═══════════════════════════════════════
   AUTO-SAVED LEAD BANNER
   ═══════════════════════════════════════ */
.chatbot-auto-saved-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(0, 199, 175, 0.08) 100%);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: var(--cb-radius-sm);
    color: #4ade80;
    font-size: 13px;
    font-family: var(--cb-font);
    animation: msgAppear 0.4s ease forwards;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.chatbot-auto-saved-banner i {
    font-size: 16px;
    color: #22c55e;
}

.chatbot-banner-fade {
    opacity: 0 !important;
}

/* ═══════════════════════════════════════
   STATUS TYPING INDICATOR
   ═══════════════════════════════════════ */
.chatbot-status-typing {
    color: var(--cb-accent) !important;
    font-weight: 600;
}

.chatbot-header-status.chatbot-status-typing::before {
    background: var(--cb-accent);
    animation: typingDot 0.8s ease-in-out infinite alternate;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

/* Tablet */
@media (max-width: 768px) {
    #chatbot-window {
        width: 360px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    #chatbot-window {
        position: fixed;
        top: 0;
        left: 0 !important;
        right: 0 !important;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    #chatbot-window.active {
        transform: translateY(0) scale(1);
    }

    .chatbot-header {
        padding: 14px 16px;
    }

    .chatbot-messages {
        padding: 16px 12px;
    }

    .chatbot-input-area {
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    #chatbot-fab {
        bottom: 20px;
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
    [dir="rtl"] #chatbot-fab {
        left: 16px;
        right: auto;
    }
    [dir="ltr"] #chatbot-fab {
        right: 16px;
        left: auto;
    }

    #chatbot-fab.active {
        display: none;
    }

    .chatbot-quick-chip {
        padding: 7px 12px;
        font-size: 12px;
    }
}

/* ═══════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    #chatbot-fab {
        animation: none;
    }

    #chatbot-window {
        transition: opacity 0.15s ease, visibility 0.15s;
        transform: none !important;
    }

    #chatbot-window.active {
        transform: none !important;
    }

    .chatbot-msg {
        animation: none;
        opacity: 1;
    }

    .chatbot-quick-replies {
        animation: none;
        opacity: 1;
    }

    .chatbot-auto-saved-banner {
        animation: none;
        opacity: 1;
    }

    .chatbot-header-status::before {
        animation: none;
    }

    .chatbot-typing span {
        animation: none;
        opacity: 0.7;
    }

    .chatbot-quick-chip:hover,
    #chatbot-send:hover,
    #chatbot-fab:hover {
        transform: none;
    }
}

/* ═══════════════════════════════════════
   PRINT — HIDE WIDGET
   ═══════════════════════════════════════ */
@media print {
    #chatbot-fab,
    #chatbot-window {
        display: none !important;
    }
}
