/* ==================== */
/* AI CHAT CONTAINER */
/* ==================== */
.ai-chat-container {
    position: fixed;
    bottom: 220px !important;
    right: 20px;
    width: 350px;
    /* height: 500px; */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    font-family: 'Segoe UI', Roboto, sans-serif;
    border: 1px solid #e1e1e1;
}

.ai-chat-container.hidden {
    display: none;
}

/* ==================== */
/* HEADER STYLE */
/* ==================== */
.ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #25D366; /* WhatsApp green */
    color: white;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.ai-avatar {
    background: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #25D366;
}

.ai-chat-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
}

/* ==================== */
/* CHAT BODY STYLE */
/* ==================== */
.ai-chat-body {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    padding: 15px;
    padding-right: 0;
    background: #e5ddd5;
    background-repeat: repeat;
    margin: 0;
    scrollbar-width: thin; /* Untuk Firefox */
    scrollbar-color: #25D366 #f1f1f1; /* Untuk Firefox */
}

.ai-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-padding-bottom: 20px;
    min-height: 300px;
    scrollbar-gutter: stable both-edges;
    padding-bottom: 80px;
}

/* ==================== */
/* FOOTER & INPUT STYLE */
/* ==================== */
.ai-chat-footer {
    flex-shrink: 0;
    background: #f0f0f0;
    padding: 10px;
    border-top: 1px solid #e1e1e1;
    position: sticky;
    bottom: 20;
}

.ai-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    resize: none;
    max-height: 100px;
    outline: none;
    font-family: inherit;
    background: white;
    transition: border 0.3s;
}

.ai-chat-input:focus {
    border-color: #25D366;
}

.ai-chat-submit {
    background: #25D366;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.ai-chat-submit:hover {
    background: #128C7E;
}

/* ==================== */
/* END CHAT BUTTON (FLOATING) */
/* ==================== */
.ai-chat-end-btn-container {
    position: fixed;
    bottom: 160px;
    right: 20px;
    z-index: 9999 !important;
    width: 350px; /* Sama dengan lebar chat container */
    display: none; /* Awalnya hidden */
    text-align: right; /* Agar tombol sejajar kanan */

}

.ai-chat-container:not(.hidden) + .ai-chat-end-btn-container {
    display: block; /* Muncul hanya saat chat aktif */
}

.ai-chat-end-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ff3b30;
    color: white;
    padding: 12px 20px;
    height: 50px;
    border-radius: 50px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    gap: 8px;
    font-weight: 500;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    margin-top: 5px; /* Jarak dari chat container */
    border: 2px solid white;
}

.ai-chat-end-btn:hover {
    background: #ff1a1a;
    transform: translateY(-2px);
}

/* Custom Scrollbar (WebKit) */
.ai-chat-body::-webkit-scrollbar {
    width: 8px;
}
.ai-chat-body::-webkit-scrollbar-thumb {
    background: #25D366;
    border-radius: 4px;
}
.ai-chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

/* ==================== */
/* CHAT MESSAGE STYLES */
/* ==================== */
.message {
    max-width: 80%;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
}

/* User Message (Kanan) */
.message.user-message {
    align-self: flex;
    background-color: #25D366; /* Warna WhatsApp */
    color: white;
    border-top-right-radius: 2px; /* Rounded lebih subtle di sudut kanan */
    margin-left: 10%; /* Dorong ke kanan */
}

/* Bot Message (Kiri) */
.message.bot-message {
    align-self: flex-start;
    background-color: #f1f1f1;
    color: #333;
    border-top-left-radius: 4px; /* Rounded lebih subtle di sudut kiri */
    margin-right: 20%; /* Dorong ke kiri */
}

/* Typing Indicator */
.message.typing-indicator {
    align-self: flex-start;
    background-color: #f1f1f1;
    color: #666;
    border-top-left-radius: 4px;
    margin-right: 20%;
}

/* ==================== */
/* RESPONSIVE */
/* ==================== */
@media (max-width: 480px) {
    .ai-chat-end-btn-container {
        width: 90%;
        right: 0%;
        bottom: 140px;
    }
    /* Existing chat button styles */
    .chat-button-container {
        bottom: 80px;
        right: 10px;
    }
    .chat-toggle-btn-ai,
    .chat-toggle-btn-lapor {
        padding: 10px 16px;
        font-size: 12px;
    }
}
