body {
    font-family: 'Inter', sans-serif;
}

.chatbot-toggler-wrapper {
    position: fixed;
    bottom: 30px;
    right: 35px;
    z-index: 999;
    display: flex;
    align-items: center;
}


.toggler-tooltip {
    position: absolute;
    right: 100%;
    padding: 8px 16px;
    margin-right: 15px;
    background: linear-gradient(135deg, #4F46E5, #818CF8);
    color: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 1;
    transform: scale(1);
    transform-origin: right;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chatbot-toggler-wrapper:hover .toggler-tooltip {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

.chatbot-toggler {
    height: 55px;
    width: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    cursor: pointer;
    background: linear-gradient(135deg, #4F46E5, #818CF8);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.chatbot-toggler:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.chatbot-toggler span {
    position: absolute;
    color: white;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chatbot-toggler span .material-symbols-rounded {
    font-size: 2rem;
}

.chatbot-toggler span.close-icon {
    opacity: 0;
    transform: rotate(90deg);
}

body.show-chatbot .chatbot-toggler span.chat-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

body.show-chatbot .chatbot-toggler span.close-icon {
    opacity: 1;
    transform: rotate(0deg);
}


.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 35px;
    width: 420px;
    height: 650px;
    max-height: 80vh; 
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.2s ease-in-out;
    z-index: 998;
    display: flex;
    flex-direction: column;
}

body.show-chatbot .chatbot-toggler-wrapper {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

body.show-chatbot .chatbot-container {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}


.chatbot-header {
    background: linear-gradient(135deg, #4F46E5, #6366F1);
    padding: 16px 20px;
    text-align: center;
    color: #fff;
    position: relative;
}

.chatbot-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}


.chatbot-header .close-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.chatbot-header .close-btn:hover {
    opacity: 1;
}

.chatbox {
    flex-grow: 1; 
    overflow-y: auto;
    padding: 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: #A5B4FC #E0E7FF;
}


.chatbox .chat {
    display: flex;
    max-width: 85%;
}


.chatbox .incoming span {
    height: 32px;
    width: 32px;
    color: #fff;
    background: #4F46E5;
    text-align: center;
    line-height: 32px;
    border-radius: 6px;
    margin-right: 10px;
    align-self: flex-end;
    font-size: 1.4rem;
}

.chatbox .chat p {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    color: #333;
    background: #F3F4F6;
    /* bg-gray-100 */
    border-top-left-radius: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}


.chatbox .outgoing {
    justify-content: flex-end;
    /* Align to the right */
}

.chatbox .outgoing p {
    background: #4F46E5;
    color: #fff;
    border-top-left-radius: 12px;
    border-top-right-radius: 0;

    /* DAN PASTIKAN JUGA ADA DI SINI UNTUK JAGA-JAGA */
    overflow-wrap: break-word;
    word-break: break-word;
}


.chatbox .chat p.typing-indicator {
    background: #F3F4F6;
    padding: 12px 16px;
}

.chatbox .chat p.typing-indicator span {
    height: 7px;
    width: 7px;
    display: inline-block;
    background-color: #9CA3AF;
    /* gray-400 */
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1s infinite;
}

.chatbox .chat p.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbox .chat p.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}


.chat-input {
    /* position: absolute; <- Dihapus */
    /* bottom: 0; <- Dihapus */
    /* width: 100%; <- */
    display: flex;
    gap: 5px;
    background: #fff;
    padding: 10px 20px;
    border-top: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.chat-input textarea {
    flex-grow: 1;
    height: 55px;
    max-height: 180px;  
    border: none;
    outline: none;
    resize: none;
    padding: 16px 15px;
    font-size: 0.95rem;
    border-radius: 8px;
    background-color: #F9FAFB;
    border: 1px solid #E5E7EB;
    transition: border-color 0.2s;
}

.chat-input textarea:focus {
    border-color: #4F46E5;
}

.chat-input span {
    align-self: flex-end;
    height: 55px;
    width: 55px;
    background: #4F46E5;
    color: #fff;
    font-size: 1.7rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.chat-input span:hover {
    background: #4338CA;
}


@media (max-width: 490px) {
    .chatbot-container {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chatbot-toggler-wrapper {
        right: 20px;
        bottom: 20px;
    }

    .toggler-tooltip {
        display: none;

    }

    .chatbox {
        height: 90%;
    }
}