/* ==========================================================================
   DAGANGHUB FLOATING WA MULTI-NUMBER & LIVE CHAT STYLES
   Scoped, modern, responsive, and anti AI-slop
   ========================================================================== */

:root {
    --adqp-wa-pill-bg: #272353;
    --adqp-wa-pill-border: rgba(255, 255, 255, 0.85);
    --adqp-wa-pill-text: #ffffff;
    --adqp-wa-bubble-bg: #ffffff;
    --adqp-wa-bubble-text: #1e293b;
    --adqp-wa-bubble-hover: #f8fafc;
    --adqp-wa-bubble-border: #f1f5f9;
}

/* 1. Main Floating Container */
.adqp-floating-wrap {
    position: fixed !important;
    bottom: var(--adqp-float-bottom-desktop, 24px) !important;
    top: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 999990 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    box-sizing: border-box !important;
    pointer-events: auto !important;
}

.adqp-floating-wrap * {
    box-sizing: border-box;
}

.adqp-floating-wrap.is-pos-right {
    right: var(--adqp-float-side-desktop, 24px) !important;
    left: auto !important;
    align-items: flex-end !important;
}

.adqp-floating-wrap.is-pos-left {
    left: var(--adqp-float-side-desktop, 24px) !important;
    right: auto !important;
    align-items: flex-start !important;
}

/* 2. Main Pill Button */
.adqp-floating-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 22px;
    background: var(--adqp-wa-pill-bg, #272353) !important;
    background-color: var(--adqp-wa-pill-bg, #272353) !important;
    border: 1.5px solid var(--adqp-wa-pill-border, rgba(255, 255, 255, 0.85)) !important;
    border-radius: 9999px !important;
    color: var(--adqp-wa-pill-text, #ffffff) !important;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

.adqp-floating-pill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    background-color: var(--adqp-wa-pill-hover-bg, #1e1b4b) !important;
    border-color: var(--adqp-wa-pill-hover-border, rgba(255, 255, 255, 0.85)) !important;
    color: var(--adqp-wa-pill-hover-text, #ffffff) !important;
    text-decoration: none;
}

.adqp-floating-pill-btn:active {
    transform: translateY(0);
}

.adqp-floating-pill-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: currentColor;
}

/* Circle Button Alternative */
.adqp-floating-circle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 50% !important;
    background: var(--adqp-wa-pill-bg, #272353) !important;
    background-color: var(--adqp-wa-pill-bg, #272353) !important;
    border: 1.5px solid var(--adqp-wa-pill-border, rgba(255, 255, 255, 0.85)) !important;
    color: var(--adqp-wa-pill-text, #ffffff) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    text-decoration: none;
    outline: none;
}

.adqp-floating-circle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    background-color: var(--adqp-wa-pill-hover-bg, #1e1b4b) !important;
    border-color: var(--adqp-wa-pill-hover-border, rgba(255, 255, 255, 0.85)) !important;
    color: var(--adqp-wa-pill-hover-text, #ffffff) !important;
}

.adqp-floating-circle-btn svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* 3. Speech-Bubble Popup (Balon ke Atas) */
.adqp-wa-bubble-popup {
    position: absolute;
    bottom: calc(100% + 14px);
    background: var(--adqp-wa-bubble-bg, #ffffff);
    border-radius: 16px;
    min-width: 250px;
    box-shadow: 0 14px 35px -4px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.9);
    padding: 6px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.96);
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s ease;
    pointer-events: none;
    z-index: 999995;
}

/* Hover bridge so moving cursor to popup doesn't break hover */
.adqp-wa-bubble-popup::after {
    content: '';
    position: absolute;
    bottom: -18px;
    left: 0;
    right: 0;
    height: 18px;
    background: transparent;
}

.is-pos-right .adqp-wa-bubble-popup {
    right: 0;
}

.is-pos-left .adqp-wa-bubble-popup {
    left: 0;
}

/* Hover (sorot) & Click (is-active / is-open) triggers */
.adqp-floating-wrap:hover .adqp-wa-bubble-popup,
.adqp-wa-bubble-popup.is-active,
.adqp-wa-bubble-popup.is-open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
}

/* Triangular pointer arrow pointing to the button */
.adqp-wa-bubble-pointer {
    position: absolute;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: var(--adqp-wa-bubble-bg, #ffffff);
    border-right: 1px solid rgba(226, 232, 240, 0.9);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    transform: rotate(45deg);
    z-index: 2;
}

.is-pos-right .adqp-wa-bubble-pointer {
    right: 36px;
}

.is-pos-left .adqp-wa-bubble-pointer {
    left: 36px;
}

/* Bubble Header */
.adqp-wa-bubble-header {
    padding: 10px 16px 8px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.adqp-wa-bubble-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.adqp-wa-bubble-sub {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
}

/* Bubble Items */
.adqp-wa-bubble-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.adqp-wa-item,
.adqp-wa-bubble-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--adqp-wa-bubble-text, #1e293b);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
    background: transparent;
    width: 100%;
    border: none;
    text-align: left;
}

.adqp-wa-item:hover,
.adqp-wa-bubble-item:hover {
    background-color: var(--adqp-wa-bubble-hover, #f8fafc);
    color: #0f172a;
    text-decoration: none;
}

.adqp-wa-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8f5e9;
    color: #25d366;
    flex-shrink: 0;
}

.adqp-wa-item-icon svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.adqp-wa-item-icon.is-priority {
    background: #fef3c7;
    color: #d97706;
}

.adqp-wa-item-icon.is-tel {
    background: #e0f2fe;
    color: #0284c7;
}

.adqp-wa-item-icon.is-chat {
    background: #ede9fe;
    color: #6366f1;
}

.adqp-wa-item-info {
    flex: 1 1 auto;
    min-width: 0;
}

.adqp-wa-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
}

.adqp-wa-item-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    line-height: 1.3;
}

.adqp-badge-vip {
    background: #fef3c7;
    color: #b45309;
    font-size: 9.5px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.adqp-wa-item-arrow {
    color: #cbd5e1;
    font-size: 18px;
    margin-left: 6px;
    transition: transform 0.15s ease, color 0.15s ease;
}

.adqp-wa-item:hover .adqp-wa-item-arrow {
    transform: translateX(2px);
    color: #64748b;
}

/* 4. Live Chat Modal Window & Backdrop */
.adqp-livechat-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: 999996;
    display: none;
}

.adqp-livechat-backdrop.is-open {
    display: block;
}

@media (max-width: 600px) {
    .adqp-livechat-backdrop {
        background: rgba(15, 23, 42, 0.4);
    }
}

.adqp-livechat-modal {
    position: fixed;
    bottom: 24px;
    z-index: 999998;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 100px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 45px -8px rgba(15, 23, 42, 0.28), 0 8px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(226, 232, 240, 0.9);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
}

@media (min-width: 769px) {
    .adqp-livechat-modal.is-pos-right {
        right: 24px !important;
        left: auto !important;
    }

    .adqp-livechat-modal.is-pos-left {
        left: 24px !important;
        right: auto !important;
    }
}

.adqp-livechat-modal.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Live Chat Header */
.adqp-chat-header,
.adqp-livechat-header {
    background: var(--adqp-chat-header-bg, var(--adqp-wa-pill-bg, #272353)) !important;
    color: #ffffff !important;
    padding: 16px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-shrink: 0 !important;
}

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

.adqp-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.adqp-chat-avatar svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

.adqp-chat-online-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    background: #10b981;
    border-radius: 50%;
    border: 1.5px solid var(--adqp-wa-pill-bg, #272353);
    transition: background 0.2s ease;
}

.adqp-chat-online-dot.is-offline {
    background: #94a3b8 !important;
}

.adqp-chat-title-group h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.adqp-chat-title-group span {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.8);
    display: block;
    margin-top: 2px;
}

.adqp-chat-close-btn,
.adqp-livechat-close {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: rgba(255, 255, 255, 0.85) !important;
    cursor: pointer !important;
    font-size: 20px !important;
    line-height: 1 !important;
    padding: 6px !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.15s ease, transform 0.15s ease !important;
}

.adqp-chat-close-btn:hover,
.adqp-livechat-close:hover {
    color: #ffffff !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: scale(1.1) !important;
}

/* Chat Body (Messages Area) */
.adqp-chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.adqp-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    font-size: 13.5px;
    line-height: 1.45;
    position: relative;
    animation: adqpMsgFadeIn 0.2s ease;
}

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

.adqp-chat-msg.is-bot,
.adqp-chat-msg.is-admin {
    align-self: flex-start;
}

.adqp-chat-msg.is-user {
    align-self: flex-end;
}

.adqp-chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    word-break: break-word;
}

.adqp-chat-msg.is-bot .adqp-chat-bubble,
.adqp-chat-msg.is-admin .adqp-chat-bubble {
    background: var(--adqp-chat-bot-bubble-bg, #ffffff) !important;
    color: var(--adqp-chat-bot-bubble-text, #1e293b) !important;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.adqp-chat-msg.is-user .adqp-chat-bubble {
    background: var(--adqp-chat-user-bubble-bg, var(--adqp-wa-pill-bg, #272353)) !important;
    color: var(--adqp-chat-user-bubble-text, #ffffff) !important;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(39, 35, 83, 0.2);
}

.adqp-chat-msg-time {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 4px;
}

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

/* Typing Indicator Animation */
.adqp-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #ffffff;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.adqp-chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: adqpTyping 1.4s infinite ease-in-out both;
}

.adqp-chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.adqp-chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Chat Footer (Input Area) */
.adqp-chat-footer {
    background: #ffffff;
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.adqp-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.adqp-chat-input,
.adqp-livechat-input {
    flex: 1 1 auto;
    border: 1.5px solid #cbd5e1;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13.5px;
    outline: none;
    color: #1e293b;
    background: #ffffff;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.adqp-chat-input:focus,
.adqp-livechat-input:focus {
    border-color: var(--adqp-wa-pill-bg, #272353);
}

.adqp-chat-send-btn,
.adqp-livechat-send {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: var(--adqp-wa-pill-bg, #272353) !important;
    color: #ffffff !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s ease, opacity 0.15s ease !important;
}

.adqp-chat-send-btn:hover,
.adqp-livechat-send:hover {
    transform: scale(1.06) !important;
    opacity: 0.95 !important;
    background: var(--adqp-wa-pill-hover-bg, #1e1b4b) !important;
    border: none !important;
    box-shadow: none !important;
}

.adqp-chat-send-btn svg,
.adqp-livechat-send svg {
    width: 16px !important;
    height: 16px !important;
    fill: currentColor !important;
    margin-left: 2px !important;
}

/* WhatsApp Handover Button & Hint (Disabled inside Live Chat) */
.adqp-msg-handover {
    display: none !important;
}

.adqp-btn-handover {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #25D366 !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.28) !important;
    transition: transform 0.15s ease, background-color 0.15s ease !important;
    line-height: 1 !important;
}

.adqp-btn-handover:hover {
    background: #20bd5a !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.adqp-btn-handover svg {
    width: 16px !important;
    height: 16px !important;
    fill: #ffffff !important;
    flex-shrink: 0 !important;
}

/* Hide floating trigger when chat modal is open */
.adqp-floating-wrap.adqp-chat-is-open .adqp-floating-trigger {
    display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .adqp-floating-wrap {
        position: fixed !important;
        bottom: var(--adqp-float-bottom-mobile, 20px) !important;
        top: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 999990 !important;
    }
    .adqp-floating-wrap.is-pos-right {
        right: var(--adqp-float-side-mobile, 16px) !important;
        left: auto !important;
        align-items: flex-end !important;
    }
    .adqp-floating-wrap.is-pos-left {
        left: var(--adqp-float-side-mobile, 16px) !important;
        right: auto !important;
        align-items: flex-start !important;
    }

    .adqp-livechat-modal,
    .adqp-livechat-modal.is-pos-right,
    .adqp-livechat-modal.is-pos-left {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: 100% !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        z-index: 999999 !important;
    }

    .adqp-chat-header,
    .adqp-livechat-header {
        border-radius: 0 !important;
        padding: 14px 16px !important;
        padding-top: max(14px, env(safe-area-inset-top)) !important;
    }

    .adqp-chat-body,
    .adqp-livechat-body {
        flex: 1 1 auto !important;
        height: auto !important;
        padding: 14px 12px !important;
    }

    .adqp-chat-footer,
    .adqp-livechat-footer {
        border-radius: 0 !important;
        padding: 10px 12px !important;
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }

    .adqp-chat-input,
    .adqp-livechat-input {
        font-size: 16px !important; /* Prevents iOS Safari auto-zoom */
    }
}

/* 7. LiveChat Interactive Cards (Marketplace / Tokopedia Style & Google Maps) */
.adqp-chat-card-marketplace,
.adqp-chat-card-product,
.adqp-chat-card-page,
.adqp-chat-card-maps {
    margin-top: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: left;
    max-width: 290px;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.adqp-chat-card-marketplace:hover,
.adqp-chat-card-product:hover,
.adqp-chat-card-page:hover,
.adqp-chat-card-maps:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.adqp-chat-card-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    text-align: center !important;
    background: #03ac0e !important; /* Tokopedia Brand Green */
    color: #ffffff !important;
    padding: 8px 12px !important;
    border-radius: 7px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 5px rgba(3, 172, 14, 0.28) !important;
    transition: background 0.15s ease, transform 0.15s ease !important;
    cursor: pointer !important;
}

.adqp-chat-card-btn:hover {
    background: #02940c !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.adqp-chat-card-btn.is-maps {
    background: #ea4335 !important; /* Google Maps Red */
    box-shadow: 0 2px 5px rgba(234, 67, 53, 0.28) !important;
}

.adqp-chat-card-btn.is-maps:hover {
    background: #d93025 !important;
    color: #ffffff !important;
}

.adqp-chat-card-btn.is-page {
    background: #0f172a !important;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.25) !important;
}

.adqp-chat-card-btn.is-page:hover {
    background: #1e293b !important;
    color: #ffffff !important;
}

.adqp-chat-bubble.has-card-item {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.adqp-chat-bubble.has-card-item .adqp-chat-msg-time {
    padding-left: 2px;
}

