/* ===============================
   FLOATING BUTTON (FAB)
================================= */
#pmb-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f7931e, #ffb347);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(247, 147, 30, 0.50);
    z-index: 9999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#pmb-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(247, 147, 30, 0.60);
}

#pmb-fab:active {
    transform: scale(0.95);
}

#pmb-fab svg {
    width: 22px;
    height: 22px;
    fill: #ffffff;
}

/* Notif badge (opsional) */
#pmb-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    background: #e24b4a;
    border-radius: 50%;
    border: 2px solid #ffffff;
    display: none;
}


/* ===============================
   CHAT BOX
================================= */
#pmb-box {
    position: fixed;
    bottom: 94px;
    right: 28px;
    width: 360px;
    height: 520px;
    background: #ffffff;
    border-radius: 20px;
    border: 0.5px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.14);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
}

#pmb-box.open {
    display: flex;
    animation: pmb-open 0.22s ease;
}

@keyframes pmb-open {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}


/* ===============================
   HEADER
================================= */
#pmb-header {
    padding: 14px 16px;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

#pmb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f7931e, #ffb347);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#pmb-avatar svg {
    width: 18px;
    height: 18px;
    fill: #ffffff;
}

#pmb-title {
    flex: 1;
}

#pmb-title .name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#pmb-title .status {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#pmb-title .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
}

#pmb-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    background: transparent;
    cursor: pointer;
    color: #999;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    line-height: 1;
}

#pmb-close:hover {
    background: #f5f5f5;
    color: #333;
}


/* ===============================
   MESSAGE AREA
================================= */
#pmb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

#pmb-messages::-webkit-scrollbar {
    width: 4px;
}

#pmb-messages::-webkit-scrollbar-track {
    background: transparent;
}

#pmb-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 4px;
}


/* ===============================
   DATE DIVIDER
================================= */
.pmb-date-divider {
    display: flex;
    justify-content: center;
    margin: 2px 0;
}

.pmb-date-divider span {
    font-size: 11px;
    color: #aaa;
    background: #f5f5f5;
    padding: 3px 12px;
    border-radius: 20px;
    border: 0.5px solid rgba(0, 0, 0, 0.07);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}


/* ===============================
   MESSAGE ROW
================================= */
.pmb-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.pmb-row.user {
    flex-direction: row-reverse;
}


/* Bot icon kecil di sebelah bubble */
.pmb-bot-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f7931e, #ffb347);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pmb-bot-icon svg {
    width: 13px;
    height: 13px;
    fill: #ffffff;
}


/* ===============================
   BUBBLE WRAPPER
================================= */
.pmb-bubble-wrap {
    max-width: 78%;
    display: flex;
    flex-direction: column;
}

.pmb-row.user .pmb-bubble-wrap {
    align-items: flex-end;
}


/* ===============================
   BUBBLE
================================= */
.pmb-bubble {
    padding: 9px 13px;
    font-size: 13px;
    line-height: 1.65;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    word-break: break-word;
    animation: pmb-fadein 0.18s ease;
}

@keyframes pmb-fadein {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bot bubble */
.pmb-bubble.bot {
    background: #fff5ec;
    color: #1a1a1a;
    border-radius: 16px 16px 16px 4px;
    border: 0.5px solid rgba(247, 147, 30, 0.20);
}

/* User bubble */
.pmb-bubble.user {
    background: linear-gradient(135deg, #f7931e, #ffb347);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
}


/* ===============================
   TIMESTAMP
================================= */
.pmb-time {
    font-size: 11px;
    color: #bbb;
    margin-top: 3px;
    padding: 0 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.pmb-row.user .pmb-time {
    text-align: right;
}


/* ===============================
   TYPING INDICATOR
================================= */
.pmb-typing {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.pmb-typing-dots {
    background: #fff5ec;
    border-radius: 16px 16px 16px 4px;
    border: 0.5px solid rgba(247, 147, 30, 0.20);
    padding: 10px 14px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.pmb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f7931e;
    animation: pmb-bounce 1.2s infinite ease-in-out;
}

.pmb-dot:nth-child(2) { animation-delay: 0.2s; }
.pmb-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pmb-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
    40%            { transform: translateY(-6px); opacity: 1; }
}


/* ===============================
   INPUT AREA
================================= */
#pmb-input-area {
    padding: 10px 12px;
    border-top: 0.5px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

#pmb-input {
    flex: 1;
    border: 0.5px solid rgba(0, 0, 0, 0.14);
    border-radius: 24px;
    padding: 9px 15px;
    font-size: 13px;
    background: #fafafa;
    color: #1a1a1a;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

#pmb-input:focus {
    border-color: #f7931e;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(247, 147, 30, 0.12);
}

#pmb-input::placeholder {
    color: #c0c0c0;
}

#pmb-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f7931e, #ffb347);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(247, 147, 30, 0.35);
}

#pmb-send:hover {
    opacity: 0.88;
}

#pmb-send:active {
    transform: scale(0.93);
}

#pmb-send svg {
    width: 15px;
    height: 15px;
    fill: #ffffff;
}

#pmb-send:disabled {
    background: #e0e0e0;
    box-shadow: none;
    cursor: default;
}


/* ===============================
   RESPONSIVE MOBILE
================================= */
@media (max-width: 420px) {
    #pmb-box {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 82px;
        height: 480px;
    }

    #pmb-fab {
        right: 16px;
        bottom: 18px;
    }
}
