/* ============================================
   Aina Chatbot - Floating Chat Assistant
   Kolej Yayasan Felda
   ============================================ */

/* --- Floating Button --- */
.chatbot-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 9999;
    padding: 0;
    background: linear-gradient(135deg, #FBBF24, #F59E0B);
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(251, 191, 36, 0.6);
}

.chatbot-btn:active {
    transform: scale(0.95);
}

.chatbot-btn-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: block;
}

.chatbot-btn-icon {
    display: none;
    font-size: 28px;
    color: #0A0E27;
}

/* State: when panel is open, show X icon */
.chatbot-btn.is-open .chatbot-btn-avatar {
    display: none;
}

.chatbot-btn.is-open .chatbot-btn-icon {
    display: block;
}

/* Pulse animation */
.chatbot-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #FBBF24;
    animation: chatbot-pulse 2s ease-in-out infinite;
    opacity: 0;
}

@keyframes chatbot-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(1.15); opacity: 0; }
}

/* Notification dot */
.chatbot-btn .chatbot-notif-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #EF4444;
    border-radius: 50%;
    border: 2px solid #0A0E27;
    display: none;
}

.chatbot-btn .chatbot-notif-dot.show {
    display: block;
}

/* --- Chat Panel --- */
.chatbot-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-height: 560px;
    background: rgba(15, 20, 45, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: chatbot-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-panel.is-open {
    display: flex;
}

@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Header --- */
.chatbot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.05));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.chatbot-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(251, 191, 36, 0.4);
    flex-shrink: 0;
}

.chatbot-header-info {
    flex: 1;
    min-width: 0;
}

.chatbot-header-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.3;
}

.chatbot-header-status {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    color: #10B981;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10B981;
    border-radius: 50%;
    display: inline-block;
    animation: chatbot-status-blink 1.5s ease-in-out infinite;
}

@keyframes chatbot-status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chatbot-header-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.chatbot-header-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* --- Messages Area --- */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* --- Message Bubbles --- */
.chatbot-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13.5px;
    line-height: 1.6;
    animation: chatbot-msg-in 0.3s ease-out;
    word-wrap: break-word;
}

@keyframes chatbot-msg-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.92);
    border-bottom-left-radius: 4px;
}

.chatbot-msg.user {
    align-self: flex-end;
    background: #FBBF24;
    color: #0A0E27;
    font-weight: 500;
    border-bottom-right-radius: 4px;
}

.chatbot-msg.bot .msg-emoji {
    font-size: 18px;
    display: inline-block;
    margin-right: 2px;
}

/* --- Typing Indicator --- */
.chatbot-typing {
    align-self: flex-start;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.chatbot-typing.show {
    display: flex;
}

.chatbot-typing .dot {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: chatbot-dot-bounce 1.4s ease-in-out infinite;
}

.chatbot-typing .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatbot-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* --- Quick Reply Buttons --- */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 20px 12px;
    flex-shrink: 0;
}

.chatbot-quick-reply {
    padding: 7px 14px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.08);
    color: #FBBF24;
    border-radius: 20px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chatbot-quick-reply:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.5);
    transform: translateY(-1px);
}

.chatbot-quick-reply:active {
    transform: translateY(0);
}

/* --- Input Area --- */
.chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chatbot-input:focus {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #FBBF24;
    color: #0A0E27;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.chatbot-send-btn:hover {
    background: #F59E0B;
    transform: scale(1.05);
}

.chatbot-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .chatbot-panel {
        right: 12px;
        left: 12px;
        bottom: 90px;
        width: auto;
        max-height: 70vh;
        border-radius: 16px;
    }

    .chatbot-btn {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chatbot-btn-avatar {
        width: 48px;
        height: 48px;
    }
}
