/* ==========================================================
   CHATBOT FLOATING BUTTON & TOGGLE
========================================================== */
#chatbot-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #0d6efd;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.3);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    /* 1. Tambahkan baris animasi di bawah ini */
    animation: bounce 3s infinite; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Menghentikan pantulan otomatis saat kursor diarahkan (hover) agar stabil saat mau diklik */
#chatbot-toggle:hover {
    animation-play-state: paused;
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 12px 28px rgba(13, 110, 253, 0.4);
}

#chatbot-toggle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

#chat-notification {
    position: absolute;
    top: -1px;
    right: -1px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* ==========================================================
   ANIMASI KEYFRAMES BOUNCE (PANTULAN ELEGAN)
========================================================== */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-12px); /* Ketinggian pantulan pertama */
    }
    60% {
        transform: translateY(-6px);  /* Ketinggian pantulan kedua (lebih rendah) */
    }
}

/* ==========================================================
   CHATBOT CONTAINER WRAPPER
========================================================== */
/* 1. Kondisi DEFAULT (Chatbot Tersembunyi) */
#chatbot-wrapper {
    position: fixed;
    bottom: 98px;
    right: 25px;
    width: 380px;
    max-width: 90vw;
    height: 540px;
    max-height: 80vh;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Efek transisi buka-tutup halus */
    opacity: 0;
    pointer-events: none; 
    transform: translateY(30px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. Kondisi AKTIF (Saat chatbot terbuka) */
#chatbot-wrapper.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* ==========================================================
   HEADER SECTION
========================================================== */
#chatbot-header {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#chatbot-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #ffffff;
}

#chatbot-header small {
    font-size: 11.5px;
    opacity: 0.9;
    display: block;
    margin-top: 1px;
}

#close-chat {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    font-size: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#close-chat:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* ==========================================================
   BODY & MESSAGE BUBBLE SECTION
========================================================== */
#chatbot-body {
    flex: 1;
    padding: 20px;
    background-color: #f8f9fa;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Kustomisasi Scrollbar Agar Lebih Cantik */
#chatbot-body::-webkit-scrollbar {
    width: 6px;
}

#chatbot-body::-webkit-scrollbar-track {
    background: transparent;
}

#chatbot-body::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

#chatbot-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Pesan Dari Bot */
.bot-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.bot-message .avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.bot-message .bubble {
    background-color: #ffffff;
    color: #2d3748;
    padding: 12px 16px;
    border-radius: 4px 16px 16px 16px;
    font-size: 13.5px;
    line-height: 1.55;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Pesan Dari User */
.user-message {
    display: flex;
    justify-content: flex-end;
    max-width: 85%;
    margin-left: auto;
    animation: fadeIn 0.3s ease;
}

.user-message .bubble {
    background-color: #0d6efd;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 16px 4px 16px 16px;
    font-size: 13.5px;
    line-height: 1.55;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

.chat-time {
    display: block;
    font-size: 10px;
    color: #a0aec0;
    margin-top: 5px;
    margin-left: 4px;
}

.user-message .chat-time {
    text-align: right;
    margin-right: 4px;
}

/* Animasi Masuk Pesan */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   FOOTER INPUT SECTION
========================================================== */
#chatbot-footer {
    padding: 14px 18px;
    background-color: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

#chat-message {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
    color: #2d3748;
}

#chat-message::placeholder {
    color: #a0aec0;
}

#chat-message:focus {
    border-color: #0d6efd;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

#send-btn {
    background-color: #0d6efd;
    color: #ffffff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(13, 110, 253, 0.2);
}

#send-btn:hover {
    background-color: #0b5ed7;
    transform: scale(1.05);
    box-shadow: 0 6px 14px rgba(13, 110, 253, 0.3);
}

#send-btn:active {
    transform: scale(0.95);
}