/* Enhanced Chatbot Popup Styles */

/* Chatbot floating button */
.chatbot-floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: none; /* Hidden by default, shown when user is logged in */
}

.chatbot-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.chatbot-floating-btn.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(76, 175, 80, 0.6);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
}

/* Chatbot popup container */
.chatbot-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    transition: width 0.3s ease, height 0.3s ease;
    resize: both;
    min-width: 320px;
    min-height: 400px;
    max-width: 800px;
    max-height: 80vh;
}

/* Chatbot size modes */
.chatbot-popup.compact {
    width: 320px;
    height: 400px;
}

.chatbot-popup.normal {
    width: 380px;
    height: 500px;
}

.chatbot-popup.expanded {
    width: 600px;
    height: 700px;
}

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

/* Chatbot header */
.chatbot-header {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-left {
    flex: 1;
}

.chatbot-header-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-expand-btn,
.chatbot-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background-color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-expand-btn:hover,
.chatbot-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chatbot-expand-btn {
    font-size: 14px;
}

.chatbot-close-btn {
    font-size: 18px;
}

/* Chatbot messages area */
.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chatbot-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    animation: messageSlide 0.3s ease-out;
}

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

.chatbot-message.user {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.chatbot-message.bot {
    background: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e0e0e0;
}

.chatbot-message.system {
    background: #fff3cd;
    color: #856404;
    align-self: center;
    font-style: italic;
    font-size: 12px;
    border: 1px solid #ffeaa7;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    padding: 10px 15px;
    margin-bottom: 10px;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #999;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chatbot input area */
.chatbot-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #4caf50;
}

.chatbot-send-btn {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
}

.chatbot-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Quick actions */
.chatbot-quick-actions {
    padding: 10px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-height: 80px;
    overflow-y: auto;
}

.quick-action-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn.contextual {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    font-size: 11px;
    padding: 4px 10px;
    opacity: 0.8;
}

.quick-action-btn:hover {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
}

.quick-action-btn.contextual:hover {
    background: #2196f3;
    color: white;
    border-color: #2196f3;
    opacity: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .chatbot-popup {
        width: calc(100vw - 40px);
        height: 400px;
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    .chatbot-floating-btn {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Custom scrollbar for messages */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Role indicator */
.chatbot-role-indicator {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 2px;
}

/* Welcome message styling */
.chatbot-welcome {
    text-align: center;
    padding: 20px;
    color: #666;
}

.chatbot-welcome h4 {
    margin: 0 0 10px 0;
    color: #333;
}

.chatbot-welcome p {
    margin: 0;
    font-size: 13px;
}


.chatbot-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chatbot-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

/* Resize handle styling */
.chatbot-popup::-webkit-resizer {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    border-radius: 0 0 15px 0;
}

/* Responsive adjustments for expanded mode */
@media (max-width: 768px) {
    .chatbot-popup.expanded {
        width: calc(100vw - 40px);
        height: 600px;
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
}

