/* ============================================================
   GJUHA BOT — Chatbot Widget Styles
   ============================================================ */

/* Floating toggle button */
#chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c63ff, #4f46e5);
    border: none;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: chatbot-pulse 2.5s ease-in-out infinite;
}
#chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(108, 99, 255, 0.6);
    animation: none;
}
#chatbot-toggle .chat-icon {
    font-size: 1.5rem;
    line-height: 1;
    transition: transform 0.25s ease;
}
#chatbot-toggle.open .chat-icon-open  { display: none; }
#chatbot-toggle.open .chat-icon-close { display: flex; }
#chatbot-toggle:not(.open) .chat-icon-open  { display: flex; }
#chatbot-toggle:not(.open) .chat-icon-close { display: none; }

@keyframes chatbot-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(108, 99, 255, 0.45); }
    50%       { box-shadow: 0 4px 30px rgba(108, 99, 255, 0.7), 0 0 0 8px rgba(108,99,255,0.1); }
}

/* Unread badge */
#chatbot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat window */
#chatbot-window {
    position: fixed;
    bottom: 94px;
    right: 24px;
    width: 370px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    z-index: 9997;
    overflow: hidden;
    transform: scale(0.92) translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(.175,.885,.32,1.1), opacity 0.18s ease;
}
#chatbot-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Header */
#chatbot-header {
    background: linear-gradient(135deg, #6c63ff, #4f46e5);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.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: 1.3rem;
    flex-shrink: 0;
}
.chatbot-info h6 {
    margin: 0;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}
.chatbot-info span {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.75);
}
.chatbot-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}
#chatbot-close {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    border-radius: 8px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#chatbot-close:hover { background: rgba(255,255,255,0.28); }

/* Messages area */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9ff;
    scroll-behavior: smooth;
}
#chatbot-messages::-webkit-scrollbar { width: 4px; }
#chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#chatbot-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Message bubbles */
.chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: msg-in 0.2s ease;
}
@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.user-msg { flex-direction: row-reverse; }

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}
.bot-msg  .msg-avatar { background: linear-gradient(135deg,#6c63ff,#4f46e5); }
.user-msg .msg-avatar { background: linear-gradient(135deg,#10b981,#059669); }

.msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}
.bot-msg .msg-bubble {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    color: #1f2937;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.user-msg .msg-bubble {
    background: linear-gradient(135deg, #6c63ff, #4f46e5);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 6px 4px;
}
.typing-dots span {
    width: 7px;
    height: 7px;
    background: #9ca3af;
    border-radius: 50%;
    animation: dot-bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%            { transform: translateY(-6px); }
}

/* Suggestions */
#chatbot-suggestions {
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #fff;
    border-top: 1px solid #f3f4f6;
    flex-shrink: 0;
}
.suggestion-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.77rem;
    cursor: pointer;
    color: #4f46e5;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.suggestion-btn:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
}

/* Input area */
#chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    align-items: flex-end;
    flex-shrink: 0;
}
#chatbot-input {
    flex: 1;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 9px 14px;
    font-size: 0.875rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.45;
    max-height: 100px;
    overflow-y: auto;
    font-family: inherit;
}
#chatbot-input:focus { border-color: #6c63ff; }
#chatbot-input::placeholder { color: #9ca3af; }

#chatbot-send {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #6c63ff, #4f46e5);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
    color: #fff;
    font-size: 1rem;
}
#chatbot-send:hover:not(:disabled) { transform: scale(1.08); }
#chatbot-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Powered by */
.chatbot-powered {
    text-align: center;
    font-size: 0.67rem;
    color: #9ca3af;
    padding: 4px 0 8px;
    background: #fff;
}

/* Mobile tweaks */
@media (max-width: 480px) {
    #chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 80vh;
        border-radius: 20px 20px 0 0;
    }
    #chatbot-toggle {
        bottom: 16px;
        right: 16px;
    }
}
