/* MR Agency Chatbot Styles */

:root {
    --mr-chatbot-primary: #4F46E5;
    --mr-chatbot-primary-dark: #4338CA;
    --mr-chatbot-bg: #FFFFFF;
    --mr-chatbot-text: #1F2937;
    --mr-chatbot-text-light: #6B7280;
    --mr-chatbot-border: #E5E7EB;
    --mr-chatbot-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Chat Button */
#mr-chatbot-button {
    position: fixed;
    z-index: 9998;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--mr-chatbot-primary);
    border: none;
    cursor: pointer;
    box-shadow: var(--mr-chatbot-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#mr-chatbot-button:hover {
    background: var(--mr-chatbot-primary-dark);
    transform: scale(1.05);
}

#mr-chatbot-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

#mr-chatbot-button.active svg.chat-icon {
    display: none;
}

#mr-chatbot-button svg.close-icon {
    display: none;
}

#mr-chatbot-button.active svg.close-icon {
    display: block;
}

/* Speech Bubble */
.mr-chatbot-bubble {
    position: fixed !important;
    z-index: 9997 !important;
    background: white !important;
    color: var(--mr-chatbot-text) !important;
    padding: 12px 16px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    font-size: 14px !important;
    max-width: 200px !important;
    animation: bubbleFadeIn 0.3s ease, bubbleBounce 2s ease-in-out infinite !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.mr-chatbot-bubble::after {
    content: '' !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    border-style: solid !important;
}

/* Bubble arrow positioning based on button position */
.mr-chatbot-bottom-right .mr-chatbot-bubble {
    bottom: 70px;
    right: 80px;
}

.mr-chatbot-bottom-right .mr-chatbot-bubble::after {
    bottom: -8px;
    right: 10px;
    border-width: 8px 8px 0 8px;
    border-color: white transparent transparent transparent;
}

.mr-chatbot-bottom-left .mr-chatbot-bubble {
    bottom: 70px;
    left: 80px;
}

.mr-chatbot-bottom-left .mr-chatbot-bubble::after {
    bottom: -8px;
    left: 10px;
    border-width: 8px 8px 0 8px;
    border-color: white transparent transparent transparent;
}

/* Hide bubble when chat is open */
#mr-chatbot-container.active ~ .mr-chatbot-bubble {
    display: none !important;
}

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

@keyframes bubbleBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Position variants */
.mr-chatbot-bottom-right #mr-chatbot-button {
    bottom: 20px;
    right: 20px;
}

.mr-chatbot-bottom-left #mr-chatbot-button {
    bottom: 20px;
    left: 20px;
}

/* Chat Container */
#mr-chatbot-container {
    position: fixed;
    z-index: 9999;
    width: 380px;
    height: 600px;
    max-height: 85vh;
    background: var(--mr-chatbot-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

#mr-chatbot-container.active {
    display: flex;
}

.mr-chatbot-bottom-right #mr-chatbot-container {
    bottom: 90px;
    right: 20px;
}

.mr-chatbot-bottom-left #mr-chatbot-container {
    bottom: 90px;
    left: 20px;
}

/* Header */
#mr-chatbot-header {
    background: var(--mr-chatbot-primary);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#mr-chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

#mr-chatbot-title {
    flex: 1;
}

#mr-chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#mr-chatbot-title p {
    margin: 4px 0 0;
    font-size: 12px;
    opacity: 0.9;
}

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

.mr-chatbot-message {
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}

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

.mr-chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.mr-chatbot-message.bot .mr-chatbot-message-avatar {
    background: var(--mr-chatbot-primary);
    color: white;
}

.mr-chatbot-message.user .mr-chatbot-message-avatar {
    background: #E5E7EB;
    color: #6B7280;
}

.mr-chatbot-message-content {
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.mr-chatbot-message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.mr-chatbot-message.bot .mr-chatbot-message-bubble {
    background: white;
    color: var(--mr-chatbot-text);
    border: 1px solid var(--mr-chatbot-border);
}

.mr-chatbot-message.user {
    flex-direction: row-reverse;
}

.mr-chatbot-message.user .mr-chatbot-message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.mr-chatbot-message.user .mr-chatbot-message-bubble {
    background: var(--mr-chatbot-primary);
    color: white;
}

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

/* Typing Indicator */
.mr-chatbot-typing {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    border: 1px solid var(--mr-chatbot-border);
}

.mr-chatbot-typing.active {
    display: flex;
}

.mr-chatbot-typing-dots {
    display: flex;
    gap: 4px;
}

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

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

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

#mr-chatbot-input-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#mr-chatbot-input {
    flex: 1;
    border: 1px solid var(--mr-chatbot-border);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

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

#mr-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--mr-chatbot-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

#mr-chatbot-send:hover:not(:disabled) {
    background: var(--mr-chatbot-primary-dark);
    transform: scale(1.05);
}

#mr-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#mr-chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Scrollbar */
#mr-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

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

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

/* Powered by */
#mr-chatbot-footer {
    padding: 8px 20px;
    background: #F9FAFB;
    border-top: 1px solid var(--mr-chatbot-border);
    text-align: center;
    font-size: 11px;
    color: var(--mr-chatbot-text-light);
}

#mr-chatbot-footer a {
    color: var(--mr-chatbot-primary);
    text-decoration: none;
}
