/* ============================================
   SG Food Guide - Chatbot Styles
   ============================================ */

/* --- Chatbot Container --- */
#chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

/* --- Toggle Button --- */
#chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(211, 84, 0, 0.45);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(211, 84, 0, 0.6);
}

#chatbot-toggle:active {
    transform: scale(0.95);
}

#chatbot-toggle svg {
    transition: transform 0.3s ease;
}

#chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* --- Chat Window --- */
#chatbot-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

#chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* --- Header --- */
#chatbot-header {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.chatbot-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.chatbot-status {
    font-size: 0.75rem;
    opacity: 0.9;
    color: #a8ffbe;
}

#chatbot-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Messages Area --- */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f4f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

#chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #d5ccc4;
    border-radius: 10px;
}

/* --- Message Bubbles --- */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: msg-in 0.3s ease;
}

@keyframes msg-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.bot-msg {
    align-self: flex-start;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #fdebd0, #f5cba7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.msg-bubble {
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.user-bubble {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.bot-bubble {
    background: #fff;
    color: #3a3a3a;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.bot-bubble a {
    color: #d35400;
    font-weight: 600;
    text-decoration: underline;
}

/* --- Typing Indicator --- */
.typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        background: #ccc;
    }
    30% {
        transform: translateY(-8px);
        background: #e67e22;
    }
}

/* --- Suggestions --- */
#chatbot-suggestions {
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: #f8f4f0;
    border-top: 1px solid #ece5dd;
    flex-shrink: 0;
}

.suggestion-btn {
    background: #fff;
    border: 1.5px solid #e0d5ca;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.78rem;
    color: #d35400;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.suggestion-btn:hover {
    background: #fef6f0;
    border-color: #d35400;
    transform: translateY(-1px);
}

/* --- Input Area --- */
#chatbot-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #ece5dd;
    gap: 10px;
    flex-shrink: 0;
}

#chatbot-input {
    flex: 1;
    border: 2px solid #e8e0d8;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fdfaf7;
}

#chatbot-input:focus {
    border-color: #e67e22;
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.12);
}

#chatbot-input::placeholder {
    color: #bbb;
}

#chatbot-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e67e22, #d35400);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

#chatbot-send:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(211, 84, 0, 0.35);
}

#chatbot-send:active {
    transform: scale(0.95);
}

/* --- Mobile Responsive --- */
@media (max-width: 480px) {
    #chatbot-container {
        bottom: 80px;
        right: 16px;
    }

    #chatbot-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 140px);
        max-height: 520px;
        right: -8px;
        border-radius: 16px;
    }

    #chatbot-toggle {
        width: 52px;
        height: 52px;
    }

    #chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }
}
