/* ==========================================================================
   CHATBOT UI STYLING - RIS HANDMADE CROCHET
   ========================================================================== */

/* Tombol mengambang pemicu chat */
.chatbot-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #d63384;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(214, 51, 132, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
}

.chatbot-btn:hover {
    transform: scale(1.1);
    background: #b83280;
}

/* Kotak Wadah Chat Utama */
.chatbot-box {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 360px;
    height: 480px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: none; /* Disembunyikan secara default */
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    animation: fadeIn 0.25s ease-out;
}

/* Header Chatbot */
.chatbot-header {
    background: #d63384;
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: sans-serif;
}

.chatbot-header button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* Area Ruang Obrolan (Body) */
.chatbot-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #fff8fb;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Desain Gelembung Chat Umum */
.bot-msg, .user-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap; /* Mempertahankan format baris baru dari AI */
    word-wrap: break-word;
    font-family: sans-serif;
}

/* Gelembung Chat dari AI Bot */
.bot-msg {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    border: 1px solid #f3e6ec;
}

/* Gelembung Chat dari User */
.user-msg {
    background: #e14d95;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Indikator Loading / Mengetik */
.bot-msg.loading {
    color: #999;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

/* Pesan Eror */
.bot-msg.error-msg {
    background: #f8d7da;
    color: #842029;
    border-color: #f5c2c7;
}

/* Panel Input Bagian Bawah */
.chatbot-input {
    display: flex;
    padding: 12px;
    background: white;
    border-top: 1px solid #f3e6ec;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #deced7;
    padding: 10px 14px;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    transition: border 0.2s;
}

.chatbot-input input:focus {
    border-color: #d63384;
}

.chatbot-input button {
    background: #d63384;
    color: white;
    border: none;
    padding: 0 16px;
    margin-left: 8px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s;
}

.chatbot-input button:hover {
    background: #b83280;
}

/* Animasi Masuk Box Chat */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Optimasi Tampilan Mobile */
@media (max-width: 480px) {
    .chatbot-box {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 85px;
        height: 420px;
    }
}