/* ============================================
   Chatbot Widget Styles
   Pondok Pesantren MANUFA
   Asisten MANUFA - FAQ Bot
   ============================================ */

/* ── Floating Toggle Button ── */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6e3f, #14a05c);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(13, 110, 63, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: chatPulse 2.5s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 35px rgba(13, 110, 63, 0.55);
}

.chatbot-toggle.active {
    animation: none;
    background: linear-gradient(135deg, #dc3545, #c0392b);
    box-shadow: 0 6px 25px rgba(220, 53, 69, 0.4);
}

@keyframes chatPulse {
    0%, 100% { box-shadow: 0 6px 25px rgba(13, 110, 63, 0.4); }
    50% { box-shadow: 0 6px 35px rgba(13, 110, 63, 0.7), 0 0 0 12px rgba(13, 110, 63, 0.1); }
}

/* ── Notification Badge ── */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #c9a84c;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: badgeBounce 1s ease infinite;
}

@keyframes badgeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ── Chat Window ── */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 15px 60px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Chat Header ── */
.chatbot-header {
    background: linear-gradient(135deg, #094d2c 0%, #0d6e3f 50%, #14a05c 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M20 20.5V18H0v-2h20v-2H0v-2h20V8H0V6h20V4H0V2h20V0h2v20h2V0h2v20h2V0h2v20h2V0h2v20h2V0h2v20h2v2H20v-1.5z'/%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.chatbot-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-header-info {
    flex: 1;
    position: relative;
    z-index: 1;
}

.chatbot-header-info h4 {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 2px 0;
    font-family: 'Poppins', sans-serif;
}

.chatbot-header-info span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chatbot-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
    animation: statusPulse 1.5s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ── Chat Body (Messages) ── */
.chatbot-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f0f4f2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 320px;
    min-height: 280px;
    scroll-behavior: smooth;
}

.chatbot-body::-webkit-scrollbar {
    width: 5px;
}
.chatbot-body::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-body::-webkit-scrollbar-thumb {
    background: #c0c8c3;
    border-radius: 10px;
}

/* ── Message Bubbles ── */
.chat-message {
    display: flex;
    gap: 8px;
    animation: msgFadeIn 0.3s ease;
}

@keyframes msgFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot {
    align-self: flex-start;
    flex-direction: row;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message .msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-message.bot .msg-avatar {
    background: linear-gradient(135deg, #0d6e3f, #14a05c);
    color: #fff;
}

.chat-message.user .msg-avatar {
    background: linear-gradient(135deg, #c9a84c, #a88a35);
    color: #fff;
}

.chat-bubble {
    max-width: 250px;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    font-family: 'Poppins', sans-serif;
    word-wrap: break-word;
}

.chat-message.bot .chat-bubble {
    background: #fff;
    color: #1a2e23;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, #0d6e3f, #14a05c);
    color: #fff;
    border-top-right-radius: 4px;
}

.chat-bubble .msg-time {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.6;
}

/* ── Quick Reply Buttons ── */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.quick-reply-btn {
    background: linear-gradient(135deg, #e8f5ee, #d4edda);
    border: 1px solid #b2dfbc;
    color: #094d2c;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, #0d6e3f, #14a05c);
    color: #fff;
    border-color: #0d6e3f;
    transform: translateY(-1px);
}

/* ── Typing Indicator ── */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 16px;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    width: fit-content;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: #94a89c;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ── Chat Input ── */
.chatbot-input {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e8ede9;
    gap: 10px;
}

.chatbot-input input {
    flex: 1;
    border: 1px solid #d4ddd8;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    background: #f8faf9;
    color: #1a2e23;
}

.chatbot-input input:focus {
    border-color: #0d6e3f;
    box-shadow: 0 0 0 3px rgba(13, 110, 63, 0.08);
}

.chatbot-input input::placeholder {
    color: #94a89c;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6e3f, #14a05c);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(13, 110, 63, 0.3);
}

/* ── Powered By ── */
.chatbot-footer {
    text-align: center;
    padding: 6px;
    background: #f8faf9;
    font-size: 10px;
    color: #94a89c;
    border-top: 1px solid #e8ede9;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        max-height: 70vh;
    }
    .chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
        font-size: 24px;
    }
}
