/* ====================
   Chatbot Widget Styles
   ==================== */

/* Toggle Button */
.chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle.hidden {
    display: none;
}

/* Container */
.chatbot-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 48px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chatbot-container.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-shrink: 0;
}

.chatbot-header-content {
    flex: 1;
}

.chatbot-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
}

.chatbot-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    margin-left: 12px;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Messages Container */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Message Bubble */
.chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: fadeIn 0.3s ease;
}

.chatbot-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chatbot-message.bot {
    align-self: flex-start;
    align-items: flex-start;
}

.chatbot-message.error {
    align-self: center;
    max-width: 90%;
}

.chatbot-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    position: relative;
}

.chatbot-message.user .chatbot-message-bubble {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message.bot .chatbot-message-bubble {
    background: white;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chatbot-message.error .chatbot-message-bubble {
    background: #fee;
    color: #c53030;
    border: 1px solid #feb2b2;
    border-radius: 12px;
}

.chatbot-message-content {
    white-space: pre-wrap;
}

.chatbot-message-timestamp {
    font-size: 11px;
    color: #718096;
    margin-top: 4px;
    padding: 0 4px;
}

.chatbot-message.user .chatbot-message-timestamp {
    color: rgba(255, 255, 255, 0.7);
}

/* Streaming Cursor */
.chatbot-streaming-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: currentColor;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Typing Indicator */
.chatbot-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    max-width: 60px;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a0aec0;
    animation: typing 1.4s infinite;
}

.chatbot-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Area */
.chatbot-input-area {
    border-top: 1px solid #e2e8f0;
    padding: 16px;
    background: white;
    flex-shrink: 0;
}

.chatbot-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.chatbot-input:focus {
    outline: none;
    border-color: #2563eb;
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chatbot-input:disabled {
    background: #edf2f7;
    cursor: not-allowed;
    opacity: 0.6;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.chatbot-send:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.chatbot-send:active:not(:disabled) {
    transform: scale(0.95);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .chatbot-header {
        padding: 16px;
    }

    .chatbot-title {
        font-size: 18px;
    }

    .chatbot-subtitle {
        font-size: 12px;
    }

    .chatbot-messages {
        padding: 16px;
    }

    .chatbot-input-area {
        padding: 12px;
    }
}

