/**
 * Chatbot Widget Modal - Professional chat interface
 * Integrated into all public pages
 */

/* Widget Container */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* Toggle Button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-toggle:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.6);
}

.chatbot-toggle:active {
    transform: translateY(-2px);
}

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

/* Modal */
.chatbot-modal {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 420px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
}

.chatbot-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Modal Header */
.chatbot-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.chatbot-modal-header p {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

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

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

/* Message Styles */
.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
    animation: messageSlideIn 0.3s ease-out;
}

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

/* User Message */
.user-message {
    align-items: flex-end;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-right-radius: 4px;
    max-width: 85%;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* Bot Message */
.bot-message {
    align-items: flex-start;
}

.bot-message .message-content {
    background: white;
    color: #2d3748;
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    max-width: 90%;
    border-left: 3px solid #667eea;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Message Status */
.message-error .message-content {
    background: #fff5f5;
    border-left-color: #fc8181;
    color: #c53030;
}

.message-info .message-content {
    background: #fffaf0;
    border-left-color: #f6ad55;
    color: #7c2d12;
}

/* Message Content */
.message-content {
    font-size: 13px;
    line-height: 1.5;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content ul {
    margin: 6px 0;
    padding-left: 18px;
    list-style: disc;
}

.message-content li {
    margin: 2px 0;
}

.message-content a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content p {
    margin: 4px 0;
}

.message-content p:first-child {
    margin-top: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Loading Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 14px;
    border-left: 3px solid #667eea;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Quick Commands */
.chatbot-modal-quick-commands {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.quick-cmd {
    background: #f0f4ff;
    border: 1px solid #d1d5db;
    padding: 7px 12px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #2d3748;
    white-space: nowrap;
}

.quick-cmd:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.quick-cmd:active {
    transform: translateY(0);
}

/* Input Area */
.chatbot-modal-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 16px 16px;
}

.chatbot-input-field {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.chatbot-input-field:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chatbot-input-field::placeholder {
    color: #9ca3af;
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chatbot-send-btn:active {
    transform: translateY(0);
}

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

/* Scrollbar */
.chatbot-modal-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.chatbot-modal-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    .chatbot-modal {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 66px;
        right: 10px;
        max-width: 400px;
    }

    .user-message .message-content {
        max-width: 80%;
    }

    .bot-message .message-content {
        max-width: 85%;
    }

    .chatbot-modal-header {
        padding: 16px;
    }

    .chatbot-modal-header h3 {
        font-size: 16px;
    }

    .chatbot-modal-input {
        gap: 6px;
        padding: 10px;
    }

    .chatbot-send-btn {
        width: 36px;
        height: 36px;
    }

    .quick-cmd {
        font-size: 11px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .chatbot-modal {
        width: calc(100vw - 10px);
        max-width: none;
    }

    .chatbot-quick-commands {
        padding: 10px;
    }
}
