/**
 * MM Chat Widget Styles
 * Brand Colors: Green #409b39, Black #000, White #fff
 */

/* CSS Variables */
:root {
    --mm-primary: #409b39;
    --mm-primary-hover: #357a2e;
    --mm-primary-light: #e8f5e7;
    --mm-black: #000000;
    --mm-white: #ffffff;
    --mm-gray-100: #f7f7f7;
    --mm-gray-200: #e5e5e5;
    --mm-gray-300: #d4d4d4;
    --mm-gray-400: #a3a3a3;
    --mm-gray-500: #737373;
    --mm-gray-600: #525252;
    --mm-gray-700: #404040;
    --mm-gray-800: #262626;
    --mm-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --mm-shadow-hover: 0 6px 25px rgba(0, 0, 0, 0.2);
    --mm-radius: 12px;
    --mm-radius-sm: 8px;
    --mm-transition: all 0.2s ease;
}

/* Reset for widget */
.mm-chat-widget,
.mm-chat-widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Widget Container */
.mm-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-size: 14px;
    line-height: 1.5;
}

/* Chat Bubble */
.mm-chat-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--mm-primary);
    color: var(--mm-white);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: var(--mm-shadow);
    transition: var(--mm-transition);
    font-size: 14px;
    font-weight: 500;
}

.mm-chat-bubble:hover {
    background: var(--mm-primary-hover);
    box-shadow: var(--mm-shadow-hover);
    transform: translateY(-2px);
}

.mm-chat-bubble:active {
    transform: translateY(0);
}

.mm-chat-icon {
    width: 20px;
    height: 20px;
}

.mm-chat-bubble-text {
    white-space: nowrap;
}

/* Chat Window */
.mm-chat-window {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 100px);
    background: var(--mm-white);
    border-radius: var(--mm-radius);
    box-shadow: var(--mm-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mm-chat-slide-up 0.3s ease;
}

@keyframes mm-chat-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.mm-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--mm-black);
    color: var(--mm-white);
    flex-shrink: 0;
}

.mm-chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
}

.mm-chat-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--mm-primary);
    border-radius: 6px;
    font-weight: bold;
    font-size: 12px;
}

.mm-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mm-chat-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--mm-white);
    cursor: pointer;
    border-radius: var(--mm-radius-sm);
    transition: var(--mm-transition);
}

.mm-chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mm-chat-header-btn svg {
    width: 18px;
    height: 18px;
}

.mm-chat-end-btn {
    padding: 6px 12px;
    background: var(--mm-primary);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
}

.mm-chat-end-btn:hover {
    background: var(--mm-primary-hover);
}

/* Content Area */
.mm-chat-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mm-chat-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

/* Selection Screen */
#mm-chat-selection {
    justify-content: center;
}

.mm-chat-selection-prompt {
    text-align: center;
    color: var(--mm-gray-600);
    margin-bottom: 20px;
    font-size: 15px;
}

.mm-chat-selection-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mm-chat-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--mm-gray-100);
    border: 2px solid transparent;
    border-radius: var(--mm-radius-sm);
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: var(--mm-gray-700);
    transition: var(--mm-transition);
}

.mm-chat-option:hover {
    background: var(--mm-primary-light);
    border-color: var(--mm-primary);
    color: var(--mm-black);
}

.mm-chat-option-icon {
    font-size: 20px;
}

.mm-chat-language-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--mm-gray-200);
}

.mm-chat-lang-btn {
    padding: 6px 14px;
    background: var(--mm-gray-100);
    border: 1px solid var(--mm-gray-200);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--mm-gray-500);
    transition: var(--mm-transition);
}

.mm-chat-lang-btn:hover {
    background: var(--mm-gray-200);
}

.mm-chat-lang-btn.mm-chat-lang-active {
    background: var(--mm-black);
    border-color: var(--mm-black);
    color: var(--mm-white);
}

/* Main Chat Screen */
#mm-chat-main {
    padding: 0;
}

/* Disclaimer */
.mm-chat-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    background: #fff8e6;
    border-bottom: 1px solid #f0e6cc;
    font-size: 12px;
    color: var(--mm-gray-600);
    flex-shrink: 0;
}

.mm-chat-disclaimer-icon {
    flex-shrink: 0;
}

/* Messages Container */
.mm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Bubbles */
.mm-chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--mm-radius);
    font-size: 14px;
    line-height: 1.5;
    animation: mm-chat-message-appear 0.2s ease;
}

@keyframes mm-chat-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mm-chat-message-user {
    align-self: flex-end;
    background: var(--mm-primary);
    color: var(--mm-white);
    border-bottom-right-radius: 4px;
}

.mm-chat-message-ai {
    align-self: flex-start;
    background: var(--mm-gray-100);
    color: var(--mm-gray-800);
    border-bottom-left-radius: 4px;
}

.mm-chat-message-escalation {
    background: #fff3e6;
    border: 1px solid #ffe0b2;
    color: var(--mm-gray-700);
}

/* Typing Indicator */
.mm-chat-typing {
    padding: 0 16px 16px;
}

.mm-chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--mm-gray-100);
    border-radius: var(--mm-radius);
}

.mm-chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--mm-gray-400);
    border-radius: 50%;
    animation: mm-chat-typing-bounce 1.4s infinite ease-in-out;
}

.mm-chat-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes mm-chat-typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Inactivity Warning */
.mm-chat-inactivity-warning {
    padding: 10px 16px;
    background: #fff3e6;
    border-top: 1px solid #ffe0b2;
    font-size: 12px;
    color: #e65100;
    text-align: center;
}

/* Input Area */
.mm-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--mm-gray-200);
    background: var(--mm-white);
    flex-shrink: 0;
}

.mm-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mm-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--mm-gray-300);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: var(--mm-transition);
}

.mm-chat-input:focus {
    border-color: var(--mm-primary);
    box-shadow: 0 0 0 3px rgba(64, 155, 57, 0.1);
}

.mm-chat-input::placeholder {
    color: var(--mm-gray-400);
}

.mm-chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--mm-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--mm-transition);
}

.mm-chat-send-btn:hover:not(:disabled) {
    background: var(--mm-primary-hover);
    transform: scale(1.05);
}

.mm-chat-send-btn:disabled {
    background: var(--mm-gray-300);
    cursor: not-allowed;
}

.mm-chat-send-btn svg {
    width: 18px;
    height: 18px;
    color: var(--mm-white);
}

/* End Screen */
#mm-chat-end-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.mm-chat-end-content {
    max-width: 280px;
}

.mm-chat-end-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--mm-primary-light);
    color: var(--mm-primary);
    border-radius: 50%;
    font-size: 28px;
    margin-bottom: 16px;
}

.mm-chat-end-content h3 {
    font-size: 18px;
    color: var(--mm-black);
    margin-bottom: 8px;
}

.mm-chat-end-content p {
    font-size: 14px;
    color: var(--mm-gray-600);
    margin-bottom: 16px;
}

.mm-chat-end-contact {
    padding: 12px;
    background: var(--mm-gray-100);
    border-radius: var(--mm-radius-sm);
    margin-bottom: 20px;
}

.mm-chat-end-contact p {
    margin-bottom: 4px;
    font-size: 13px;
}

.mm-chat-restart-btn {
    padding: 12px 24px;
    background: var(--mm-primary);
    color: var(--mm-white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--mm-transition);
}

.mm-chat-restart-btn:hover {
    background: var(--mm-primary-hover);
}

/* Utility Classes */
.mm-chat-hidden {
    display: none !important;
}

/* Responsive Styles */
@media (max-width: 480px) {
    .mm-chat-widget {
        bottom: 0;
        right: 0;
        left: 0;
    }

    .mm-chat-bubble {
        position: fixed;
        bottom: 20px;
        right: 20px;
    }

    .mm-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

/* Scrollbar Styling */
.mm-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.mm-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.mm-chat-messages::-webkit-scrollbar-thumb {
    background: var(--mm-gray-300);
    border-radius: 3px;
}

.mm-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--mm-gray-400);
}

/* Print Styles - Hide chat widget when printing */
@media print {
    .mm-chat-widget {
        display: none !important;
    }
}
