/* Zonakuota Global Web Live Chat Widget */
#zk-webchat-root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    color: #0f172a;
}

#zk-webchat-root *,
#zk-webchat-root *::before,
#zk-webchat-root *::after {
    box-sizing: border-box;
}

/* Hindari tabrakan dengan bubble verifikasi */
#zk_verif_bubble {
    bottom: 92px !important;
}
@media (max-width: 768px) {
    #zk_verif_bubble {
        bottom: 84px !important;
    }
}

/* Lock scroll body saat fullscreen chat terbuka di mobile */
body.zk-wc-mobile-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

/* Launcher Floating Bubble */
#zk-webchat-root .zk-wc-launcher-wrap {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 99990 !important;
    display: flex !important;
    align-items: center;
    gap: 10px;
    visibility: visible !important;
    opacity: 1 !important;
}

.zk-wc-tooltip {
    background: #ffffff;
    color: #0f172a;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 13px;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
    border: 1px solid #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: opacity 0.25s ease, transform 0.25s ease;
    animation: zkWcFloatIn 0.35s ease-out;
}

.zk-wc-tooltip.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
}

.zk-wc-tooltip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.zk-wc-tooltip-dot.offline {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.zk-wc-launcher {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #09C4EF 0%, #0284C7 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px rgba(2, 132, 199, 0.38), 0 2px 8px rgba(15, 23, 42, 0.15);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
    outline: none;
    padding: 0;
}

.zk-wc-launcher:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 14px 32px rgba(2, 132, 199, 0.48);
}

.zk-wc-launcher:active {
    transform: scale(0.95);
}

.zk-wc-launcher-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #22c55e;
    border: 2.5px solid #ffffff;
}

.zk-wc-launcher-status.offline {
    background: #f59e0b;
}

.zk-wc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.zk-wc-badge.show {
    display: flex;
}

/* Desktop Chat Window */
.zk-wc-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 392px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 110px);
    background: #f8fafc;
    border-radius: 20px;
    box-shadow: 0 22px 60px -12px rgba(15, 23, 42, 0.32), 0 0 0 1px rgba(15, 23, 42, 0.08);
    z-index: 99995;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
}

.zk-wc-window.open {
    display: flex;
    animation: zkWcWindowIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header */
.zk-wc-header {
    background: linear-gradient(135deg, #0284C7 0%, #09C4EF 100%);
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.2);
}

.zk-wc-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.zk-wc-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.zk-wc-avatar-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #0284C7;
}

.zk-wc-avatar-dot.offline {
    background: #f59e0b;
}

.zk-wc-title-wrap {
    min-width: 0;
    flex: 1;
}

.zk-wc-title {
    font-size: 14.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    color: #ffffff;
}

.zk-wc-subtitle {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.zk-wc-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.zk-wc-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    padding: 0;
    font-size: 14px;
}

.zk-wc-icon-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Status Bar Banner */
.zk-wc-status-bar {
    padding: 6px 14px;
    font-size: 11.5px;
    font-weight: 600;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.zk-wc-status-bar.queue {
    display: flex;
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
}

.zk-wc-status-bar.live {
    display: flex;
    background: #dcfce7;
    color: #166534;
    border-bottom: 1px solid #bbf7d0;
}

.zk-wc-status-bar.offline {
    display: flex;
    background: #ffedd5;
    color: #9a3412;
    border-bottom: 1px solid #fed7aa;
}

.zk-wc-end-btn {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 12px;
    padding: 2px 9px;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
}

.zk-wc-end-btn:hover {
    background: #dc2626;
    color: #ffffff;
}

/* Guest Profile Bar */
.zk-wc-guest-card {
    background: #ffffff;
    margin: 10px 12px 4px;
    padding: 11px 12px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    flex-shrink: 0;
}

.zk-wc-guest-card.hidden {
    display: none;
}

.zk-wc-guest-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.zk-wc-guest-skip {
    background: none;
    border: none;
    color: #64748b;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
}

#zk-webchat-root .zk-wc-guest-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

#zk-webchat-root input.zk-wc-guest-input {
    flex: 1;
    min-width: 0;
    width: auto !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 6px 10px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
    outline: none !important;
    color: #0f172a !important;
    background: #f8fafc !important;
    box-shadow: none !important;
}

#zk-webchat-root input.zk-wc-guest-input:focus {
    border-color: #09C4EF !important;
    background: #ffffff !important;
}

.zk-wc-guest-save {
    background: #0284C7;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* Messages Scroll Area */
.zk-wc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f1f5f9;
    scroll-behavior: smooth;
}

.zk-wc-messages.drag-over {
    outline: 2px dashed #0284C7;
    outline-offset: -6px;
    background: #e0f2fe;
}

/* Welcome Card */
.zk-wc-welcome {
    background: #ffffff;
    border-radius: 16px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.zk-wc-welcome-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.zk-wc-welcome-desc {
    font-size: 12.5px;
    color: #475569;
    margin-bottom: 10px;
}

.zk-wc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.zk-wc-chip {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
    border-radius: 16px;
    padding: 6px 11px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zk-wc-chip:hover {
    background: #0284C7;
    color: #ffffff;
    border-color: #0284C7;
}

/* Message Rows & Bubbles */
.zk-wc-msg-row {
    display: flex;
    flex-direction: column;
    max-width: 84%;
    animation: zkWcMsgIn 0.2s ease-out;
}

.zk-wc-msg-row.user {
    align-self: flex-end;
    align-items: flex-end;
}

.zk-wc-msg-row.agent,
.zk-wc-msg-row.bot {
    align-self: flex-start;
    align-items: flex-start;
}

.zk-wc-msg-row.system {
    align-self: center;
    align-items: center;
    max-width: 92%;
}

.zk-wc-sender-label {
    font-size: 10.5px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 3px;
    padding: 0 4px;
}

.zk-wc-bubble {
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
}

.zk-wc-msg-row.user .zk-wc-bubble {
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.22);
}

.zk-wc-msg-row.agent .zk-wc-bubble,
.zk-wc-msg-row.bot .zk-wc-bubble {
    background: #ffffff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.zk-wc-msg-row.system .zk-wc-bubble {
    background: #fef9c3;
    color: #854d0e;
    font-size: 11.5px;
    padding: 5px 12px;
    border-radius: 12px;
    border: 1px solid #fef08a;
    text-align: center;
}

.zk-wc-bubble.sticker-bubble {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2px !important;
}

.zk-wc-bubble a {
    color: #0284C7;
    text-decoration: underline;
    font-weight: 600;
}

.zk-wc-msg-row.user .zk-wc-bubble a {
    color: #e0f2fe;
}

.zk-wc-bubble code {
    background: rgba(15, 23, 42, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}

.zk-wc-msg-row.user .zk-wc-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.zk-wc-bubble pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 8px 10px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
    margin: 6px 0;
}

.zk-wc-media-img {
    display: block;
    max-width: 220px;
    max-height: 240px;
    border-radius: 12px;
    cursor: pointer;
    object-fit: cover;
    margin-bottom: 4px;
}

.zk-wc-sticker-img {
    display: block;
    width: 118px;
    height: 118px;
    object-fit: contain;
}

.zk-wc-media-video {
    display: block;
    max-width: 240px;
    max-height: 220px;
    border-radius: 12px;
    background: #000000;
    margin-bottom: 4px;
}

.zk-wc-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    padding: 0 3px;
    font-size: 10px;
    color: #64748b;
}

.zk-wc-check {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -1px;
}

.zk-wc-check.sending { color: #94a3b8; }
.zk-wc-check.sent { color: #64748b; }
.zk-wc-check.delivered { color: #64748b; }
.zk-wc-check.read { color: #09C4EF; }

/* Typing Indicator */
.zk-wc-typing {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #f1f5f9;
    font-size: 11.5px;
    color: #475569;
    flex-shrink: 0;
}

.zk-wc-typing.show {
    display: flex;
}

.zk-wc-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #ffffff;
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.zk-wc-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #09C4EF;
    animation: zkWcBounce 1.2s infinite ease-in-out;
}

.zk-wc-dots span:nth-child(2) { animation-delay: 0.15s; }
.zk-wc-dots span:nth-child(3) { animation-delay: 0.3s; }

/* Upload Progress Bar */
.zk-wc-upload-bar {
    display: none;
    padding: 6px 14px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11.5px;
    font-weight: 600;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.zk-wc-upload-bar.show {
    display: flex;
}

.zk-wc-upload-track {
    flex: 1;
    height: 5px;
    background: #bae6fd;
    border-radius: 99px;
    overflow: hidden;
}

.zk-wc-upload-fill {
    width: 0%;
    height: 100%;
    background: #0284C7;
    transition: width 0.2s ease;
}

/* Emoji & Sticker Drawer */
.zk-wc-picker {
    display: none;
    flex-direction: column;
    height: 225px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.zk-wc-picker.open {
    display: flex;
}

.zk-wc-picker-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.zk-wc-picker-tab {
    flex: 1;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.zk-wc-picker-tab.active {
    color: #0284C7;
    border-bottom-color: #0284C7;
    background: #ffffff;
}

.zk-wc-picker-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.zk-wc-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.zk-wc-emoji-btn {
    border: none;
    background: none;
    font-size: 20px;
    padding: 5px 0;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1.2;
}

.zk-wc-emoji-btn:hover {
    background: #f1f5f9;
}

.zk-wc-sticker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.zk-wc-sticker-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 12px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.zk-wc-sticker-btn:hover {
    transform: translateY(-2px);
    border-color: #09C4EF;
    background: #f0f9ff;
}

.zk-wc-sticker-btn img {
    width: 62px;
    height: 62px;
    object-fit: contain;
}

.zk-wc-sticker-btn span {
    font-size: 10.5px;
    font-weight: 600;
    color: #334155;
    text-align: center;
}

/* Composer Input Bar */
#zk-webchat-root .zk-wc-composer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 9px 10px;
    display: flex;
    align-items: flex-end;
    gap: 7px;
    flex-shrink: 0;
}

#zk-webchat-root .zk-wc-tool-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
    padding: 0;
    margin: 0;
}

#zk-webchat-root .zk-wc-tool-btn:hover,
#zk-webchat-root .zk-wc-tool-btn.active {
    background: #e0f2fe;
    color: #0284C7;
}

#zk-webchat-root textarea.zk-wc-input {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    height: 38px;
    min-height: 38px !important;
    max-height: 110px !important;
    margin: 0 !important;
    padding: 8px 14px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 20px !important;
    font-size: 13.5px !important;
    font-family: inherit !important;
    line-height: 20px !important;
    resize: none !important;
    outline: none !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    box-shadow: none !important;
    overflow-y: hidden;
    display: block !important;
    vertical-align: middle !important;
}

#zk-webchat-root textarea.zk-wc-input::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}

#zk-webchat-root textarea.zk-wc-input:focus {
    border-color: #09C4EF !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(9, 196, 239, 0.14) !important;
}

#zk-webchat-root .zk-wc-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #09C4EF 0%, #0284C7 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
    transition: transform 0.15s ease;
    padding: 0;
    margin: 0;
}

.zk-wc-send-btn:hover {
    transform: scale(1.06);
}

.zk-wc-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Lightbox Modal */
.zk-wc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(2, 6, 23, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.zk-wc-lightbox.open {
    display: flex;
}

.zk-wc-lightbox img {
    max-width: 94vw;
    max-height: 86vh;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.zk-wc-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
}

/* Mobile Fullscreen Responsive */
@media (max-width: 768px) {
    #zk-webchat-root .zk-wc-launcher-wrap {
        bottom: 16px !important;
        right: 16px !important;
    }

    .zk-wc-tooltip {
        display: none;
    }

    .zk-wc-launcher {
        width: 54px;
        height: 54px;
    }

    .zk-wc-window {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        transform-origin: bottom center;
    }

    .zk-wc-header {
        padding: 12px 14px;
    }

    .zk-wc-emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

@keyframes zkWcWindowIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

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

@keyframes zkWcBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.45; }
    40% { transform: scale(1); opacity: 1; }
}
