/**
 * Made To Fit AI Chat Widget - Premium Styles
 *
 * Design System with Made To Fit branding
 *
 * @package MTF_AI_Chat
 */

/* ========================================
   CSS DESIGN SYSTEM - MADE TO FIT BRANDING
   ======================================== */

:root {
    /* Made To Fit Brand Colors */
    --mtf-primary: #061C1C;
    --mtf-highlight: #FFEAD5;
    --mtf-accent: #8FA29A;

    /* Semantic Colors */
    --mtf-success: #10b981;
    --mtf-error: #ef4444;
    --mtf-warning: #f59e0b;
    --mtf-info: #3b82f6;

    /* Neutral Palette */
    --mtf-white: #ffffff;
    --mtf-gray-50: #f9fafb;
    --mtf-gray-100: #f3f4f6;
    --mtf-gray-200: #e5e7eb;
    --mtf-gray-300: #d1d5db;
    --mtf-gray-400: #9ca3af;
    --mtf-gray-500: #6b7280;
    --mtf-gray-600: #4b5563;
    --mtf-gray-700: #374151;
    --mtf-gray-800: #1f2937;
    --mtf-gray-900: #111827;

    /* Spacing (8px grid system) */
    --mtf-space-1: 8px;
    --mtf-space-2: 16px;
    --mtf-space-3: 24px;
    --mtf-space-4: 32px;
    --mtf-space-5: 40px;
    --mtf-space-6: 48px;

    /* Border Radius */
    --mtf-radius-sm: 8px;
    --mtf-radius-md: 12px;
    --mtf-radius-lg: 16px;
    --mtf-radius-xl: 20px;
    --mtf-radius-full: 9999px;

    /* Shadows */
    --mtf-shadow-sm: 0 1px 3px rgba(6, 28, 28, 0.08);
    --mtf-shadow-md: 0 2px 8px rgba(6, 28, 28, 0.12);
    --mtf-shadow-lg: 0 4px 16px rgba(6, 28, 28, 0.16);
    --mtf-shadow-xl: 0 8px 32px rgba(6, 28, 28, 0.24);

    /* Typography */
    --mtf-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --mtf-font-size-xs: 13px;
    --mtf-font-size-sm: 15px;
    --mtf-font-size-base: 16px;
    --mtf-font-size-lg: 18px;
    --mtf-font-size-xl: 22px;
    --mtf-line-height-tight: 1.4;
    --mtf-line-height-normal: 1.6;
    --mtf-line-height-relaxed: 1.8;
    --mtf-letter-spacing-tight: -0.01em;
    --mtf-letter-spacing-normal: 0;
    --mtf-letter-spacing-wide: 0.02em;

    /* Transitions */
    --mtf-transition-fast: 150ms ease;
    --mtf-transition-base: 200ms ease;
    --mtf-transition-slow: 300ms ease;

    /* Z-index */
    --mtf-z-widget: 999999;
    --mtf-z-toast: 1000000;
}

/* ========================================
   BASE STYLES
   ======================================== */

#mtf-chat-button *,
#mtf-chat-interface *,
.mtf-toast-container * {
    box-sizing: border-box;
    font-family: var(--mtf-font-family);
}

/* ========================================
   FONT AWESOME ICON STYLING
   ======================================== */

.mtf-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--mtf-transition-base);
}

.mtf-icon-xs { font-size: 10px; }
.mtf-icon-sm { font-size: 12px; }
.mtf-icon-md { font-size: 14px; }
.mtf-icon-lg { font-size: 16px; }
.mtf-icon-xl { font-size: 18px; }

.mtf-icon-primary { color: var(--mtf-primary); }
.mtf-icon-accent { color: var(--mtf-accent); }
.mtf-icon-success { color: var(--mtf-success); }
.mtf-icon-error { color: var(--mtf-error); }
.mtf-icon-warning { color: var(--mtf-warning); }
.mtf-icon-white { color: var(--mtf-white); }

.mtf-icon-spin {
    animation: mtfIconSpin 1s linear infinite;
}

@keyframes mtfIconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   CHAT BUTTON
   ======================================== */

#mtf-chat-button {
    position: fixed;
    bottom: var(--mtf-space-3);
    right: var(--mtf-space-3);
    z-index: var(--mtf-z-widget);
}

#mtf-toggle-chat {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: var(--mtf-radius-full);
    background: var(--mtf-primary);
    color: var(--mtf-white);
    border: none;
    box-shadow: var(--mtf-shadow-xl);
    cursor: pointer;
    transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
    animation: mtfButtonGlow 2.5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mtf-toggle-chat:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 35px rgba(143, 162, 154, 0.5), 0 0 30px rgba(143, 162, 154, 0.35);
    animation: none;
}

#mtf-toggle-chat:active {
    transform: scale(0.98);
}

#mtf-toggle-chat .mtf-ai-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: auto;
    min-width: 28px;
    height: 18px;
    padding: 0 6px;
    background: linear-gradient(135deg, #FFEAD5 0%, #f5d4b3 100%);
    border: 1.5px solid rgba(255, 234, 213, 0.6);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8.5px;
    font-weight: 700;
    color: #061C1C;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    box-shadow: 0 1px 4px rgba(6, 28, 28, 0.25), 0 0 8px rgba(255, 234, 213, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    animation: mtfBadgeShimmer 3s ease-in-out infinite;
    line-height: 1;
    z-index: 1;
}

/* ========================================
   CHAT INTERFACE
   ======================================== */

#mtf-chat-interface {
    position: fixed;
    bottom: 100px;
    right: var(--mtf-space-3);
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: var(--mtf-radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: var(--mtf-z-widget);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: mtfSlideUp var(--mtf-transition-slow);
}

#mtf-chat-interface.active {
    display: flex;
}

/* Header */
#mtf-chat-header {
    background: var(--mtf-primary);
    color: var(--mtf-white);
    padding: var(--mtf-space-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--mtf-radius-lg) var(--mtf-radius-lg) 0 0;
}

#mtf-chat-header .mtf-bot-info {
    display: flex;
    align-items: center;
    gap: var(--mtf-space-2);
}

#mtf-chat-header .mtf-bot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: var(--mtf-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

#mtf-chat-header .mtf-bot-avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

#mtf-chat-header .mtf-bot-details h3 {
    font-size: var(--mtf-font-size-lg);
    font-weight: 700;
    margin: 0;
    line-height: var(--mtf-line-height-tight);
    letter-spacing: var(--mtf-letter-spacing-tight);
    color: var(--mtf-white);
}

#mtf-chat-header .mtf-bot-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--mtf-font-size-xs);
    color: var(--mtf-highlight);
    margin-top: 6px;
    font-weight: 500;
    letter-spacing: var(--mtf-letter-spacing-wide);
}

#mtf-chat-header .mtf-bot-status .status-dot {
    width: 8px;
    height: 8px;
    background: var(--mtf-success);
    border-radius: var(--mtf-radius-full);
    animation: mtfPulse 2s infinite;
}

#mtf-close-chat {
    width: 32px;
    height: 32px;
    border-radius: var(--mtf-radius-full);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--mtf-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--mtf-transition-base);
}

#mtf-close-chat:hover {
    background: rgba(255, 255, 255, 0.25);
}

#mtf-close-chat:active {
    opacity: 0.8;
}

/* Language Selector */
.mtf-language-selector {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: var(--mtf-space-2);
}

#mtf-language-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--mtf-radius-full);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--mtf-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--mtf-transition-base);
    padding: 0;
}

#mtf-language-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

#mtf-language-btn:active {
    opacity: 0.8;
}

#mtf-language-btn .mtf-flag {
    font-size: 16px;
    line-height: 1;
}

.mtf-language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--mtf-white);
    border-radius: var(--mtf-radius-md);
    box-shadow: var(--mtf-shadow-lg);
    border: 1px solid var(--mtf-gray-200);
    min-width: 160px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    animation: mtfDropdownSlideDown 0.2s ease;
}

.mtf-language-dropdown.active {
    display: flex;
}

.mtf-language-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--mtf-radius-sm);
    cursor: pointer;
    transition: all var(--mtf-transition-fast);
    font-family: inherit;
    font-size: var(--mtf-font-size-sm);
    color: var(--mtf-gray-700);
    font-weight: 500;
    text-align: left;
    width: 100%;
}

.mtf-language-option:hover {
    background: var(--mtf-gray-50);
    color: var(--mtf-primary);
}

.mtf-language-option:active {
    background: var(--mtf-gray-100);
}

.mtf-language-option .mtf-flag {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.mtf-language-option span:last-child {
    flex: 1;
}

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

/* Zen-like smooth typing animation */
.mtf-message-bubble.mtf-typing {
    animation: mtfZenFadeIn 0.6s ease-out;
}

.mtf-typewriter-content {
    display: inline;
}

/* Smooth transitions for markdown elements as they appear */
.mtf-typewriter-content p,
.mtf-typewriter-content ul,
.mtf-typewriter-content ol,
.mtf-typewriter-content h1,
.mtf-typewriter-content h2,
.mtf-typewriter-content h3,
.mtf-typewriter-content h4,
.mtf-typewriter-content blockquote {
    transition: all 0.3s ease-out;
}

/* Smooth line height for better readability during typing */
.mtf-typewriter-content.typing {
    line-height: 1.8;
    transition: line-height 0.3s ease;
}

.mtf-typewriter-content.typing::after {
    content: '|';
    color: var(--mtf-accent);
    animation: mtfZenCursorPulse 1.2s ease-in-out infinite;
    margin-left: 2px;
    opacity: 0.7;
}

/* Smooth zen fade-in for message bubble */
@keyframes mtfZenFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth cursor pulse (not blink - more zen) */
@keyframes mtfZenCursorPulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.9;
    }
}

/* Messages Container - RIGTIG Liquid Glass Effect */
#mtf-chat-messages {
    flex: 1;
    padding: var(--mtf-space-3);
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--mtf-space-3);
    scroll-behavior: smooth;

    /* White Background */
    background: #ffffff;
    border: none;
}


/* Glass Scrollbar */
#mtf-chat-messages::-webkit-scrollbar {
    width: 8px;
}

#mtf-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--mtf-radius-full);
    backdrop-filter: blur(4px);
}

#mtf-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(143, 162, 154, 0.5);
    border-radius: var(--mtf-radius-full);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#mtf-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(143, 162, 154, 0.7);
}

/* ========================================
   MESSAGE BUBBLES
   ======================================== */

.mtf-message {
    display: flex;
    flex-direction: column;
    gap: var(--mtf-space-1);
    animation: mtfBounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mtf-message.mtf-user {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--mtf-space-2);
    justify-content: flex-end;
}

.mtf-message-header {
    display: flex;
    align-items: center;
    gap: var(--mtf-space-2);
}

.mtf-message-subject {
    font-size: var(--mtf-font-size-sm);
    font-weight: 600;
    color: var(--mtf-gray-900);
    letter-spacing: var(--mtf-letter-spacing-tight);
}

.mtf-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--mtf-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.mtf-avatar.mtf-ai {
    background: var(--mtf-primary);
}

.mtf-avatar img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.mtf-avatar.mtf-user {
    background: var(--mtf-gray-200);
    color: var(--mtf-gray-600);
}

.mtf-message-bubble {
    position: relative;
    padding: 16px 20px;
    border-radius: var(--mtf-radius-md);
    font-size: var(--mtf-font-size-base);
    line-height: var(--mtf-line-height-relaxed);
    word-wrap: break-word;
    letter-spacing: var(--mtf-letter-spacing-normal);
}

.mtf-message.mtf-ai .mtf-message-bubble {
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    color: var(--mtf-gray-900);
    border: 1px solid rgba(143, 162, 154, 0.15);
    border-radius: var(--mtf-radius-md);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.04);
}

.mtf-message.mtf-user .mtf-message-bubble {
    max-width: 85%;
    background: var(--mtf-primary);
    color: var(--mtf-white);
    box-shadow:
        0 4px 12px rgba(16, 185, 129, 0.25),
        0 2px 4px rgba(16, 185, 129, 0.15);
    border-top-right-radius: 4px;
}

/* Markdown content in AI messages */
.mtf-message.mtf-ai .mtf-message-bubble p {
    margin: 0 0 16px 0;
    line-height: var(--mtf-line-height-relaxed);
}

.mtf-message.mtf-ai .mtf-message-bubble p:last-child {
    margin-bottom: 0;
}

/* Message Feedback Buttons - Minimalist */
.mtf-message-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--mtf-gray-100);
    animation: mtfZenFadeIn 0.4s ease-out 0.3s backwards;
}

.mtf-feedback-btn {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--mtf-radius-sm);
    padding: 6px 10px;
    color: var(--mtf-gray-400);
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mtf-feedback-btn:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--mtf-gray-600);
    transform: translateY(-1px);
}

.mtf-feedback-btn.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--mtf-primary);
}

.mtf-feedback-btn i {
    font-size: 13px;
}

/* Speed-Up Button - Shows during typing */
.mtf-speed-up-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 234, 213, 0.95);
    border: 2px solid var(--mtf-highlight);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(6, 28, 28, 0.15);
    animation: mtfSpeedUpPulse 2s ease-in-out infinite;
    z-index: 10;
}

.mtf-speed-up-btn svg {
    color: var(--mtf-primary);
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mtf-speed-up-btn:hover {
    background: var(--mtf-highlight);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(6, 28, 28, 0.25);
}

.mtf-speed-up-btn:hover svg {
    transform: translateX(2px);
}

.mtf-speed-up-btn.mtf-speed-up-active {
    background: var(--mtf-accent);
    border-color: var(--mtf-accent);
    animation: mtfSpeedUpSpin 0.5s ease-out;
}

.mtf-speed-up-btn.mtf-speed-up-active svg {
    color: var(--mtf-white);
}

/* Pulse animation for speed-up button */
@keyframes mtfSpeedUpPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(6, 28, 28, 0.15), 0 0 0 0 rgba(255, 234, 213, 0.7);
    }
    50% {
        box-shadow: 0 2px 8px rgba(6, 28, 28, 0.15), 0 0 0 8px rgba(255, 234, 213, 0);
    }
}

/* Spin animation when activated */
@keyframes mtfSpeedUpSpin {
    0% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
    }
}

/* Copy Code Button - Minimalist */
.mtf-copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--mtf-radius-sm);
    padding: 4px 8px;
    color: var(--mtf-white);
    cursor: pointer;
    transition: all 150ms ease;
    font-size: 11px;
    opacity: 0.6;
}

.mtf-copy-code-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* Headings */
.mtf-message.mtf-ai .mtf-message-bubble h1,
.mtf-message.mtf-ai .mtf-message-bubble h2,
.mtf-message.mtf-ai .mtf-message-bubble h3,
.mtf-message.mtf-ai .mtf-message-bubble h4 {
    color: var(--mtf-primary);
    font-weight: 700;
    line-height: var(--mtf-line-height-tight);
    letter-spacing: var(--mtf-letter-spacing-tight);
    margin: 24px 0 12px 0;
}

.mtf-message.mtf-ai .mtf-message-bubble h1:first-child,
.mtf-message.mtf-ai .mtf-message-bubble h2:first-child,
.mtf-message.mtf-ai .mtf-message-bubble h3:first-child,
.mtf-message.mtf-ai .mtf-message-bubble h4:first-child {
    margin-top: 0;
}

.mtf-message.mtf-ai .mtf-message-bubble h1 {
    font-size: var(--mtf-font-size-xl);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--mtf-accent);
}

.mtf-message.mtf-ai .mtf-message-bubble h2 {
    font-size: var(--mtf-font-size-lg);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--mtf-gray-200);
}

.mtf-message.mtf-ai .mtf-message-bubble h3 {
    font-size: var(--mtf-font-size-base);
}

.mtf-message.mtf-ai .mtf-message-bubble h4 {
    font-size: var(--mtf-font-size-sm);
    font-weight: 600;
}

/* Links */
.mtf-message.mtf-ai .mtf-message-bubble a {
    color: var(--mtf-accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: all var(--mtf-transition-base);
    position: relative;
    display: inline-block;
}

.mtf-message.mtf-ai .mtf-message-bubble a:hover {
    color: var(--mtf-primary);
    text-decoration-color: var(--mtf-primary);
}

.mtf-message.mtf-ai .mtf-message-bubble a:active {
    opacity: 0.8;
}

/* Text emphasis */
.mtf-message.mtf-ai .mtf-message-bubble strong {
    font-weight: 700;
    color: var(--mtf-primary);
}

.mtf-message.mtf-ai .mtf-message-bubble em {
    font-style: italic;
    color: var(--mtf-gray-700);
}

/* Blockquotes */
.mtf-message.mtf-ai .mtf-message-bubble blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 4px solid var(--mtf-accent);
    background: var(--mtf-highlight);
    border-radius: 0 var(--mtf-radius-sm) var(--mtf-radius-sm) 0;
}

.mtf-message.mtf-ai .mtf-message-bubble blockquote p {
    margin: 0;
    color: var(--mtf-gray-700);
    font-style: italic;
}

/* Horizontal rules */
.mtf-message.mtf-ai .mtf-message-bubble hr {
    margin: 24px 0;
    border: none;
    border-top: 2px solid var(--mtf-gray-200);
    background: none;
    height: 0;
}

/* Lists */
.mtf-message.mtf-ai .mtf-message-bubble ul,
.mtf-message.mtf-ai .mtf-message-bubble ol {
    margin: 16px 0;
    padding-left: 20px;
}

.mtf-message.mtf-ai .mtf-message-bubble ul {
    list-style: none;
}

.mtf-message.mtf-ai .mtf-message-bubble ul li {
    position: relative;
    padding-left: 4px;
}

.mtf-message.mtf-ai .mtf-message-bubble ul li::before {
    content: '•';
    position: absolute;
    left: -16px;
    color: var(--mtf-accent);
    font-weight: bold;
    font-size: 16px;
    line-height: 1.8;
}

.mtf-message.mtf-ai .mtf-message-bubble ol {
    counter-reset: list-counter;
}

.mtf-message.mtf-ai .mtf-message-bubble ol li {
    counter-increment: list-counter;
    position: relative;
    padding-left: 4px;
}

.mtf-message.mtf-ai .mtf-message-bubble ol li::before {
    content: counter(list-counter) '.';
    position: absolute;
    left: -20px;
    color: var(--mtf-accent);
    font-weight: 600;
    width: 16px;
    text-align: right;
}

.mtf-message.mtf-ai .mtf-message-bubble li {
    margin: 10px 0;
    line-height: var(--mtf-line-height-relaxed);
}

/* Nested lists */
.mtf-message.mtf-ai .mtf-message-bubble li ul,
.mtf-message.mtf-ai .mtf-message-bubble li ol {
    margin: 8px 0;
}

/* Inline code */
.mtf-message.mtf-ai .mtf-message-bubble code {
    background: var(--mtf-highlight);
    color: var(--mtf-primary);
    padding: 3px 8px;
    border-radius: var(--mtf-radius-sm);
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: 500;
    border: 1px solid var(--mtf-accent);
}

/* Code blocks */
.mtf-message.mtf-ai .mtf-message-bubble pre {
    background: var(--mtf-primary);
    color: var(--mtf-highlight);
    padding: 16px;
    border-radius: var(--mtf-radius-md);
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--mtf-accent);
    position: relative;
}

.mtf-message.mtf-ai .mtf-message-bubble pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    font-size: 14px;
    line-height: 1.6;
}

/* Custom scrollbar for code blocks */
.mtf-message.mtf-ai .mtf-message-bubble pre::-webkit-scrollbar {
    height: 8px;
}

.mtf-message.mtf-ai .mtf-message-bubble pre::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.mtf-message.mtf-ai .mtf-message-bubble pre::-webkit-scrollbar-thumb {
    background: var(--mtf-accent);
    border-radius: 4px;
}

.mtf-message.mtf-ai .mtf-message-bubble pre::-webkit-scrollbar-thumb:hover {
    background: var(--mtf-highlight);
}

/* ========================================
   PRODUCT CAROUSEL & CARDS
   ======================================== */

.mtf-product-carousel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mtf-carousel-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.mtf-carousel-track::-webkit-scrollbar {
    display: none;
}

.mtf-product-card {
    flex: 0 0 148px;
    scroll-snap-align: start;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.mtf-product-card:hover {
    border-color: rgba(143, 162, 154, 0.5);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.mtf-product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #f8f9fa;
    overflow: hidden;
}

.mtf-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.mtf-product-card:hover .mtf-product-image img {
    transform: scale(1.06);
}

.mtf-product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    z-index: 1;
}

.mtf-product-info {
    padding: 10px 10px 6px;
    flex: 1;
}

.mtf-product-name {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mtf-product-pricing {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
}

.mtf-price-current {
    font-size: 14px;
    font-weight: 700;
    color: #061C1C;
}

.mtf-price-was {
    font-size: 11px;
    color: #9ca3af;
    text-decoration: line-through;
}

.mtf-product-cta {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #8FA29A;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    transition: color 0.2s;
}

.mtf-product-card:hover .mtf-product-cta {
    color: #061C1C;
}

/* ========================================
   PAGE CARDS
   ======================================== */

.mtf-page-card {
    background: var(--mtf-white);
    border: 1px solid var(--mtf-gray-200);
    border-radius: var(--mtf-radius-lg);
    margin-top: 12px;
    overflow: hidden;
    transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 12px rgba(6, 28, 28, 0.06),
        0 1px 3px rgba(6, 28, 28, 0.08);
    animation: mtfZenFadeInUp 0.5s ease-out;
}

.mtf-page-card:hover {
    border-color: var(--mtf-accent);
    box-shadow:
        0 8px 24px rgba(6, 28, 28, 0.10),
        0 4px 8px rgba(6, 28, 28, 0.06);
    transform: translateY(-3px);
}

.mtf-page-card-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    position: relative;
    background: var(--mtf-gray-100);
}

.mtf-page-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mtf-page-card:hover .mtf-page-card-image img {
    transform: scale(1.05);
}

.mtf-page-card-no-image {
    background: linear-gradient(135deg, var(--mtf-primary) 0%, #0d3636 50%, var(--mtf-accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 234, 213, 0.5);
}

.mtf-page-card-body {
    padding: 16px;
}

.mtf-page-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--mtf-primary);
    margin: 0 0 8px 0;
    line-height: var(--mtf-line-height-tight);
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mtf-page-excerpt {
    font-size: 14px;
    color: var(--mtf-gray-600);
    margin: 0 0 14px 0;
    line-height: var(--mtf-line-height-normal);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mtf-page-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--mtf-accent);
    font-weight: 600;
    text-decoration: none;
    transition: all 200ms ease;
}

.mtf-page-link svg {
    transition: transform 200ms ease;
}

.mtf-page-link:hover {
    color: var(--mtf-primary);
}

.mtf-page-link:hover svg {
    transform: translateX(3px);
}

/* ========================================
   PRICE CALCULATOR CARD
   ======================================== */

.mtf-calculator-card {
    background: var(--mtf-white);
    border: 1px solid var(--mtf-gray-200);
    border-radius: var(--mtf-radius-lg);
    margin-top: 16px;
    overflow: hidden;
    animation: mtfZenFadeInUp 0.5s ease-out;
    box-shadow:
        0 4px 16px rgba(6, 28, 28, 0.08),
        0 1px 3px rgba(6, 28, 28, 0.06);
}

.mtf-calc-header {
    background: var(--mtf-primary);
    color: var(--mtf-white);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.mtf-calc-header-icon {
    font-size: 18px;
}

.mtf-calc-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mtf-calc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mtf-calc-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--mtf-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mtf-calc-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--mtf-gray-800);
    background: var(--mtf-gray-50);
    border: 1px solid var(--mtf-gray-200);
    border-radius: var(--mtf-radius-sm);
    cursor: pointer;
    transition: all var(--mtf-transition-base);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.mtf-calc-select:focus {
    outline: none;
    border-color: var(--mtf-accent);
    box-shadow: 0 0 0 3px rgba(143, 162, 154, 0.15);
    background-color: var(--mtf-white);
}

.mtf-calc-select:hover {
    border-color: var(--mtf-gray-300);
}

.mtf-calc-breakdown {
    margin-top: 4px;
    padding: 16px 18px;
    background: var(--mtf-gray-50);
    border-top: 1px solid var(--mtf-gray-200);
}

.mtf-calc-breakdown-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--mtf-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

.mtf-calc-breakdown-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    color: var(--mtf-gray-700);
}

.mtf-calc-breakdown-line.mtf-calc-total {
    border-top: 2px solid var(--mtf-primary);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--mtf-primary);
}

.mtf-calc-breakdown-line .mtf-calc-amount {
    font-weight: 600;
    white-space: nowrap;
}

.mtf-calc-breakdown-line.mtf-calc-total .mtf-calc-amount {
    font-size: 18px;
}

.mtf-calc-vat-note {
    font-size: 12px;
    color: var(--mtf-gray-500);
    text-align: right;
    margin-top: 4px;
}

.mtf-calc-footer {
    padding: 0 18px 18px;
}

.mtf-calc-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: var(--mtf-primary);
    color: var(--mtf-white);
    border: none;
    border-radius: var(--mtf-radius-md);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(6, 28, 28, 0.2);
}

.mtf-calc-cta:hover {
    background: #0d3636;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(6, 28, 28, 0.3);
}

.mtf-calc-cta:active {
    transform: translateY(0) scale(0.98);
}

.mtf-calc-cta svg {
    transition: transform 200ms ease;
}

.mtf-calc-cta:hover svg {
    transform: translateX(3px);
}

/* Override link styling inside calculator CTA */
.mtf-message.mtf-ai .mtf-message-bubble a.mtf-calc-cta,
.mtf-message.mtf-ai .mtf-message-bubble a.mtf-calc-cta:hover {
    color: var(--mtf-highlight);
    text-decoration: none;
}

/* Calculator responsive */
@media (max-width: 768px) {
    .mtf-calc-select {
        font-size: 16px;
        padding: 12px 14px;
        padding-right: 32px;
    }

    .mtf-calc-body {
        padding: 14px;
    }

    .mtf-calc-breakdown {
        padding: 14px;
    }

    .mtf-calc-footer {
        padding: 0 14px 14px;
    }

    .mtf-calc-cta {
        padding: 16px 20px;
        min-height: 48px;
    }
}

/* ========================================
   QUICK ACTIONS
   ======================================== */

.mtf-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-left: 0; /* Left-aligned like messages */
    margin-top: 4px;
    margin-bottom: 12px;
}

.mtf-quick-action {
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--mtf-radius-md);
    padding: 10px 16px;
    font-size: var(--mtf-font-size-sm);
    color: var(--mtf-gray-900);
    font-weight: 500;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    animation: mtfZenFadeInScale 0.4s ease-out;
    animation-fill-mode: backwards;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Stagger animation for quick actions */
.mtf-quick-action:nth-child(1) { animation-delay: 0.1s; }
.mtf-quick-action:nth-child(2) { animation-delay: 0.2s; }
.mtf-quick-action:nth-child(3) { animation-delay: 0.3s; }
.mtf-quick-action:nth-child(4) { animation-delay: 0.4s; }
.mtf-quick-action:nth-child(5) { animation-delay: 0.5s; }
.mtf-quick-action:nth-child(6) { animation-delay: 0.6s; }

@keyframes mtfZenFadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.mtf-quick-action:hover {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--mtf-primary);
    box-shadow:
        0 6px 16px rgba(16, 185, 129, 0.12),
        0 2px 4px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* ========================================
   SUGGESTED REPLY CHIPS
   ======================================== */

.mtf-suggested-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 12px 0;
    animation: mtfZenFadeInScale 0.3s ease-out;
}

.mtf-suggested-reply {
    background: transparent;
    border: 1.5px solid var(--mtf-accent, #10b981);
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--mtf-accent, #10b981);
    font-weight: 500;
    cursor: pointer;
    transition: all 200ms ease;
    font-family: inherit;
    line-height: 1.3;
}

.mtf-suggested-reply:hover {
    background: var(--mtf-accent, #10b981);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16, 185, 129, 0.25);
}

/* ========================================
   TYPING INDICATOR
   ======================================== */

#mtf-typing-indicator {
    display: flex;
    gap: var(--mtf-space-2);
}

.mtf-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.mtf-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--mtf-accent);
    border-radius: var(--mtf-radius-full);
    animation: mtfTyping 1.4s infinite both;
}

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

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

/* ========================================
   FOLLOW-UP QUESTION CHIPS
   ======================================== */

.mtf-followup-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--mtf-gray-100);
    animation: mtfFollowupFadeIn 0.5s ease-out 0.3s backwards;
}

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

.mtf-followup-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--mtf-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mtf-followup-label i {
    font-size: 11px;
    color: var(--mtf-accent);
}

.mtf-followup-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mtf-followup-chip {
    background: var(--mtf-gray-50);
    border: 1px solid var(--mtf-gray-200);
    border-radius: var(--mtf-radius-full);
    padding: 8px 16px;
    font-size: 13px;
    color: var(--mtf-gray-700);
    font-weight: 500;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    line-height: 1.3;
}

.mtf-followup-chip:hover {
    background: var(--mtf-primary);
    border-color: var(--mtf-primary);
    color: var(--mtf-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 28, 28, 0.2);
}

.mtf-followup-chip:active {
    transform: translateY(0) scale(0.98);
}

.mtf-followup-chip:nth-child(1) { animation: mtfFollowupFadeIn 0.4s ease-out 0.4s backwards; }
.mtf-followup-chip:nth-child(2) { animation: mtfFollowupFadeIn 0.4s ease-out 0.5s backwards; }
.mtf-followup-chip:nth-child(3) { animation: mtfFollowupFadeIn 0.4s ease-out 0.6s backwards; }

.mtf-typing-phase {
    font-size: 11px;
    font-style: italic;
    color: var(--mtf-gray-400);
    margin-bottom: 4px;
    animation: mtfZenFadeIn 0.3s ease-out;
}

/* ========================================
   INPUT AREA
   ======================================== */

#mtf-chat-input {
    padding: var(--mtf-space-3);
    border-top: 1px solid rgba(143, 162, 154, 0.15);
    background: rgba(255, 255, 255, 0.98);
    border-radius: 0 0 var(--mtf-radius-lg) var(--mtf-radius-lg);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

.mtf-input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--mtf-space-2);
    position: relative;
}

#mtf-message-input {
    flex: 1;
    background: #f9fafb;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--mtf-radius-md);
    padding: 12px 96px 12px 16px;
    font-size: var(--mtf-font-size-base);
    outline: none;
    font-family: inherit;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    line-height: var(--mtf-line-height-normal);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    resize: none;
    overflow-y: hidden;
    min-height: 48px;
    max-height: 120px;
}

#mtf-message-input:focus {
    background: #ffffff;
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

#mtf-message-input::placeholder {
    color: var(--mtf-gray-400);
}

#mtf-reset-chat {
    position: absolute;
    right: 44px;
    width: 36px;
    height: 36px;
    background: var(--mtf-gray-200);
    color: var(--mtf-gray-600);
    border: none;
    border-radius: var(--mtf-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#mtf-reset-chat:hover {
    background: var(--mtf-gray-300);
    color: var(--mtf-gray-700);
    transform: rotate(180deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#mtf-reset-chat:active {
    transform: rotate(180deg) scale(0.95);
}

#mtf-send-message {
    position: absolute;
    right: 4px;
    width: 36px;
    height: 36px;
    background: var(--mtf-primary);
    color: var(--mtf-white);
    border: none;
    border-radius: var(--mtf-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 2px 8px rgba(16, 185, 129, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.1);
}

#mtf-send-message:hover {
    background: var(--mtf-accent);
    box-shadow:
        0 4px 12px rgba(16, 185, 129, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px) scale(1.05);
}

#mtf-send-message:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Human Support Button - Minimalist */
.mtf-human-support {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mtf-request-human {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--mtf-font-size-xs);
    color: var(--mtf-gray-500);
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 150ms ease;
    font-family: inherit;
}

#mtf-request-human:hover {
    color: var(--mtf-primary);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.mtf-toast-container {
    position: fixed;
    top: var(--mtf-space-3);
    right: var(--mtf-space-3);
    z-index: var(--mtf-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--mtf-space-2);
    max-width: 400px;
}

.mtf-toast {
    background: var(--mtf-white);
    border-radius: var(--mtf-radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    border-left: 3px solid var(--mtf-gray-300);
}

.mtf-toast.mtf-toast-success {
    border-left-color: var(--mtf-success);
}

.mtf-toast.mtf-toast-error {
    border-left-color: var(--mtf-error);
}

.mtf-toast.mtf-toast-warning {
    border-left-color: var(--mtf-warning);
}

.mtf-toast.mtf-toast-info {
    border-left-color: var(--mtf-info);
}

.mtf-toast-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.mtf-toast.mtf-toast-success .mtf-toast-icon {
    color: var(--mtf-success);
}

.mtf-toast.mtf-toast-error .mtf-toast-icon {
    color: var(--mtf-error);
}

.mtf-toast.mtf-toast-warning .mtf-toast-icon {
    color: var(--mtf-warning);
}

.mtf-toast.mtf-toast-info .mtf-toast-icon {
    color: var(--mtf-info);
}

.mtf-toast-content {
    flex: 1;
    min-width: 0;
}

.mtf-toast-message {
    font-size: var(--mtf-font-size-base);
    color: var(--mtf-gray-900);
    margin: 0;
    line-height: var(--mtf-line-height-relaxed);
    font-weight: 500;
}

.mtf-toast-close {
    width: 28px;
    height: 28px;
    border-radius: var(--mtf-radius-full);
    background: transparent;
    border: 1px solid transparent;
    color: var(--mtf-gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms ease;
    flex-shrink: 0;
}

.mtf-toast-close:hover {
    background: var(--mtf-gray-100);
    border-color: var(--mtf-gray-200);
    color: var(--mtf-gray-700);
}

.mtf-toast-close:active {
    opacity: 0.7;
}

.mtf-toast-close i {
    font-size: 14px;
}

/* ========================================
   ACCESSIBILITY & FOCUS STATES
   ======================================== */

/* Focus visible for keyboard navigation */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid var(--mtf-accent);
    outline-offset: 2px;
}

/* Focus states for interactive elements */
#mtf-toggle-chat:focus-visible {
    outline: 3px solid var(--mtf-accent);
    outline-offset: 4px;
}

#mtf-close-chat:focus-visible,
#mtf-send-message:focus-visible,
#mtf-request-human:focus-visible {
    outline: 3px solid var(--mtf-accent);
    outline-offset: 2px;
}

.mtf-quick-action:focus-visible,
.mtf-feedback-btn:focus-visible {
    outline: 3px solid var(--mtf-accent);
    outline-offset: 2px;
}

/* Screen reader only text */
.mtf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mtf-feedback-btn,
    .mtf-quick-action,
    #mtf-send-message,
    #mtf-request-human {
        border-width: 3px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes mtfButtonGlow {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(6, 28, 28, 0.24), 0 0 15px rgba(143, 162, 154, 0.2);
    }
    50% {
        box-shadow: 0 8px 32px rgba(6, 28, 28, 0.24), 0 0 25px rgba(143, 162, 154, 0.4);
    }
}

@keyframes mtfBadgeShimmer {
    0%, 100% {
        box-shadow: 0 1px 4px rgba(6, 28, 28, 0.25), 0 0 8px rgba(255, 234, 213, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 2px 8px rgba(6, 28, 28, 0.3), 0 0 14px rgba(255, 234, 213, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    }
}

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

@keyframes mtfPulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

@keyframes mtfTyping {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Bounce animation for messages */
@keyframes mtfBounceIn {
    0% {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    50% {
        transform: scale(1.02) translateY(-2px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE OPTIMIZATION
   ======================================== */

@media (max-width: 768px) {
    /* Full-screen mobile experience */
    #mtf-chat-interface {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        animation: mtfMobileSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #mtf-chat-interface.active {
        position: fixed;
        z-index: var(--mtf-z-widget);
    }

    /* Header adjustments for mobile */
    #mtf-chat-header {
        border-radius: 0;
        padding: var(--mtf-space-3);
    }

    #mtf-chat-header .mtf-bot-details h3 {
        font-size: var(--mtf-font-size-xl);
    }

    /* Increased touch targets */
    #mtf-close-chat {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    /* Language selector mobile */
    #mtf-language-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    #mtf-language-btn .mtf-flag {
        font-size: 20px;
    }

    .mtf-language-dropdown {
        min-width: 180px;
    }

    .mtf-language-option {
        padding: 14px 16px;
        min-height: 48px;
    }

    .mtf-language-option .mtf-flag {
        font-size: 20px;
    }

    /* Message area optimization */
    #mtf-chat-messages {
        padding: var(--mtf-space-2);
        gap: var(--mtf-space-2);
    }

    .mtf-message-bubble {
        max-width: 85%;
        font-size: var(--mtf-font-size-sm);
        padding: 14px 16px;
    }

    /* Input area for mobile */
    #mtf-chat-input {
        border-radius: 0;
        padding: var(--mtf-space-2);
        padding-bottom: calc(var(--mtf-space-2) + env(safe-area-inset-bottom));
    }

    #mtf-message-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 16px 56px 16px 20px;
        min-height: 48px; /* Larger touch target */
    }

    #mtf-send-message {
        width: 44px;
        height: 44px;
        right: 4px;
    }

    /* Chat button mobile optimization */
    #mtf-chat-button {
        bottom: var(--mtf-space-3);
        right: var(--mtf-space-3);
    }

    #mtf-toggle-chat {
        width: 60px;
        height: 60px;
        box-shadow: 0 8px 24px rgba(6, 28, 28, 0.3);
    }

    /* Quick actions mobile */
    .mtf-quick-actions {
        padding-left: 0;
        gap: 8px;
    }

    .mtf-quick-action {
        padding: 12px 16px;
        font-size: var(--mtf-font-size-sm);
        min-height: 44px; /* Accessible touch target */
    }

    /* Product cards mobile */
    .mtf-product-card {
        flex: 0 0 130px;
    }

    .mtf-product-name {
        font-size: 11px;
    }

    /* Page cards mobile */
    .mtf-page-card-image {
        height: 140px;
    }

    .mtf-page-card-body {
        padding: 14px;
    }

    /* Toast notifications mobile */
    .mtf-toast-container {
        top: var(--mtf-space-2);
        right: var(--mtf-space-2);
        left: var(--mtf-space-2);
        max-width: none;
    }

    .mtf-toast {
        padding: var(--mtf-space-2);
        gap: 12px;
    }

    /* Human support button mobile */
    #mtf-request-human {
        padding: 12px 18px;
        font-size: var(--mtf-font-size-sm);
        min-height: 44px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    /* Header compact mode */
    #mtf-chat-header {
        padding: var(--mtf-space-2);
    }

    #mtf-chat-header .mtf-bot-avatar {
        width: 36px;
        height: 36px;
    }

    #mtf-chat-header .mtf-bot-details h3 {
        font-size: var(--mtf-font-size-lg);
    }

    #mtf-chat-header .mtf-bot-status {
        font-size: 11px;
    }

    /* Messages compact */
    .mtf-message-bubble {
        max-width: 90%;
        padding: 12px 14px;
    }

    /* Avatars smaller on tiny screens */
    .mtf-avatar {
        width: 28px;
        height: 28px;
    }

    /* Quick actions full width */
    .mtf-quick-actions {
        padding-left: 0;
        gap: 6px;
    }

    .mtf-quick-action {
        flex: 1 1 calc(50% - 3px);
        min-width: calc(50% - 3px);
        text-align: left; /* Left-aligned text */
        justify-content: flex-start; /* Left-aligned content */
    }

    /* Product cards small screen */
    .mtf-product-card {
        flex: 0 0 120px;
    }
    .mtf-price-current {
        font-size: 12px;
    }

    /* Compact chat button */
    #mtf-toggle-chat {
        width: 56px;
        height: 56px;
    }

    #mtf-chat-button {
        bottom: var(--mtf-space-2);
        right: var(--mtf-space-2);
    }
}

/* Mobile-specific animations */
@keyframes mtfMobileSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Safe area support for iOS notch */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        #mtf-chat-input {
            padding-bottom: calc(var(--mtf-space-2) + env(safe-area-inset-bottom));
        }

        #mtf-chat-button {
            bottom: calc(var(--mtf-space-3) + env(safe-area-inset-bottom));
        }
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--mtf-accent);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════
   AGENT TOOL RESULT CARDS
   ═══════════════════════════════════════════ */

/* Navigation button */
.mtf-navigate-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 20px;
    background: var(--mtf-primary);
    color: var(--mtf-highlight);
    border-radius: 24px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.mtf-navigate-btn:hover {
    background: var(--mtf-accent);
    color: var(--mtf-white);
    transform: translateY(-1px);
}
.mtf-navigate-icon {
    font-size: 16px;
}

/* Booking card */
.mtf-booking-card {
    margin-top: 12px;
    padding: 16px;
    background: var(--mtf-gray-50);
    border: 1px solid var(--mtf-gray-200);
    border-radius: 12px;
}
.mtf-booking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--mtf-primary);
    margin-bottom: 8px;
}
.mtf-booking-date {
    font-size: 13px;
    color: var(--mtf-gray-600);
    margin: 4px 0 12px;
}
.mtf-booking-btn {
    display: inline-block;
    padding: 8px 20px;
    background: var(--mtf-primary);
    color: var(--mtf-highlight);
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.mtf-booking-btn:hover {
    background: var(--mtf-accent);
    color: var(--mtf-white);
}

/* Price result card */
.mtf-price-result-card {
    margin-top: 12px;
    padding: 16px;
    background: var(--mtf-gray-50);
    border: 1px solid var(--mtf-gray-200);
    border-radius: 12px;
}
.mtf-price-header {
    font-weight: 600;
    font-size: 15px;
    color: var(--mtf-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--mtf-gray-200);
}
.mtf-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 14px;
    color: var(--mtf-gray-700);
}
.mtf-price-surcharge {
    font-size: 13px;
    color: var(--mtf-gray-500);
}
.mtf-price-total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 2px solid var(--mtf-primary);
    font-weight: 700;
    font-size: 16px;
    color: var(--mtf-primary);
}
.mtf-price-amount {
    font-weight: 600;
}
.mtf-price-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--mtf-gray-400);
    font-style: italic;
}

/* Opening hours card */
.mtf-hours-card {
    margin-top: 12px;
    padding: 16px;
    background: var(--mtf-gray-50);
    border: 1px solid var(--mtf-gray-200);
    border-radius: 12px;
}
.mtf-hours-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--mtf-primary);
    margin-bottom: 12px;
}
.mtf-hours-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mtf-hours-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--mtf-gray-700);
    padding: 2px 0;
}
.mtf-hours-day {
    font-weight: 500;
}
.mtf-hours-time {
    color: var(--mtf-gray-500);
}
.mtf-hours-address,
.mtf-hours-phone {
    margin-top: 8px;
    font-size: 13px;
    color: var(--mtf-gray-600);
}
.mtf-hours-phone a {
    color: var(--mtf-primary);
    text-decoration: none;
}
.mtf-hours-phone a:hover {
    text-decoration: underline;
}

/* Size guide card */
.mtf-size-guide-card {
    margin-top: 12px;
    padding: 16px;
    background: var(--mtf-gray-50);
    border: 1px solid var(--mtf-gray-200);
    border-radius: 12px;
}
.mtf-size-guide-header {
    font-weight: 600;
    font-size: 15px;
    color: var(--mtf-primary);
    margin-bottom: 12px;
}
.mtf-size-guide-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mtf-size-guide-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mtf-size-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--mtf-primary);
}
.mtf-size-desc {
    font-size: 13px;
    color: var(--mtf-gray-600);
}
.mtf-size-guide-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--mtf-primary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.mtf-size-guide-link:hover {
    text-decoration: underline;
}

/* ========================================
   STREAMING & TOOL INDICATOR STYLES
   ======================================== */

/* Blinking cursor during streaming */
.mtf-streaming-cursor::after {
    content: '\258C';
    display: inline;
    color: var(--mtf-accent);
    animation: mtf-cursor-blink 0.7s step-end infinite;
    font-weight: 300;
    margin-left: 1px;
}

@keyframes mtf-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Tool activity indicator (shown during tool execution) */
.mtf-tool-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 8px 0;
    background: rgba(143, 162, 154, 0.08);
    border-left: 3px solid var(--mtf-accent);
    border-radius: 0 var(--mtf-radius-sm) var(--mtf-radius-sm) 0;
    font-size: 13px;
    color: var(--mtf-gray-600);
    animation: mtf-tool-fade-in 0.3s ease;
}

@keyframes mtf-tool-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.mtf-tool-indicator .mtf-tool-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.mtf-tool-indicator .mtf-tool-text {
    flex: 1;
    font-weight: 500;
}

.mtf-tool-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--mtf-gray-200);
    border-top-color: var(--mtf-accent);
    border-radius: 50%;
    animation: mtf-spinner 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes mtf-spinner {
    to { transform: rotate(360deg); }
}

/* Streaming message bubble - no min-height while empty */
.mtf-message-bubble.mtf-streaming {
    min-height: 0;
}

/* ========================================
   THINKING / REASONING SECTION (ChatGPT-style)
   ======================================== */

.mtf-thinking-section {
    margin-bottom: 8px;
    animation: mtf-thinking-fade-in 0.3s ease;
}

@keyframes mtf-thinking-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
@keyframes mtf-step-reveal {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

}

.mtf-thinking-details {
    border: 1px solid rgba(143, 162, 154, 0.2);
    border-radius: var(--mtf-radius-sm);
    overflow: hidden;
    background: rgba(143, 162, 154, 0.04);
}

.mtf-thinking-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    font-weight: 500;
    color: var(--mtf-gray-500);
    list-style: none;
    transition: color 0.2s ease, background 0.2s ease;
}

.mtf-thinking-summary::-webkit-details-marker {
    display: none;
}

.mtf-thinking-summary:hover {
    color: var(--mtf-gray-700);
    background: rgba(143, 162, 154, 0.06);
}

.mtf-thinking-icon {
    display: flex;
    align-items: center;
    color: var(--mtf-accent);
    flex-shrink: 0;
}

/* Spinning icon while thinking */
.mtf-thinking-section:not(.mtf-thinking-done) .mtf-thinking-icon svg {
    animation: mtf-spinner 1.5s linear infinite;
}

.mtf-thinking-label {
    flex: 1;
}

.mtf-thinking-chevron {
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.mtf-thinking-details[open] .mtf-thinking-chevron {
    transform: rotate(0deg);
}

.mtf-thinking-details:not([open]) .mtf-thinking-chevron {
    transform: rotate(-90deg);
}

.mtf-thinking-content {
    padding: 4px 12px 10px;
    border-top: 1px solid rgba(143, 162, 154, 0.12);
}

/* Tool steps inside thinking */
.mtf-thinking-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
    color: var(--mtf-gray-500);
    animation: mtf-thinking-fade-in 0.2s ease;
}

.mtf-step-icon {
    font-size: 13px;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.mtf-step-text {
    flex: 1;
}

.mtf-step-spinner {
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--mtf-gray-200);
    border-top-color: var(--mtf-accent);
    border-radius: 50%;
    animation: mtf-spinner 0.8s linear infinite;
    flex-shrink: 0;
}

.mtf-step-check {
    color: var(--mtf-accent);
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.mtf-thinking-step-done {
    color: var(--mtf-gray-400);
}

/* Hidden until queue reveals it */
.mtf-step-queued {
    display: none !important;
}

.mtf-thinking-step:not(.mtf-step-queued) {
    animation: mtf-step-reveal 0.3s ease-out;
}

.mtf-thinking-step-done .mtf-step-text {
    text-decoration: none;
}

/* Reasoning text inside thinking (faded, compact) */
.mtf-thinking-text {
    font-size: 11px;
    color: var(--mtf-gray-400);
    line-height: 1.4;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(143, 162, 154, 0.08);
    font-style: italic;
    max-height: 60px;
    overflow: hidden;
    word-break: break-word;
}

/* Completed thinking state */
.mtf-thinking-done .mtf-thinking-details {
    border-color: rgba(143, 162, 154, 0.12);
    background: rgba(143, 162, 154, 0.02);
}

.mtf-thinking-done .mtf-thinking-summary {
    color: var(--mtf-gray-400);
}

.mtf-thinking-done .mtf-thinking-icon svg {
    animation: none;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #mtf-chat-interface {
        border: 2px solid currentColor;
    }

    .mtf-message-bubble {
        border: 1px solid currentColor;
    }
}

/* ========================================
   TYPING INDICATOR (Agent is typing)
   ======================================== */
.mtf-typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px !important;
    min-height: auto !important;
}
.mtf-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8FA29A;
    animation: mtfTypingBounce 1.4s ease-in-out infinite;
}
.mtf-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.mtf-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes mtfTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.mtf-agent-typing-indicator {
    animation: mtfSlideIn 0.3s ease-out;
}

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

.mtf-agent-message {
    animation: mtfSlideIn 0.3s ease-out;
}

.mtf-agent-message .mtf-message-bubble {
    background: linear-gradient(135deg, #0a2e2e 0%, #0f3d3d 100%) !important;
    border-left: 3px solid #FFEAD5 !important;
}
