/* VIP WhatsApp Hybrid Chat Widget */
:root {
    --vip-wa-color: #1a3c5e;
}

.vip-wa-widget {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Ensure sizing behaves predictably across themes */
.vip-wa-widget, .vip-wa-widget * {
    box-sizing: border-box;
}

.vip-wa-right { right: 20px; }
.vip-wa-left { left: 20px; }

/* Toggle Button */
.vip-wa-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--vip-wa-color);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}
.vip-wa-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,0.35);
}
.vip-wa-toggle.active {
    background: #e74c3c;
}

.vip-wa-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Chat Window */
.vip-wa-window {
    position: absolute;
    bottom: 76px;
    width: 380px;
    max-height: 520px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: vipWaSlideUp 0.3s ease;
}
.vip-wa-right .vip-wa-window { right: 0; }
.vip-wa-left .vip-wa-window { left: 0; }

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

/* Header */
.vip-wa-header {
    background: var(--vip-wa-color);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.vip-wa-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.vip-wa-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}
.vip-wa-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    border: 2px solid rgba(255,255,255,0.3);
}
.vip-wa-header-name {
    font-weight: 600;
    font-size: 15px;
}
.vip-wa-header-status {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 5px;
}
.vip-wa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}
.vip-wa-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    line-height: 1;
    transition: background 0.2s;
}
.vip-wa-close:hover {
    background: rgba(255,255,255,0.15);
}

/* Channel indicator icon in header */
.vip-wa-channel-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    opacity: 0.8;
}
.vip-wa-channel-icon svg {
    width: 14px;
    height: 14px;
}

/* Pre-chat Form */
.vip-wa-prechat {
    padding: 24px 18px;
    flex: 1;
    overflow-y: auto;
}
.vip-wa-prechat-greeting {
    font-size: 15px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.6;
    padding: 14px;
    background: #f0f4f8;
    border-radius: 12px;
}
.vip-wa-prechat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.vip-wa-input {
    padding: 12px 14px;
    border: 1.5px solid #dce3ea;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.vip-wa-input:focus {
    border-color: var(--vip-wa-color);
}
.vip-wa-btn-start {
    padding: 12px;
    background: var(--vip-wa-color);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    font-family: inherit;
}
.vip-wa-btn-start:hover {
    opacity: 0.9;
}

/* Service selection buttons */
.vip-wa-service-btn {
    display: block;
    width: 100%;
    padding: 14px 16px;
    background: #fff;
    border: 1.5px solid #dce3ea;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-family: inherit;
    color: #333;
    margin-bottom: 8px;
}
.vip-wa-service-btn:hover {
    border-color: var(--vip-wa-color);
    background: #f0f4f8;
    transform: translateY(-1px);
}
.vip-wa-service-btn:active {
    transform: translateY(0);
}

/* Talk to Agent button */
.vip-wa-talk-agent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    white-space: nowrap;
    font-family: inherit;
}
.vip-wa-talk-agent:hover {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #4caf50;
}

/* WhatsApp redirect button */
.vip-wa-whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
    margin-top: 6px;
    font-family: inherit;
}
.vip-wa-whatsapp-btn:hover {
    opacity: 0.9;
    color: #fff;
}
.vip-wa-whatsapp-btn svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}
.vip-wa-or-divider {
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 12px 0;
    position: relative;
}
.vip-wa-or-divider::before,
.vip-wa-or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #dce3ea;
}
.vip-wa-or-divider::before { left: 0; }
.vip-wa-or-divider::after { right: 0; }

/* Messages */
.vip-wa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    background: #f8fafb;
    max-height: 320px;
    min-height: 200px;
}
.vip-wa-messages-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.vip-wa-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    animation: vipWaMsgIn 0.2s ease;
}
@keyframes vipWaMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.vip-wa-msg-visitor {
    background: var(--vip-wa-color);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.vip-wa-msg-agent {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e8ecf0;
    border-bottom-left-radius: 4px;
}
.vip-wa-msg-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}
.vip-wa-msg-greeting {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e8ecf0;
    border-bottom-left-radius: 4px;
    font-style: italic;
}

/* Typing indicator */
.vip-wa-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
}
.vip-wa-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #bbb;
    animation: vipWaTyping 1.4s infinite;
}
.vip-wa-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.vip-wa-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes vipWaTyping {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* Input Area */
.vip-wa-input-area {
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #eef1f4;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}
.vip-wa-message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #dce3ea;
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 80px;
    font-family: inherit;
    line-height: 1.4;
    transition: border-color 0.2s;
}
.vip-wa-message-input:focus {
    border-color: var(--vip-wa-color);
}
.vip-wa-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--vip-wa-color);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.vip-wa-send-btn:hover {
    opacity: 0.85;
}

/* Book now CTA button inside messages */
.vip-wa-cta {
    margin-top: 10px;
}
.vip-wa-book-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--vip-wa-color);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
}
.vip-wa-book-btn:hover {
    opacity: 0.9;
}

/* Mobile responsive */
@media (max-width: 480px) {
    /* On small screens, detach the window from the small fixed “widget” box.
       Use a fixed panel so it never renders off-screen. */
    .vip-wa-window {
        position: fixed;
        width: auto;
        max-width: none;
        left: 12px !important;
        right: 12px !important;
        bottom: 78px;
        max-height: 70vh;
        border-radius: 14px;
    }
    .vip-wa-right .vip-wa-window,
    .vip-wa-left .vip-wa-window {
        left: 12px !important;
        right: 12px !important;
    }
    .vip-wa-toggle {
        width: 54px;
        height: 54px;
    }
    .vip-wa-widget {
        bottom: 16px;
    }
    .vip-wa-right { right: 16px; }
    .vip-wa-left { left: 16px; }
}
