/* ============================================
   WGP AI Chat Widget - Premium Design
   Animated Avatar | Mobile-First | Glassmorphism
   ============================================ */

.wgp-chat * { box-sizing: border-box; margin: 0; padding: 0; }

/* ========== FULL AI AVATAR ========== */
.wgp-avatar {
    position: relative;
    display: flex; align-items: center; justify-content: center;
}

/* --- Head (main container) --- */
.wgp-avatar-head {
    position: relative;
    width: 48px; height: 48px;
    border-radius: 50% 50% 44% 44%;
    background: linear-gradient(160deg, #e8e0f7, #c9bdf0, #a78bfa);
    box-shadow:
        inset 0 3px 6px rgba(255,255,255,0.7),
        inset 0 -3px 6px rgba(0,0,0,0.1),
        0 4px 12px rgba(139,92,246,0.25),
        0 8px 24px rgba(139,92,246,0.12);
    z-index: 2;
}
/* metallic shine */
.wgp-avatar-head::before {
    content: '';
    position: absolute;
    top: 3px; left: 6px; right: 6px; height: 40%;
    border-radius: 50% 50% 40% 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.6) 0%, transparent 100%);
    pointer-events: none;
}

/* --- Visor (face plate) --- */
.wgp-avatar-visor {
    position: absolute;
    top: 38%; left: 50%; transform: translate(-50%, -50%);
    width: 72%; height: 36%;
    border-radius: 20px;
    background: linear-gradient(180deg, #0c1929 0%, #111d33 60%, #0d1f36 100%);
    box-shadow:
        inset 0 2px 6px rgba(0,0,0,0.6),
        inset 0 -1px 3px rgba(0,212,255,0.1),
        0 0 12px rgba(0,212,255,0.15);
    display: flex; align-items: center; justify-content: center; gap: 22%;
    z-index: 3;
}
/* visor glass reflection */
.wgp-avatar-visor::before {
    content: '';
    position: absolute; top: 2px; left: 10%; right: 10%; height: 35%;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
    pointer-events: none;
}

/* --- LED Eyes --- */
.wgp-avatar-eye {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #a5f3fc, #22d3ee 40%, #0891b2 80%);
    box-shadow:
        0 0 4px rgba(34,211,238,0.9),
        0 0 10px rgba(34,211,238,0.5),
        0 0 20px rgba(34,211,238,0.25);
    animation: wgpLedPulse 3s ease-in-out infinite, wgpBlink 4.5s ease-in-out infinite;
    position: relative;
}
/* eye shine */
.wgp-avatar-eye::before {
    content: '';
    position: absolute;
    width: 35%; height: 35%;
    background: #fff;
    border-radius: 50%;
    top: 12%; left: 15%;
}
/* eye ring */
.wgp-avatar-eye::after {
    content: '';
    position: absolute; inset: -2.5px;
    border-radius: 50%;
    border: 1.5px solid rgba(34,211,238,0.2);
    animation: wgpRingBreathe 3s ease-in-out infinite;
}

/* --- Mouth (LED strip) --- */
.wgp-avatar-mouth {
    position: absolute;
    bottom: 12%; left: 50%; transform: translateX(-50%);
    width: 16px; height: 2.5px;
    border-radius: 3px;
    background: linear-gradient(90deg, #22d3ee, #a78bfa, #f472b6);
    box-shadow: 0 0 5px rgba(34,211,238,0.5), 0 0 10px rgba(167,139,250,0.3);
    animation: wgpMouthShimmer 2.5s ease-in-out infinite;
}

/* --- Antenna --- */
.wgp-avatar-antenna {
    position: absolute;
    top: -7px; left: 50%; transform: translateX(-50%);
    width: 2px; height: 10px;
    background: linear-gradient(to top, #a78bfa, #7c3aed);
    border-radius: 2px;
    z-index: 10;
}
.wgp-avatar-antenna::before {
    content: '';
    position: absolute;
    top: -6px; left: 50%; transform: translateX(-50%);
    width: 10px; height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle, #f472b6 20%, #a78bfa 60%, transparent 100%);
    box-shadow: 0 0 10px rgba(244,114,182,0.7), 0 0 20px rgba(167,139,250,0.4);
    animation: wgpOrbGlow 2s ease-in-out infinite;
}
/* antenna ring */
.wgp-avatar-antenna::after {
    content: '';
    position: absolute;
    top: -10px; left: 50%; transform: translateX(-50%);
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 1.5px solid rgba(244,114,182,0.15);
    animation: wgpOrbRing 2s ease-in-out infinite;
}

/* --- Aura (outer glow) --- */
.wgp-avatar-aura {
    position: absolute; inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34,211,238,0.08) 0%, rgba(167,139,250,0.05) 40%, transparent 70%);
    animation: wgpAuraPulse 3.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* --- Ear accents --- */
.wgp-avatar-head::after {
    content: '';
    position: absolute;
    top: 50%; transform: translateY(-50%);
    right: -4px;
    width: 6px; height: 12px;
    border-radius: 3px;
    background: linear-gradient(180deg, #c4b5fd, #8b5cf6);
    box-shadow: -42px 0 0 0 #c4b5fd, -42px 0 4px rgba(139,92,246,0.2);
}

/* ========== SIZE VARIANTS ========== */
/* xs - typing indicator, chat messages */
.wgp-avatar.xs .wgp-avatar-head { width: 26px; height: 26px; }
.wgp-avatar.xs .wgp-avatar-visor { width: 68%; height: 34%; gap: 20%; }
.wgp-avatar.xs .wgp-avatar-eye { width: 5px; height: 5px; }
.wgp-avatar.xs .wgp-avatar-eye::after { inset: -1.5px; border-width: 1px; }
.wgp-avatar.xs .wgp-avatar-mouth { width: 9px; height: 1.5px; bottom: 10%; }
.wgp-avatar.xs .wgp-avatar-head::after { display: none; }
.wgp-avatar.xs .wgp-avatar-antenna { display: none; }

/* sm - floating bubble */
.wgp-avatar.sm .wgp-avatar-head { width: 34px; height: 34px; }
.wgp-avatar.sm .wgp-avatar-visor { width: 70%; height: 35%; gap: 21%; }
.wgp-avatar.sm .wgp-avatar-eye { width: 6px; height: 6px; }
.wgp-avatar.sm .wgp-avatar-eye::after { inset: -2px; }
.wgp-avatar.sm .wgp-avatar-mouth { width: 11px; height: 2px; }
.wgp-avatar.sm .wgp-avatar-head::after { right: -3px; width: 4px; height: 9px; box-shadow: -30px 0 0 0 #c4b5fd; }
.wgp-avatar.sm .wgp-avatar-antenna { display: none; }

/* md - header */
.wgp-avatar.md .wgp-avatar-head { width: 40px; height: 40px; }
.wgp-avatar.md .wgp-avatar-visor { width: 71%; height: 35%; gap: 22%; }
.wgp-avatar.md .wgp-avatar-eye { width: 7px; height: 7px; }
.wgp-avatar.md .wgp-avatar-eye::after { inset: -2px; }
.wgp-avatar.md .wgp-avatar-mouth { width: 13px; height: 2.5px; }
.wgp-avatar.md .wgp-avatar-head::after { right: -3px; width: 5px; height: 10px; box-shadow: -34px 0 0 0 #c4b5fd; }
.wgp-avatar.md .wgp-avatar-antenna { top: -6px; height: 8px; }
.wgp-avatar.md .wgp-avatar-antenna::before { width: 8px; height: 8px; top: -5px; }
.wgp-avatar.md .wgp-avatar-antenna::after { width: 14px; height: 14px; top: -8px; }

/* lg - welcome card */
.wgp-avatar.lg .wgp-avatar-head { width: 64px; height: 64px; }
.wgp-avatar.lg .wgp-avatar-visor { width: 72%; height: 36%; gap: 23%; }
.wgp-avatar.lg .wgp-avatar-eye { width: 10px; height: 10px; }
.wgp-avatar.lg .wgp-avatar-eye::after { inset: -3px; border-width: 2px; }
.wgp-avatar.lg .wgp-avatar-mouth { width: 20px; height: 3px; }
.wgp-avatar.lg .wgp-avatar-head::after { right: -5px; width: 7px; height: 14px; box-shadow: -54px 0 0 0 #c4b5fd; }
.wgp-avatar.lg .wgp-avatar-antenna { top: -9px; height: 12px; }
.wgp-avatar.lg .wgp-avatar-antenna::before { width: 12px; height: 12px; top: -6px; }
.wgp-avatar.lg .wgp-avatar-antenna::after { width: 22px; height: 22px; top: -12px; }
.wgp-avatar.lg .wgp-avatar-aura { inset: -14px; }

/* ========== KEYFRAMES ========== */
@keyframes wgpBlink {
    0%, 93%, 100% { transform: scaleY(1); }
    96% { transform: scaleY(0.06); }
}
@keyframes wgpLedPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(34,211,238,0.9), 0 0 10px rgba(34,211,238,0.5), 0 0 20px rgba(34,211,238,0.25); }
    50% { box-shadow: 0 0 6px rgba(34,211,238,1), 0 0 14px rgba(34,211,238,0.7), 0 0 28px rgba(34,211,238,0.35); }
}
@keyframes wgpRingBreathe {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.25); opacity: 0.08; }
}
@keyframes wgpMouthShimmer {
    0%, 100% { opacity: 0.75; box-shadow: 0 0 4px rgba(34,211,238,0.4); }
    50% { opacity: 1; box-shadow: 0 0 8px rgba(34,211,238,0.7), 0 0 14px rgba(167,139,250,0.4); }
}
@keyframes wgpOrbGlow {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.75; }
    50% { transform: translateX(-50%) scale(1.35); opacity: 1; }
}
@keyframes wgpOrbRing {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.5; }
    50% { transform: translateX(-50%) scale(1.4); opacity: 0; }
}
@keyframes wgpAuraPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.1); }
}

/* ========== FLOATING BUBBLE ========== */
.wgp-chat-bubble {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 66px; height: 66px;
    border-radius: 50%;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1), box-shadow 0.3s;
    animation: wgpBubbleFloat 3s ease-in-out infinite;
    /* Multi-layer gradient */
    background: linear-gradient(135deg, #F0065C 0%, #c73a8a 30%, #8B5CF6 70%, #6d28d9 100%);
    box-shadow:
        0 4px 16px rgba(240, 6, 92, 0.35),
        0 8px 32px rgba(139, 92, 246, 0.2),
        inset 0 1px 2px rgba(255,255,255,0.2);
}
.wgp-chat-bubble::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
}
.wgp-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow:
        0 6px 24px rgba(240, 6, 92, 0.45),
        0 12px 40px rgba(139, 92, 246, 0.3),
        inset 0 1px 2px rgba(255,255,255,0.2);
}
.wgp-chat-bubble.open { animation: none; transform: scale(1); }

.wgp-chat-bubble-avatar {
    position: relative; z-index: 2;
}

/* Glow rings */
.wgp-chat-bubble-ring {
    position: absolute; inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(0,212,255,0.25);
    animation: wgpRingPulse 2.5s ease-in-out infinite;
}
.wgp-chat-bubble-ring::before {
    content: '';
    position: absolute; inset: -6px;
    border-radius: 50%;
    border: 1.5px solid rgba(240,6,92,0.15);
    animation: wgpRingPulse 2.5s ease-in-out infinite 0.5s;
}
.wgp-chat-bubble.open .wgp-chat-bubble-ring { animation: none; opacity: 0; }

@keyframes wgpBubbleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
@keyframes wgpRingPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 0; }
}

.wgp-chat-badge {
    position: absolute; top: -2px; right: -2px;
    min-width: 22px; height: 22px;
    background: #22c55e;
    border-radius: 11px;
    border: 2.5px solid #fff;
    display: none;
    align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    padding: 0 5px;
    animation: wgpBadgePop 0.3s cubic-bezier(.4,0,.2,1);
}
.wgp-chat-badge.show { display: flex; }
@keyframes wgpBadgePop { from { transform: scale(0); } to { transform: scale(1); } }

/* ========== NOTIFICATION POPUP ========== */
.wgp-chat-notify {
    position: fixed;
    bottom: 100px; right: 24px;
    width: 320px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    padding: 14px;
    display: flex; align-items: center; gap: 12px;
    z-index: 99998;
    opacity: 0; transform: translateY(12px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(.4,0,.2,1);
}
.wgp-chat-notify.show {
    opacity: 1; transform: translateY(0) scale(1);
    pointer-events: auto;
}
.wgp-chat-notify-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F0065C, #8B5CF6);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.wgp-chat-notify-avatar .wgp-chat-bot-face { width: 34px; height: 34px; background: linear-gradient(135deg, #fff, #f0edff); }
.wgp-chat-notify-avatar .wgp-chat-bot-eye { width: 5px; height: 5px; }
.wgp-chat-notify-avatar .wgp-chat-bot-eyes { gap: 5px; }
.wgp-chat-notify-avatar .wgp-chat-bot-mouth { bottom: 9px; width: 7px; height: 3px; }

.wgp-chat-notify-text { flex: 1; font-size: 13px; color: #374151; line-height: 1.4; }
.wgp-chat-notify-text strong { display: block; font-size: 13px; color: #071126; margin-bottom: 2px; }

.wgp-chat-notify-typing { display: inline-flex; gap: 2px; margin-left: 4px; vertical-align: middle; }
.wgp-chat-notify-typing span {
    width: 4px; height: 4px; border-radius: 50%;
    background: #8B5CF6;
    animation: wgpTyping 1.2s ease-in-out infinite;
}
.wgp-chat-notify-typing span:nth-child(2) { animation-delay: 0.15s; }
.wgp-chat-notify-typing span:nth-child(3) { animation-delay: 0.3s; }

.wgp-chat-notify-close {
    background: none; border: none; cursor: pointer;
    font-size: 18px; color: #9ca3af; padding: 4px;
    line-height: 1; flex-shrink: 0;
    transition: color 0.2s;
}
.wgp-chat-notify-close:hover { color: #475569; }

/* ========== CHAT WINDOW ========== */
.wgp-chat-window {
    position: fixed;
    bottom: 96px; right: 24px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.03);
    display: flex; flex-direction: column;
    overflow: hidden;
    z-index: 99998;
    opacity: 0;
    transform: translateY(20px) scale(0.92);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(.4,0,.2,1);
}
.wgp-chat-window.visible {
    opacity: 1; transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ========== HEADER ========== */
.wgp-chat-header {
    background: linear-gradient(135deg, #F0065C 0%, #8B5CF6 100%);
    padding: 14px 16px;
    display: flex; align-items: center; gap: 12px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.wgp-chat-header::before {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.wgp-chat-header-back {
    display: none;
    background: rgba(255,255,255,0.15); border: none;
    width: 32px; height: 32px; border-radius: 8px;
    cursor: pointer; align-items: center; justify-content: center;
    transition: background 0.2s; position: relative; z-index: 1;
}
.wgp-chat-header-back svg { width: 18px; height: 18px; stroke: #fff; fill: none; }

.wgp-chat-header-avatar {
    position: relative; z-index: 1; flex-shrink: 0;
}
.wgp-chat-online-dot {
    position: absolute; bottom: 0; right: 0;
    width: 12px; height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2.5px solid rgba(240, 6, 92, 1);
}

.wgp-chat-header-info {
    flex: 1; position: relative; z-index: 1;
}
.wgp-chat-header-info h3 {
    color: #fff; font-size: 15px; font-weight: 700;
    margin: 0; line-height: 1.2;
}
.wgp-chat-header-info p {
    color: rgba(255,255,255,0.8); font-size: 11.5px;
    margin: 2px 0 0; display: flex; align-items: center; gap: 5px;
}
.wgp-chat-status-dot {
    width: 7px; height: 7px;
    background: #22c55e; border-radius: 50%;
    display: inline-block;
    animation: wgpStatusPulse 2s ease infinite;
}
@keyframes wgpStatusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.wgp-chat-header-close {
    background: rgba(255,255,255,0.15); border: none;
    width: 32px; height: 32px; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s; position: relative; z-index: 1;
}
.wgp-chat-header-close:hover { background: rgba(255,255,255,0.25); }
.wgp-chat-header-close svg { width: 16px; height: 16px; }

/* ========== WELCOME CARD ========== */
.wgp-chat-welcome-card {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 28px 20px 16px;
}
.wgp-chat-welcome-avatar {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(240,6,92,0.08), rgba(139,92,246,0.08));
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
    animation: wgpWelcomeBounce 0.5s cubic-bezier(.4,0,.2,1);
}
@keyframes wgpWelcomeBounce { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.wgp-chat-welcome-card h4 {
    font-size: 15px; font-weight: 700; color: #071126; margin: 0 0 4px;
}
.wgp-chat-welcome-card p {
    font-size: 12.5px; color: #64748b; margin: 0; line-height: 1.4;
}

/* ========== MESSAGES ========== */
.wgp-chat-messages {
    flex: 1; overflow-y: auto;
    padding: 12px 14px;
    display: flex; flex-direction: column; gap: 6px;
    background: #f8f9fc;
    scroll-behavior: smooth;
}
.wgp-chat-messages::-webkit-scrollbar { width: 4px; }
.wgp-chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.wgp-chat-msg {
    max-width: 82%;
    animation: wgpMsgIn 0.3s cubic-bezier(.4,0,.2,1);
}
@keyframes wgpMsgIn { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.wgp-chat-msg.ai { align-self: flex-start; display: flex; gap: 6px; align-items: flex-end; }
.wgp-chat-msg.visitor { align-self: flex-end; }
.wgp-chat-msg.system { align-self: center; max-width: 90%; }

.wgp-chat-msg-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, #F0065C, #8B5CF6);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.wgp-chat-msg-avatar .wgp-chat-bot-face { width: 22px; height: 22px; background: #fff; }
.wgp-chat-msg-avatar .wgp-chat-bot-eye { width: 3px; height: 3px; }
.wgp-chat-msg-avatar .wgp-chat-bot-eyes { gap: 3px; top: -1px; }
.wgp-chat-msg-avatar .wgp-chat-bot-mouth { bottom: 6px; width: 4px; height: 2px; border-bottom-width: 1px; }

.wgp-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px; line-height: 1.55;
    word-break: break-word;
    position: relative;
}
.wgp-chat-msg.ai .wgp-chat-msg-bubble {
    background: #fff; color: #1e293b;
    border: 1px solid #eef0f4;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.wgp-chat-msg.visitor .wgp-chat-msg-bubble {
    background: linear-gradient(135deg, #F0065C, #8B5CF6);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(240,6,92,0.2);
}
.wgp-chat-msg.system .wgp-chat-msg-bubble {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    color: #166534; border: 1px solid #bbf7d0;
    font-size: 12px; text-align: center;
    border-radius: 10px;
}

.wgp-chat-msg-time {
    font-size: 10px; color: #9ca3af;
    margin-top: 3px; padding: 0 4px;
}
.wgp-chat-msg.ai .wgp-chat-msg-time { padding-left: 32px; }
.wgp-chat-msg.visitor .wgp-chat-msg-time { text-align: right; }

/* ========== TYPING INDICATOR ========== */
.wgp-chat-typing {
    display: none; align-self: flex-start;
    padding: 0 14px 4px;
    gap: 6px; align-items: flex-end;
}
.wgp-chat-typing.show { display: flex; }

.wgp-chat-typing-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, #F0065C, #8B5CF6);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wgp-chat-typing-avatar .wgp-chat-bot-face { width: 22px; height: 22px; background: #fff; }
.wgp-chat-typing-avatar .wgp-chat-bot-eye { width: 3px; height: 3px; }
.wgp-chat-typing-avatar .wgp-chat-bot-eyes { gap: 3px; top: -1px; }
.wgp-chat-typing-avatar .wgp-chat-bot-mouth { bottom: 6px; width: 4px; height: 2px; border-bottom-width: 1px; }

.wgp-chat-typing-bubble {
    background: #fff; border: 1px solid #eef0f4;
    border-radius: 16px; border-bottom-left-radius: 6px;
    padding: 10px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.wgp-chat-typing-dots { display: flex; gap: 4px; }
.wgp-chat-typing-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: #9ca3af;
    animation: wgpTyping 1.2s ease-in-out infinite;
}
.wgp-chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.wgp-chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wgpTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ========== QUICK REPLIES ========== */
.wgp-chat-quick-replies {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 8px 14px;
    background: #f8f9fc;
    border-top: 1px solid #f1f5f9;
}
.wgp-chat-quick-btn {
    padding: 7px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    font-size: 12px; font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: flex; align-items: center; gap: 5px;
    white-space: nowrap;
}
.wgp-chat-quick-btn svg { opacity: 0.6; }
.wgp-chat-quick-btn:hover {
    background: linear-gradient(135deg, rgba(240,6,92,0.06), rgba(139,92,246,0.06));
    border-color: #8B5CF6; color: #8B5CF6;
    transform: translateY(-1px);
}
.wgp-chat-quick-btn:hover svg { opacity: 1; stroke: #8B5CF6; }

/* ========== LEAD FORM ========== */
.wgp-chat-lead-form {
    display: none; padding: 16px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    animation: wgpSlideUp 0.3s ease;
}
.wgp-chat-lead-form.show { display: block; }
@keyframes wgpSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.wgp-chat-lead-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px;
}
.wgp-chat-lead-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(240,6,92,0.06));
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wgp-chat-lead-header h4 { font-size: 14px; font-weight: 700; color: #071126; margin: 0; }
.wgp-chat-lead-header p { font-size: 12px; color: #64748b; margin: 2px 0 0; }

.wgp-chat-lead-field { margin-bottom: 10px; }
.wgp-chat-lead-field label {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 5px;
}
.wgp-chat-optional { color: #9ca3af; font-weight: 400; }

.wgp-chat-lead-field input,
.wgp-chat-lead-field select {
    width: 100%; padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px; color: #1e293b;
    background: #fafbfc;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}
.wgp-chat-lead-field input:focus,
.wgp-chat-lead-field select:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139,92,246,0.08);
    background: #fff;
}

.wgp-chat-phone-wrap {
    display: flex; gap: 0;
}
.wgp-chat-phone-prefix {
    padding: 10px 10px;
    background: #f1f5f9;
    border: 1.5px solid #e5e7eb;
    border-right: none;
    border-radius: 10px 0 0 10px;
    font-size: 13px; font-weight: 600; color: #475569;
}
.wgp-chat-phone-wrap input {
    border-radius: 0 10px 10px 0 !important;
}

.wgp-chat-lead-submit {
    width: 100%; padding: 12px;
    border: none; border-radius: 12px;
    background: linear-gradient(135deg, #F0065C, #8B5CF6);
    color: #fff; font-size: 14px; font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    position: relative;
    box-shadow: 0 4px 14px rgba(240,6,92,0.25);
}
.wgp-chat-lead-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(240,6,92,0.35);
}
.wgp-chat-lead-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.wgp-chat-lead-submit-loader { display: none; }
.wgp-chat-lead-submit.loading .wgp-chat-lead-submit-text { display: none; }
.wgp-chat-lead-submit.loading .wgp-chat-lead-submit-loader { display: block; }

.wgp-chat-lead-success {
    display: none; text-align: center;
    padding: 28px 16px;
    animation: wgpSlideUp 0.4s ease;
}
.wgp-chat-lead-success.show { display: block; }
.wgp-chat-success-check { margin-bottom: 12px; }
.wgp-chat-success-check svg { animation: wgpCheckPop 0.4s cubic-bezier(.4,0,.2,1); }
@keyframes wgpCheckPop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.wgp-chat-lead-success h4 { font-size: 16px; font-weight: 700; color: #166534; margin: 0 0 4px; }
.wgp-chat-lead-success p { font-size: 13px; color: #64748b; margin: 0 0 10px; }
.wgp-chat-success-ref {
    display: inline-block;
    padding: 5px 14px; border-radius: 8px;
    background: #f0fdf4; border: 1px solid #bbf7d0;
    font-size: 12px; font-weight: 700; color: #166534;
}

/* ========== INPUT AREA ========== */
.wgp-chat-input-area {
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #f1f5f9;
    display: flex; gap: 8px; align-items: flex-end;
    flex-shrink: 0;
}
.wgp-chat-input-wrap {
    flex: 1; position: relative;
}
.wgp-chat-input {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    font-size: 13.5px; color: #1e293b;
    outline: none; resize: none;
    font-family: inherit; line-height: 1.4;
    max-height: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafbfc;
}
.wgp-chat-input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139,92,246,0.06);
    background: #fff;
}
.wgp-chat-input::placeholder { color: #9ca3af; }

.wgp-chat-send {
    width: 42px; height: 42px;
    border: none; border-radius: 14px;
    background: linear-gradient(135deg, #F0065C, #8B5CF6);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(240,6,92,0.25);
}
.wgp-chat-send:hover {
    transform: scale(1.06);
    box-shadow: 0 5px 16px rgba(240,6,92,0.35);
}
.wgp-chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.wgp-chat-send svg { width: 18px; height: 18px; }

/* ========== POWERED BY ========== */
.wgp-chat-powered {
    text-align: center; padding: 5px;
    background: #fff; border-top: 1px solid #f8f9fc;
    flex-shrink: 0;
}
.wgp-chat-powered span { font-size: 10px; color: #b0b8c4; }
.wgp-chat-powered a { color: #8B5CF6; text-decoration: none; font-weight: 600; }

/* ========== MOBILE (Full Screen) ========== */
@media (max-width: 480px) {
    .wgp-chat-notify {
        right: 12px; left: 12px;
        width: auto; bottom: 90px;
    }
    .wgp-chat-bubble { bottom: 16px; right: 16px; width: 58px; height: 58px; }

    .wgp-chat-window {
        position: fixed;
        inset: 0;
        width: 100%; height: 100%;
        max-height: 100vh;
        border-radius: 0;
        bottom: 0; right: 0;
    }
    .wgp-chat-header-back { display: flex; }
    .wgp-chat-header { padding: 12px 14px; }

    .wgp-chat-welcome-card { padding: 24px 16px 12px; }
    .wgp-chat-welcome-avatar { width: 60px; height: 60px; }
    .wgp-chat-welcome-avatar .wgp-chat-bot-face { width: 50px; height: 50px; }

    .wgp-chat-messages { padding: 10px 12px; }
    .wgp-chat-quick-replies { padding: 6px 12px; }
    .wgp-chat-lead-form { padding: 14px 12px; }
    .wgp-chat-input-area { padding: 8px 10px; }

    .wgp-chat-msg { max-width: 88%; }
}

@media (max-width: 360px) {
    .wgp-chat-quick-btn { padding: 6px 10px; font-size: 11px; }
    .wgp-chat-lead-field input,
    .wgp-chat-lead-field select { padding: 9px 10px; font-size: 12px; }
}


