#chatbot-widget {
    position: fixed;
    z-index: 9999;
    transition: all 0.3s ease;
}

#chatbot-button {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

#chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* Floating Message Bubble */
#floating-message-bubble {
    position: fixed;
    background: white;
    padding: 12px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    max-width: 250px;
    font-size: 14px;
    color: #333;
    z-index: 9998;
    animation: slideInBounce 0.6s ease-out;
    cursor: pointer;
    transition: all 0.3s ease;
}

#floating-message-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

#floating-message-bubble.hidden {
    display: none;
}

#floating-message-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

#floating-message-bubble.position-right::after {
    right: 23px;
}

#floating-message-bubble.position-left::after {
    left: 20px;
}

.floating-message-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    opacity: 0;
    transition: opacity 0.3s;
}

#floating-message-bubble:hover .floating-message-close {
    opacity: 1;
}

.floating-message-close:hover {
    background: #e0e0e0;
}

@keyframes slideInBounce {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    60% {
        opacity: 1;
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#chatbot-window {
    position: fixed;
    bottom: 100px;
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

#chatbot-window.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

.chat-header {
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 10px;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.message.bot,
.message.admin {
    flex-direction: row;
    justify-content: flex-start;
}

/* Profile Picture Styles */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: white;
    background: #6c757d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message-avatar.bot {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message-avatar.admin {
    background: linear-gradient(135deg, #3472af 0%, #e57233 100%);
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* User messages don't show avatar */
.message.user .message-avatar {
    display: none;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.message.user .message-wrapper {
    align-items: flex-end;
}

.message.bot .message-wrapper,
.message.admin .message-wrapper {
    align-items: flex-start;
}

.message-info {
    margin-bottom: 5px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.85rem;
}

.message.user .message-info {
    justify-content: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    position: relative;
    font-size:13px;
}

.message.bot .message-content,
.message.admin .message-content {
    background: white;
    color: #333;
    border-top-left-radius: 4px;
}

.message.user .message-content {
    color: white;
    border-top-right-radius: 4px;
}

.chat-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

.chat-input-area.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
}

.send-button {
    padding: 12px 20px;
    border: none;
    border-radius: 24px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.send-button:hover:not(:disabled) {
    opacity: 0.9;
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.typing-dots span {
    animation: typingDots 1.4s infinite;
    opacity: 0;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingDots {
    0%, 60%, 100% { opacity: 0; }
    30% { opacity: 1; }
}

.message-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 4px;
}

.quick-reply-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.quick-reply-btn {
    padding: 10px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    text-align: left;
}

.quick-reply-btn:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.quick-reply-btn.selected {
    pointer-events: none;
    opacity: 0.5;
}

/* Typing Indicator with Avatar */
/* Typing Indicator aligned to left like admin */
.message.typing-indicator {
    display: flex;
    flex-direction: row; /* ensures avatar on left */
    justify-content: flex-start;
    gap: 10px;
}

.message.typing-indicator .message-wrapper {
    align-items: flex-start;
    
}

.message.typing-indicator .message-content {
    background: #e9ecef;
    color: #6c757d;
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    font-size:13px;
}
