/**
 * AyendeCX Chatbot Widget Styles
 * Theme: Dark Blue
 */

:root {
    /* Dark Blue Theme */
    --chatbot-primary: #1E40AF;
    --chatbot-primary-dark: #1E3A8A;
    --chatbot-secondary: #EFF6FF;
    --chatbot-text: #1F2937;
    --chatbot-text-light: #6B7280;
    --chatbot-border: #E5E7EB;
    --chatbot-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --chatbot-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Container */
#chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow-lg);
    display: flex;
    flex-direction: column;
    transform: scale(0);
    transform-origin: bottom right;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    overflow: hidden;
}

#chatbot-container.open {
    transform: scale(1);
    opacity: 1;
}

/* Header */
#chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    flex: 1;
}

.header-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    background: #10B981;
}

.status-indicator.online::before {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Messages Area */
#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #F9FAFB;
}

#chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

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

#chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

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

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

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

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

.system-message {
    align-items: center;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.user-message .message-bubble {
    background: var(--chatbot-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-bubble {
    background: #374151;
    color: #F3F4F6;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.system-message .message-bubble {
    background: #1F2937;
    color: #60A5FA;
    font-style: italic;
    text-align: center;
    border: 1px solid #3B82F6;
    max-width: 90%;
}

.message-timestamp {
    font-size: 11px;
    color: var(--chatbot-text-light);
    margin-top: 4px;
    padding: 0 4px;
}

.message-error {
    background: #FEE2E2;
    color: #991B1B;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

/* Typing Indicator */
#chatbot-typing-indicator {
    padding: 0 20px 10px;
    background: #F9FAFB;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chatbot-text-light);
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Input Area */
#chatbot-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
    border-radius: 0 0 16px 16px;
}

#chatbot-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#chatbot-input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 200px;
    overflow-y: auto;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    line-height: 1.5;
}

#chatbot-input:focus {
    border-color: var(--chatbot-primary);
}

#chatbot-end {
    background: transparent;
    border: none;
    color: #DC2626;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

#chatbot-end:hover {
    background: rgba(220, 38, 38, 0.1);
    transform: scale(1.1);
}

#chatbot-end:active {
    transform: scale(0.95);
}

#chatbot-end svg {
    width: 20px;
    height: 20px;
}

#chatbot-send {
    background: var(--chatbot-primary);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

#chatbot-send:hover {
    background: var(--chatbot-primary-dark);
}

#chatbot-send:active {
    transform: scale(0.95);
}

/* Toggle Button (FAB) */
.chatbot-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border: none;
    color: white;
    box-shadow: var(--chatbot-shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
}

.chatbot-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 30px -5px rgba(30, 64, 175, 0.4);
}

.chatbot-fab:active {
    transform: scale(1.05);
}

.chatbot-fab.hidden {
    transform: scale(0);
    opacity: 0;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #chatbot-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    #chatbot-header {
        border-radius: 0;
    }

    #chatbot-input-area {
        border-radius: 0;
    }

    .chatbot-fab {
        bottom: 16px;
        right: 16px;
    }
}



