#fc-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1050;
    font-family: inherit;
}

/* ── Tombol Bubble ── */
.fc-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(105, 108, 255, 0.4);
    transition:
        transform 0.2s,
        box-shadow 0.2s;
    margin-left: auto;
    display: block;
    position: relative;
    background: #fff;
}

.fc-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(105, 108, 255, 0.5);
}

.fc-btn-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.fc-btn .bx-x {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    background: rgba(105, 108, 255, 0.9);
    border-radius: 50%;
}

/* ── Tooltip ── */
.fc-tooltip {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 0;
    background: #fff;
    border-radius: 14px 14px 4px 14px;
    padding: 10px 14px 10px 12px;
    font-size: 13px;
    color: #566a7f;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
    white-space: nowrap;
    align-items: center;
    gap: 8px;
    animation: fcPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform-origin: bottom right;
}

.fc-tooltip.hide {
    animation: fcPopOut 0.2s ease forwards;
    pointer-events: none;
}

.fc-tooltip-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: #a5acb8;
    padding: 0;
    line-height: 1;
}

.fc-tooltip-close:hover {
    color: #566a7f;
}

@keyframes fcPopIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fcPopOut {
    from {
        transform: scale(1);
        opacity: 1;
    }

    to {
        transform: scale(0.7);
        opacity: 0;
    }
}

/* ── Panel ── */
.fc-panel {
    position: fixed;
    bottom: 88px;
    right: 16px;
    left: 16px;
    width: auto;
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.85);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.2s;
}

.fc-panel.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

@media (min-width: 480px) {
    .fc-panel {
        position: absolute;
        bottom: 68px;
        right: 0;
        left: auto;
        width: 360px;
    }
}

/* ── Header ── */
.fc-header {
    background: #696cff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fc-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.fc-avatar-fallback {
    font-size: 18px;
    line-height: 1;
}

.fc-header-text {
    flex: 1;
}

.fc-header-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.fc-header-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
}

.fc-online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #71dd37;
    border: 2px solid #fff;
    flex-shrink: 0;
}

/* ── Messages ── */
.fc-messages {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 55vh;
    overflow-y: auto;
    background: #f5f5f9;
}

@media (min-width: 480px) {
    .fc-messages {
        max-height: 300px;
    }
}

.fc-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}

.fc-msg.bot {
    align-self: flex-start;
}

.fc-msg.user {
    align-self: flex-end;
}

.fc-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
}

.fc-msg.bot .fc-bubble {
    background: #fff;
    color: #566a7f;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.fc-msg.user .fc-bubble {
    background: #696cff;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.fc-time {
    font-size: 10px;
    color: #a5acb8;
    margin-top: 3px;
    padding: 0 2px;
}

.fc-msg.user .fc-time {
    text-align: right;
}

/* ── Typing dots ── */
.fc-typing-wrap {
    display: flex;
    gap: 4px;
    align-items: center;
}

.fc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #a5acb8;
    animation: fcBounce 1.2s infinite;
}

.fc-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.fc-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes fcBounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

/* ── Footer ── */
.fc-footer {
    padding: 10px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
}

.fc-input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    resize: none;
    outline: none;
    background: #f5f5f9;
    color: #566a7f;
    max-height: 80px;
    min-height: 36px;
    line-height: 1.4;
    transition: border-color 0.2s;
    font-family: inherit;
}

.fc-input:focus {
    border-color: #696cff;
}

.fc-send {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #696cff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.fc-send i {
    font-size: 16px;
    color: #fff;
}

.fc-send:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ── Footer note ── */
.fc-powered {
    text-align: center;
    padding: 6px;
    font-size: 10px;
    color: #a5acb8;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
}

/* ── Markdown rendering di bubble bot ── */
.fc-msg.bot .fc-bubble strong {
    font-weight: 600;
    color: #3d4f60;
}

.fc-msg.bot .fc-bubble em {
    font-style: italic;
}

.fc-msg.bot .fc-bubble ul {
    margin: 6px 0 2px 0;
    padding-left: 16px;
    list-style: disc;
}

.fc-msg.bot .fc-bubble ul li {
    margin-bottom: 3px;
    line-height: 1.5;
}

/* ── Out-of-topic notice ── */
.fc-msg.notice .fc-bubble {
    background: #fff8e1;
    color: #8a6d00;
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-bottom-left-radius: 4px;
    font-style: italic;
}

@media (max-width: 991.98px) {
    #fc-widget {
        bottom: 80px;
    }

    .fc-panel {
        position: absolute;
        bottom: 68px;
        right: -10px;
        left: auto;
        width: 320px;
    }
}

.fc-quota {
    padding: 6px 10px;
    font-size: 12px;
    text-align: center;
}

.fc-quota--ok {
    color: #28a745;
}

.fc-quota--low {
    color: #ff9800;
}

.fc-quota--empty {
    color: #f44336;
}
