/**
 * TFW Demo v4.7.21 - Professional Design with Flag Language Selector
 */

:root {
    --primary-color: #1e40af;
    --secondary-color: #3b82f6;
    --text-color: #1f2937;
    --title-text-color: #ffffff;
    --background-color: #ffffff;
    --user-message-color: #e0e7ff;
    --user-message-text-color: #ffffff;
    --ai-message-color: #f8f9fb;
    --ai-message-text-color: #1f2937;
    --border-color: #e5e7eb;
    --button-color: #1e40af;
    --button-text-color: #ffffff;
    --surface-elevated: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-multi-assistant-container, .ai-multi-assistant-container * {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ai-multi-assistant-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-color);
}

.ai-zoom-btn { display: none !important; }

/* TRIGGER BUTTON */
.ai-assistant-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999998;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.35);
    transition: transform var(--transition), box-shadow var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}
.ai-assistant-trigger:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(30, 64, 175, 0.45); }
.ai-assistant-trigger .ai-icon { font-size: 18px; }

/* CHAT WINDOW */
.ai-multi-assistant-container[data-mode="floating"] .ai-assistant-chat {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 480px;
    height: 680px;
    max-width: calc(100vw - 40px);
    max-height: calc(100dvh - 40px);
    background: var(--background-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 999999;
    border: 1px solid rgba(0,0,0,0.06);
}

/* Modal */
.ai-assistant-modal { display: none; position: fixed; inset: 0; z-index: 999999; }
.ai-assistant-modal[data-visible="true"] { display: flex; align-items: center; justify-content: center; }
.ai-assistant-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.ai-assistant-modal-content { position: relative; z-index: 1; width: 90%; max-width: 550px; height: 85%; max-height: 750px; border-radius: var(--radius-lg); overflow: hidden; }
.ai-assistant-modal-content .ai-assistant-chat { width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: var(--radius-lg); }

/* Inline */
.ai-multi-assistant-container[data-mode="inline"] .ai-assistant-chat {
    width: 100%; min-height: 500px; border-radius: var(--radius-lg); border: 1px solid var(--border-color);
    display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
}

/* HEADER */
.ai-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--title-text-color);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ai-header-logo img {
    height: 40px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.95);
    padding: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.ai-header-info { flex: 1; }
.ai-header-info h3 { margin: 0; font-size: 17px; font-weight: 600; color: inherit; letter-spacing: -0.01em; }
.ai-header-controls { display: flex; align-items: center; gap: 8px; }

/* Language Badge - Flag Prominent */
.ai-header-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.15);
    color: inherit;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    touch-action: manipulation;
    transition: all var(--transition);
}
.ai-header-badge:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.35); }
.ai-badge-flag { font-size: 18px; line-height: 1; }

.ai-header-badge.translating {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.4);
    animation: pulse-translate 3s ease-in-out infinite;
}
@keyframes pulse-translate {
    0%, 100% { border-color: rgba(34, 197, 94, 0.4); }
    50% { border-color: rgba(34, 197, 94, 0.7); }
}

.ai-header-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    font-size: 14px; cursor: pointer;
    touch-action: manipulation; color: inherit;
    transition: all var(--transition);
}
.ai-header-btn:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.3); }
.ai-close-btn { font-size: 20px; font-weight: 300; }

/* MESSAGES */
.ai-assistant-messages {
    flex: 1; overflow-y: auto;
    padding: 20px 16px;
    display: flex; flex-direction: column; gap: 16px;
    -webkit-overflow-scrolling: touch;
    background: linear-gradient(180deg, #f8f9fc 0%, #ffffff 100%);
}
.ai-message { max-width: 100%; }
.ai-message-meta {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 6px; margin-bottom: 6px;
    font-size: 12px; color: #6b7280;
}
.ai-message-avatar {
    font-size: 16px; width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: #f3f4f6;
}
.ai-message-sender { font-weight: 600; color: var(--primary-color); letter-spacing: -0.01em; }
.ai-message-dot { opacity: 0.4; }
.ai-message-label { font-style: italic; }
.ai-message-time { color: #9ca3af; }

.ai-message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    color: var(--ai-message-text-color);
    border: 1px solid #e8eaed;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    position: relative;
}
.ai-message-user .ai-message-bubble {
    background: var(--user-message-color);
    color: var(--user-message-text-color);
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(30, 64, 175, 0.1);
}
.ai-message-user .ai-message-meta { justify-content: flex-end; }
.ai-message-user .ai-message-sender { color: var(--text-color); }

.ai-message-body { font-size: 15px; line-height: 1.6; }
.ai-message-body p { margin: 0 0 8px; }
.ai-message-body p:last-child { margin: 0; }
.ai-message-body a { color: var(--primary-color); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; word-break: break-word; transition: opacity var(--transition); }
.ai-message-body a:hover { opacity: 0.75; }
.ai-message-body .ai-source-ref { margin-top: 12px; font-size: 13px; color: #6b7280; border-top: 1px solid #e5e7eb; padding-top: 8px; }

/* Listen button */
.ai-listen-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 14px;
    border: 1px solid #e5e7eb; background: white;
    font-size: 11px; font-weight: 500; color: #6b7280;
    cursor: pointer; transition: all var(--transition);
    touch-action: manipulation; margin-left: auto;
}
.ai-listen-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.ai-listen-btn.playing { background: #dbeafe; border-color: #3b82f6; color: #1d4ed8; }
.ai-listen-btn.speaking { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }
.ai-listen-btn.speaking:hover { background: #fecaca; border-color: #f87171; }

/* LANGUAGE NOTIFICATION */
.ai-language-notification {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 10px 18px; margin: 4px auto;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 24px; font-size: 13px; color: #4f46e5;
    max-width: fit-content; animation: notif-fade-in 0.3s ease;
}
.ai-lang-notif-icon { font-size: 22px; line-height: 1; }
.ai-lang-notif-text { font-weight: 500; }
.ai-lang-notif-text strong { font-weight: 700; }
@keyframes notif-fade-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* TYPING */
.ai-typing-indicator {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 18px; background: var(--surface-elevated);
    border-radius: var(--radius-md); border: 1px solid #e8eaed;
    max-width: 100px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.ai-typing-dots { display: flex; gap: 5px; }
.ai-typing-dot {
    width: 8px; height: 8px; background: #b0b5be;
    border-radius: 50%; animation: typing-bounce 1.4s ease-in-out infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* SUGGESTED QUESTIONS */
.ai-questions-wrapper { border-top: 1px solid #fcd34d; background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%); }
.ai-questions-toggle {
    width: 100%; display: flex; align-items: center; gap: 6px;
    padding: 10px 16px; background: linear-gradient(135deg, #fde047 0%, #facc15 100%);
    border: none; cursor: pointer; font-size: 13px; font-weight: 600;
    color: #713f12; touch-action: manipulation; transition: all var(--transition);
}
.ai-questions-toggle:hover { background: linear-gradient(135deg, #facc15 0%, #eab308 100%); }
.ai-q-icon { font-size: 14px; }
.ai-q-title { flex: 1; text-align: left; font-size: 13px; }
.ai-q-hint { font-size: 10px; font-weight: 400; opacity: 0.8; }
.ai-q-badge { background: #ca8a04; color: #fff; padding: 2px 7px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.ai-q-chevron { transition: transform var(--transition); font-size: 10px; }
.ai-questions-toggle.expanded .ai-q-chevron { transform: rotate(180deg); }
.ai-questions-content { display: none; padding: 10px 14px; gap: 6px; background: #fffef5; }
.ai-questions-content.expanded { display: flex; flex-direction: column; }
.ai-question-btn {
    padding: 8px 12px; background: #fff; border: 1px solid #fcd34d;
    border-radius: 6px; text-align: left; cursor: pointer;
    font-size: 12px; color: #78350f; touch-action: manipulation; transition: all 0.15s;
}
.ai-question-btn:hover { background: #fef9c3; border-color: #eab308; transform: translateX(3px); }

/* INPUT AREA */
.ai-input-area { padding: 12px 16px 14px; border-top: 1px solid #e5e7eb; background: #fff; }
.ai-input-row { display: flex; gap: 0; margin-bottom: 10px; }
.ai-input {
    flex: 1; padding: 12px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-size: 15px; font-family: inherit; resize: none; outline: none;
    min-height: 44px; max-height: 250px; overflow-y: auto;
    transition: border-color var(--transition), box-shadow var(--transition);
    caret-color: var(--primary-color); background: #fafbfc;
}
.ai-input:focus { border-color: var(--primary-color); background: #fff; box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.08); }
.ai-send-btn {
    padding: 12px 22px; background: var(--button-color); color: var(--button-text-color);
    border: none; border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 14px; font-weight: 600; cursor: pointer;
    touch-action: manipulation; transition: opacity var(--transition); letter-spacing: 0.01em;
}
.ai-send-btn:hover { opacity: 0.9; }
.ai-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Listening */
.ai-speak-btn.listening {
    background: #fee2e2 !important; border-color: #ef4444 !important;
    color: #dc2626 !important; animation: pulse-listening 1.5s infinite;
}
@keyframes pulse-listening {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* CONTROLS */
.ai-controls { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.ai-ctrl-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 8px 12px; background: #fafbfc;
    border: 1px solid #e2e4e8; border-radius: 20px;
    font-size: 11px; font-weight: 500; color: #4b5563;
    cursor: pointer; touch-action: manipulation;
    min-height: 38px; transition: all var(--transition);
}
.ai-ctrl-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.ai-ctrl-btn:active { transform: scale(0.97); }
.ai-ctrl-btn.listening { background: #fee2e2; border-color: #ef4444; color: #dc2626; }
.ai-ctrl-btn.active { background: #dbeafe; border-color: #3b82f6; color: #1d4ed8; }
.ai-translate-btn.active { background: #dcfce7; border-color: #22c55e; color: #166534; }
.ai-ctrl-icon { font-size: 14px; }

/* BRANDING */
.ai-branding {
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: #9ca3af; font-weight: 500;
    padding: 8px 12px; position: relative;
}
.ai-branding-text { text-align: center; }
.ai-branding a { color: var(--primary-color); text-decoration: none; font-weight: 600; transition: all var(--transition); }
.ai-branding a:hover { color: var(--secondary-color); text-decoration: underline; text-underline-offset: 2px; }

.ai-exit-fast-btn {
    position: absolute; right: 12px; background: #dc2626; color: white;
    border: none; padding: 5px 10px; border-radius: 6px;
    font-size: 10px; font-weight: 600; cursor: pointer;
    transition: all var(--transition); display: flex; align-items: center; gap: 3px;
}
.ai-exit-fast-btn:hover { background: #b91c1c; transform: scale(1.05); }

/* TTS CONSENT */
.ai-tts-consent-popup {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 1000010; display: none;
    align-items: center; justify-content: center; padding: 20px;
}
.ai-tts-consent-popup.visible { display: flex; }
.ai-tts-consent-box {
    background: #fff; border-radius: var(--radius-lg); padding: 28px;
    max-width: 360px; text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ai-tts-consent-icon { font-size: 40px; margin-bottom: 12px; }
.ai-tts-consent-box p { margin: 0 0 8px; color: #374151; }
.ai-tts-consent-box p strong { color: #111827; }
.ai-tts-consent-note { font-size: 13px; color: #6b7280 !important; margin-bottom: 16px !important; }
.ai-tts-consent-buttons { display: flex; gap: 10px; justify-content: center; }
.ai-tts-btn-yes, .ai-tts-btn-no {
    padding: 12px 20px; border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600; cursor: pointer;
    touch-action: manipulation; border: none; transition: all var(--transition);
}
.ai-tts-btn-yes { background: var(--primary-color, #1e40af); color: #fff; }
.ai-tts-btn-yes:hover { opacity: 0.9; }
.ai-tts-btn-no { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.ai-tts-btn-no:hover { background: #e5e7eb; }

/* MODALS */
.ai-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 1000001; display: none;
    align-items: center; justify-content: center; padding: 20px;
}
.ai-modal.visible { display: flex; }
.ai-modal-box {
    background: #fff; border-radius: var(--radius-lg); padding: 24px;
    width: 100%; max-width: 480px; max-height: 80vh; overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ai-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f0f1f3;
}
.ai-modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.ai-modal-x {
    width: 32px; height: 32px; background: #f3f4f6;
    border: none; border-radius: 50%; font-size: 18px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); color: #6b7280;
}
.ai-modal-x:hover { background: #e5e7eb; color: #374151; }

/* LANGUAGE GRID - FLAGS FRONT AND CENTRE */
.ai-lang-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 8px; margin-bottom: 20px;
}
.ai-lang-opt {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border: 2px solid #eef0f3;
    border-radius: var(--radius-md); cursor: pointer;
    touch-action: manipulation; min-height: 56px;
    transition: all var(--transition); background: #fafbfc;
}
.ai-lang-opt:hover {
    border-color: #a5b4fc; background: #f5f7ff;
    transform: translateY(-1px); box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}
.ai-lang-opt.selected {
    border-color: #6366f1; background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.ai-lang-flag { font-size: 28px; line-height: 1; flex-shrink: 0; }
.ai-lang-name { font-weight: 600; font-size: 13px; color: #1f2937; }
.ai-lang-native { font-size: 11px; color: #6b7280; margin-top: 1px; }

/* VOICE MODAL */
.ai-voice-grid { display: flex; flex-direction: column; gap: 8px; max-height: 250px; overflow-y: auto; margin-bottom: 16px; }
.ai-voice-opt {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px; border: 2px solid #eef0f3;
    border-radius: var(--radius-md); cursor: pointer;
    touch-action: manipulation; transition: all var(--transition); background: #fafbfc;
}
.ai-voice-opt:hover { border-color: #a5b4fc; background: #f5f7ff; }
.ai-voice-opt.selected { border-color: #6366f1; background: #eef2ff; }
.ai-voice-info { display: flex; align-items: center; gap: 10px; }
.ai-voice-icon { font-size: 18px; }
.ai-voice-name { font-weight: 600; font-size: 13px; }
.ai-voice-lang { font-size: 11px; color: #6b7280; }
.ai-voice-test {
    padding: 6px 12px; background: #f3f4f6; border: 1px solid #e5e7eb;
    border-radius: 6px; font-size: 11px; cursor: pointer; font-weight: 500;
    transition: all var(--transition);
}
.ai-voice-test:hover { background: #e5e7eb; }
.ai-speed-ctrl { padding: 14px; background: #f9fafb; border-radius: var(--radius-md); margin-bottom: 16px; border: 1px solid #f0f1f3; }
.ai-speed-ctrl label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 14px; }
#speed-slider { width: 100%; height: 6px; -webkit-appearance: none; background: #e5e7eb; border-radius: 3px; }
#speed-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; background: var(--primary-color); border-radius: 50%; cursor: pointer; }
.ai-modal-close-btn {
    width: 100%; padding: 12px; background: #f3f4f6; border: none;
    border-radius: var(--radius-md); font-weight: 600; font-size: 14px;
    cursor: pointer; transition: all var(--transition); color: #374151;
}
.ai-modal-close-btn:hover { background: #e5e7eb; }

/* LANGUAGE CONFIRMATION - LARGE FLAGS */
.ai-lang-confirm-content { text-align: center; padding: 24px; max-height: 90vh; overflow-y: auto; }
.ai-lang-confirm-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.02em; }
.ai-lang-confirm-text {
    color: #6b7280; font-size: 12px; margin-bottom: 10px;
    text-align: left; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
}
.ai-lang-other-title { margin-top: 16px; padding-top: 16px; border-top: 1px solid #f0f1f3; }
.ai-lang-confirm-buttons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ai-lang-other-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }

.ai-lang-confirm-btn {
    padding: 12px 16px; background: #fafbfc; border: 2px solid #eef0f3;
    border-radius: var(--radius-md); font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
    text-align: left; display: flex; align-items: center; gap: 10px;
}
.ai-lang-confirm-btn:hover { background: #eef2ff; border-color: #6366f1; transform: translateY(-1px); }
.ai-lang-confirm-btn .ai-confirm-flag { font-size: 26px; line-height: 1; flex-shrink: 0; }
.ai-lang-detected { background: #f0fdf4; border-color: #22c55e; }
.ai-lang-detected:hover { background: #dcfce7; border-color: #16a34a; }
.ai-lang-other { padding: 10px 12px; font-size: 13px; }
.ai-lang-confirm-cancel { padding: 10px 20px; background: transparent; border: none; color: #6b7280; font-size: 14px; cursor: pointer; }
.ai-lang-confirm-cancel:hover { color: #374151; }

/* TOAST */
.ai-toast {
    position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
    background: #1f2937; color: #fff; padding: 12px 24px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    z-index: 1000010; animation: fadeIn 0.3s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
@keyframes fadeIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Text Sizes */
.ai-text-small .ai-message-body { font-size: 15px; line-height: 1.5; }
.ai-text-medium .ai-message-body { font-size: 17px; line-height: 1.5; }
.ai-text-large .ai-message-body { font-size: 20px; line-height: 1.6; }

/* MOBILE */
@media (max-width: 768px) {
    .ai-assistant-trigger { padding: 12px 16px; bottom: 16px; right: 16px; }
    .ai-zoom-btn { display: flex !important; }
    
    .ai-multi-assistant-container[data-mode="floating"] .ai-assistant-chat,
    .ai-multi-assistant-container[data-mode="modal"] .ai-assistant-chat {
        position: fixed !important; top: 0 !important; left: 0 !important;
        right: 0 !important; bottom: 0 !important;
        width: 100% !important; height: 100% !important;
        max-width: 100% !important; max-height: 100% !important;
        border-radius: 0 !important; z-index: 1000000 !important;
    }
    .ai-assistant-modal[data-visible="true"] { padding: 0; }
    .ai-assistant-modal[data-visible="true"] .ai-assistant-modal-backdrop { display: none; }
    .ai-assistant-modal[data-visible="true"] .ai-assistant-modal-content {
        width: 100% !important; height: 100% !important;
        max-width: 100% !important; max-height: 100% !important;
        border-radius: 0 !important;
    }
    
    .ai-header { padding: 12px 14px !important; gap: 10px !important; min-height: auto !important; }
    .ai-header-logo img { height: 36px !important; width: 36px !important; padding: 3px !important; border-radius: 8px !important; }
    .ai-header-info h3 { font-size: 17px !important; line-height: 1.2 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ai-header-controls { gap: 6px !important; }
    .ai-header-badge { padding: 6px 10px !important; font-size: 12px !important; gap: 4px !important; border-radius: 6px !important; }
    .ai-badge-flag { font-size: 16px !important; }
    .ai-header-btn { width: 34px !important; height: 34px !important; font-size: 13px !important; border-radius: 8px !important; }
    .ai-close-btn { font-size: 20px !important; }
    
    .ai-controls { display: grid !important; grid-template-columns: repeat(5, 1fr) !important; gap: 5px !important; padding: 8px !important; margin-bottom: 0 !important; }
    .ai-ctrl-btn { flex-direction: column !important; justify-content: center !important; align-items: center !important; gap: 3px !important; padding: 8px 2px !important; min-height: 52px !important; border-radius: 10px !important; }
    .ai-ctrl-icon { font-size: 18px !important; }
    .ai-ctrl-text { display: block !important; font-size: 9px !important; text-align: center !important; line-height: 1.2 !important; font-weight: 500 !important; }
    
    .ai-input-area { padding: 10px 12px !important; }
    .ai-input-row { gap: 8px !important; margin-bottom: 8px !important; }
    .ai-input { font-size: 17px !important; min-height: 48px !important; padding: 12px 14px !important; border-radius: 12px !important; }
    .ai-send-btn { min-height: 48px !important; padding: 10px 18px !important; font-size: 16px !important; font-weight: 600 !important; border-radius: 12px !important; }
    
    .ai-message-body { font-size: 17px; line-height: 1.6; }
    .ai-text-small .ai-message-body { font-size: 17px; }
    .ai-text-medium .ai-message-body { font-size: 19px; }
    .ai-text-large .ai-message-body { font-size: 22px; }
    .ai-message-bubble { padding: 14px 16px !important; border-radius: 14px !important; }
    .ai-message-meta { font-size: 12px !important; margin-bottom: 6px !important; }
    .ai-branding { font-size: 10px !important; padding: 8px 0 !important; margin: 0 !important; }
    .ai-branding .ai-contact-human-btn { font-size: 9px !important; padding: 3px 8px !important; }
    .ai-branding .ai-exit-fast-btn { font-size: 9px !important; padding: 3px 8px !important; }
    .ai-questions-toggle { padding: 10px 14px !important; font-size: 13px !important; }
    .ai-questions-wrapper { margin: 0 !important; }
    .ai-question-btn { font-size: 14px !important; padding: 10px 14px !important; }
    .ai-assistant-messages { flex: 1 !important; min-height: 0 !important; }
    
    /* Bigger flags on mobile */
    .ai-lang-flag { font-size: 32px !important; }
    .ai-lang-opt { padding: 14px !important; min-height: 62px !important; }
    .ai-lang-name { font-size: 14px !important; }
    .ai-lang-native { font-size: 12px !important; }
    
    /* ZOOM LEVEL 1 */
    .ai-zoom-1 .ai-header { padding: 14px 16px !important; gap: 12px !important; }
    .ai-zoom-1 .ai-header-logo img { height: 42px !important; width: 42px !important; }
    .ai-zoom-1 .ai-header-info h3 { font-size: 19px !important; }
    .ai-zoom-1 .ai-header-badge { padding: 7px 12px !important; font-size: 14px !important; }
    .ai-zoom-1 .ai-badge-flag { font-size: 18px !important; }
    .ai-zoom-1 .ai-header-btn { width: 40px !important; height: 40px !important; font-size: 15px !important; }
    .ai-zoom-1 .ai-close-btn { font-size: 24px !important; }
    .ai-zoom-1 .ai-ctrl-btn { min-height: 60px !important; padding: 10px 3px !important; }
    .ai-zoom-1 .ai-ctrl-icon { font-size: 22px !important; }
    .ai-zoom-1 .ai-ctrl-text { font-size: 10px !important; }
    .ai-zoom-1 .ai-input { font-size: 19px !important; min-height: 54px !important; padding: 14px 16px !important; }
    .ai-zoom-1 .ai-send-btn { min-height: 54px !important; padding: 12px 20px !important; font-size: 18px !important; }
    .ai-zoom-1 .ai-message-body { font-size: 19px !important; line-height: 1.6 !important; }
    .ai-zoom-1 .ai-message-bubble { padding: 16px 18px !important; }
    .ai-zoom-1 .ai-message-meta { font-size: 14px !important; }
    .ai-zoom-1 .ai-questions-toggle { font-size: 15px !important; padding: 12px 16px !important; }
    .ai-zoom-1 .ai-question-btn { font-size: 16px !important; padding: 12px 16px !important; }
    .ai-zoom-1 .ai-branding { font-size: 12px !important; }
    
    /* ZOOM LEVEL 2 */
    .ai-zoom-2 .ai-header { padding: 16px 18px !important; gap: 14px !important; }
    .ai-zoom-2 .ai-header-logo img { height: 48px !important; width: 48px !important; }
    .ai-zoom-2 .ai-header-info h3 { font-size: 22px !important; }
    .ai-zoom-2 .ai-header-badge { padding: 8px 14px !important; font-size: 16px !important; }
    .ai-zoom-2 .ai-badge-flag { font-size: 20px !important; }
    .ai-zoom-2 .ai-header-btn { width: 46px !important; height: 46px !important; font-size: 17px !important; }
    .ai-zoom-2 .ai-close-btn { font-size: 28px !important; }
    .ai-zoom-2 .ai-controls { grid-template-columns: repeat(5, 1fr) !important; gap: 4px !important; }
    .ai-zoom-2 .ai-ctrl-btn { min-height: 68px !important; padding: 10px 2px !important; }
    .ai-zoom-2 .ai-ctrl-icon { font-size: 26px !important; }
    .ai-zoom-2 .ai-ctrl-text { font-size: 11px !important; }
    .ai-zoom-2 .ai-input { font-size: 22px !important; min-height: 60px !important; padding: 16px 18px !important; }
    .ai-zoom-2 .ai-send-btn { min-height: 60px !important; padding: 14px 22px !important; font-size: 20px !important; }
    .ai-zoom-2 .ai-message-body { font-size: 22px !important; line-height: 1.7 !important; }
    .ai-zoom-2 .ai-message-bubble { padding: 18px 20px !important; border-radius: 16px !important; }
    .ai-zoom-2 .ai-message-meta { font-size: 16px !important; }
    .ai-zoom-2 .ai-questions-toggle { font-size: 17px !important; padding: 14px 18px !important; }
    .ai-zoom-2 .ai-question-btn { font-size: 18px !important; padding: 14px 18px !important; }
    .ai-zoom-2 .ai-branding { font-size: 13px !important; }
}

@media (max-width: 380px) {
    .ai-ctrl-btn { padding: 6px 2px !important; min-height: 48px !important; }
    .ai-ctrl-text { font-size: 8px !important; }
    .ai-ctrl-icon { font-size: 16px !important; }
    .ai-header-info h3 { font-size: 15px !important; }
    .ai-header-badge { padding: 5px 8px !important; font-size: 11px !important; }
}

@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .ai-header { padding-top: calc(10px + env(safe-area-inset-top)) !important; }
        .ai-input-area { padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important; }
    }
}

body.ai-chat-open { overflow: hidden !important; position: fixed; width: 100%; height: 100%; top: 0; left: 0; }
.chatbot1-iframe-body { background: transparent !important; }
