/* ========================================== */
/* CSS RESET & BASE STYLES */
/* ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Instant theme switch - disable transitions during toggle */
body.theme-switching,
body.theme-switching *,
body.theme-switching *::before,
body.theme-switching *::after {
    transition: none !important;
}

/* ========================================== */
/* ACCESSIBILITY - FOCUS STATES */
/* ========================================== */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.25);
}

/* Screen reader only text */
.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;
}

/* ========================================== */
/* CSS VARIABLES & DESIGN TOKENS */
/* ========================================== */
:root {
    /* Core Colors - Modern Professional Blue */
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-gradient: linear-gradient(135deg, #2563EB 0%, #4F46E5 100%);
    --accent: #38A3F5;
    --accent-gradient: linear-gradient(135deg, #38A3F5 0%, #00F5FF 100%);
    --secondary: #6B46C1;
    --cta: #2563EB;
    --cta-dark: #1D4ED8;
    --cta-gradient: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);

    /* Dark Theme (Default) */
    --bg-primary: #0B0E15;
    --bg-secondary: #141824;
    --surface-primary: #1A1F2B;
    --surface-secondary: #242A37;
    --surface-hover: #2F3646;

    /* Text */
    --text-primary: #F7F9FC;
    --text-secondary: #D1D6E3;
    --text-tertiary: #9AA1B4;

    /* Legacy tokens mapped to new palette */
    --bg: #0B0E15;
    --surface-1: #1A1F2B;
    --surface-2: #242A37;
    --border: #303748;
    --text-1: #F7F9FC;
    --text-2: #D1D6E3;
    --text-3: #9AA1B4;

    /* Status */
    --success: #00FFB7;
    --warning: #FFB800;
    --error: #FF4D9A;
    --info: #38A3F5;

    /* Accessible text variants for colored text on dark surfaces */
    --primary-text: #5082EF;

    /* Borders */
    --border-primary: rgba(255, 255, 255, 0.07);
    --border-secondary: rgba(255, 255, 255, 0.04);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Button Tokens */
    --btn-radius: 14px;
    --btn-radius-pill: 999px;
    --btn-icon-size: 44px;
    --btn-icon-small-size: 32px;
    --btn-neutral-bg: rgba(255, 255, 255, 0.04);
    --btn-neutral-border: rgba(255, 255, 255, 0.08);
    --btn-neutral-hover: rgba(255, 255, 255, 0.12);
    --btn-neutral-color: var(--text-secondary);
}

/* Light Mode */
body.light-mode {
    --bg-primary: #F7F9FC;
    --bg-secondary: #EEF1F7;
    --surface-primary: #FFFFFF;
    --surface-secondary: #F3F6FB;
    --surface-hover: #E7EBF3;

    --text-primary: #171C2B;
    --text-secondary: #333A4E;
    --text-tertiary: #4E556D;

    --border-primary: rgba(23, 28, 43, 0.16);
    --border-secondary: rgba(23, 28, 43, 0.1);

    --btn-neutral-bg: rgba(23, 28, 43, 0.06);
    --btn-neutral-border: rgba(23, 28, 43, 0.12);
    --btn-neutral-hover: rgba(23, 28, 43, 0.12);
    --btn-neutral-color: var(--text-secondary);

    /* Accessible status colors for light backgrounds */
    --success: #007A50;
    --warning: #946800;
    --error: #D50060;
    --primary-text: #2563EB;
}

body.light-mode .connection-status {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
}


body.light-mode .panel-tab.active {
    background: var(--primary-gradient);
    color: white;
}

body.light-mode .btn-leave {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

body.light-mode .btn-leave:hover,
body.light-mode .btn-leave:focus-visible {
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

body.light-mode .message-input::placeholder {
    color: var(--text-secondary);
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ========================================== */
/* COMPREHENSIVE LIGHT MODE - 2025 STYLE */
/* ========================================== */

/* AI Panel Light Mode */
body.light-mode .ai-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-mode .ai-avatar {
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.25),
                0 2px 6px rgba(0, 0, 0, 0.1);
}

body.light-mode .ai-info h3 {
    background: linear-gradient(135deg, #1A1A1A 0%, #333333 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Intelligence Panel */
body.light-mode .intelligence-panel {
    background: rgba(248, 248, 248, 0.95);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .panel-tab {
    color: var(--text-secondary);
    background: transparent;
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .panel-tab:hover:not(.active) {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.15);
}

body.light-mode .panel-tab.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

/* Message Bubbles */
body.light-mode .message-bubble {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

body.light-mode .message.own .message-bubble {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 142, 83, 0.15));
    border: 1px solid rgba(255, 107, 107, 0.2);
}

body.light-mode .message-bubble:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.light-mode .message.system {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
}

/* Buttons */
body.light-mode .btn-icon:hover,
body.light-mode .btn-icon:focus-visible {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

/* Input Areas - Light Mode */
body.light-mode .input-container {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-mode .input-wrapper-modern {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.12);
}

body.light-mode .input-wrapper-modern:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.08);
}

body.light-mode .btn-send:hover,
body.light-mode .btn-send:focus-visible {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

body.light-mode .btn-input-util:hover,
body.light-mode .btn-input-util:focus-visible {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

body.light-mode .btn-voice:hover,
body.light-mode .btn-voice:focus-visible {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

body.light-mode .btn-voice {
    border-color: var(--btn-primary-border);
    background: var(--btn-primary-bg);
    box-shadow: var(--btn-primary-shadow);
}

body.light-mode .btn-voice:hover,
body.light-mode .btn-voice:focus-visible {
    background: var(--btn-primary-hover);
}

/* Participant Cards */
body.light-mode .participant-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-mode .participant-card:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Stats Bar */
body.light-mode .stats-bar {
    background: rgba(241, 244, 249, 0.9);
    border: 1px solid rgba(23, 28, 43, 0.08);
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Room Info */
body.light-mode .room-info {
    background: rgba(241, 244, 249, 0.9);
    border: 1px solid rgba(23, 28, 43, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.light-mode .room-name {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* App Header */
body.light-mode .app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Copy & Share Buttons (room header) */
body.light-mode .btn-icon-small:hover,
body.light-mode .btn-icon-small:focus-visible {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

/* Emoji & Attach Buttons */
body.light-mode .btn-emoji:hover,
body.light-mode .btn-attach:hover,
body.light-mode .btn-emoji:focus-visible,
body.light-mode .btn-attach:focus-visible {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

/* Send Button */
body.light-mode .btn-icon-primary:hover,
body.light-mode .btn-icon-primary:focus-visible {
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

/* Visual Intelligence Cards - wrapper only, no styling (cards have inline styles) */
.visual-element {
    /* Removed wrapper styling to prevent double-background conflict */
}

/* Notifications */
body.light-mode .date-clarification-notification {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Soften glassmorphism in light mode */
body.light-mode .ai-chat-messages {
    background: rgba(255, 255, 255, 0.5) !important;
}

body.light-mode .btn-ai-quick {
    background: var(--btn-primary-bg) !important;
    border: 1px solid var(--btn-primary-border) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--btn-primary-shadow) !important;
}

body.light-mode .btn-ai-quick:hover,
body.light-mode .btn-ai-quick:focus-visible {
    background: var(--btn-primary-hover) !important;
}

/* ========================================== */
/* MODERN FILE CARDS - MS TEAMS 2025 STYLE */
/* ========================================== */
.file-card {
    background: linear-gradient(135deg, rgba(99, 119, 241, 0.08), rgba(139, 92, 246, 0.08));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(99, 119, 241, 0.18);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    max-width: 400px;
}

.file-card:hover {
    background: linear-gradient(135deg, rgba(99, 119, 241, 0.16), rgba(139, 92, 246, 0.16));
    border-color: rgba(99, 119, 241, 0.36);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

.file-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6374F1, #8B5CF6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-download-btn {
    width: 36px;
    height: 36px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366F1;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.file-download-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: scale(1.1);
}

.file-download-btn:active {
    transform: scale(0.95);
}

/* Light mode file cards */
body.light-mode .file-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.15);
}

body.light-mode .file-card:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

/* ========================================== */
/* SMOOTH THEME TRANSITIONS */
/* ========================================== */
* {
    transition: background-color 0.3s ease,
                background 0.3s ease,
                border-color 0.3s ease,
                color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Disable transitions for transforms and position (keep snappy) */
*:hover,
*:active,
*:focus {
    transition: background-color 0.3s ease,
                background 0.3s ease,
                border-color 0.3s ease,
                color 0.3s ease,
                box-shadow 0.3s ease,
                transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================== */
/* LAYOUT & BODY STYLES */
/* ========================================== */
html {
    overflow: hidden;
    height: 100%;
}

body {
    font-family: 'Noto Sans', 'Noto Sans Arabic', 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans Devanagari', 'Noto Sans Thai', 'Noto Sans Cyrillic', 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Arabic Support */
.arabic {
    font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', sans-serif;
}

/* App Container */
/* ========================================== */
/* MAIN APPLICATION CONTAINER */
/* ========================================== */
.app-container {
    height: 100vh;
    height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}

/* Header */
.app-header {
    background: var(--surface-primary);
    border-bottom: 1px solid var(--border-primary);
    padding: 16px 24px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    gap: 8px;
    overflow: hidden;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-weight: 700;
    font-size: 20px;
    color: #38A3F5;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(28, 33, 44, 0.95);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    height: 48px;
}

.room-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.room-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-icon-small {
    width: var(--btn-icon-small-size);
    height: var(--btn-icon-small-size);
    border-radius: var(--btn-radius);
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--btn-neutral-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon-small:hover,
.btn-icon-small:focus-visible {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}


.header-center {
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.stats-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 8px 16px;
    background: rgba(28, 33, 44, 0.95);
    border-radius: 12px;
    min-width: 320px;
    justify-content: center;
    color: var(--text-primary);
    border: 1px solid rgba(148, 163, 184, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    height: 48px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
}

.stat-value {
    font-weight: 600;
    font-size: 14px;
    min-width: 50px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    width: 1px;
    height: 20px;
    background: var(--border-primary);
}

.language-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 6px 12px;
    border-radius: 12px;
    background: rgba(28, 33, 44, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.language-indicator:hover {
    transform: translateY(-1px);
    background: rgba(35, 41, 54, 0.95);
}

body.light-mode .language-indicator {
    background: rgba(247, 249, 252, 0.9);
    border: 1px solid rgba(23, 28, 43, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    color: var(--text-primary);
}

body.light-mode .language-indicator:hover {
    background: rgba(241, 244, 249, 0.95);
}

.flag {
    font-size: 18px;
}

.language-name {
    font-weight: 500;
    font-size: 13px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--surface-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    font-size: 10px;
    font-weight: 500;
}

.connection-status.connected .status-dot {
    background: var(--success);
    box-shadow: 0 0 0 1px rgba(34, 197, 139, 0.3);
}

.status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--error);
    transition: all 0.3s ease;
    box-shadow: 0 0 0 1px rgba(242, 107, 90, 0.35);
}

.version-badge {
    margin-left: 2px;
    padding: 2px 5px;
    background: var(--primary-gradient);
    border-radius: 6px;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 3px rgba(255, 107, 107, 0.2);
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    flex-wrap: nowrap;
    min-width: 0;
}

/* Invite button: hidden on desktop (participants bar has Add Participant) */
#mobileInviteBtn {
    display: none;
}

.btn-icon {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.btn-icon:hover,
.btn-icon:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.btn-icon:active {
    transform: scale(0.98);
}

.btn-icon svg {
    position: relative;
    z-index: 1;
}

/* TTS Toggle - show waves when active, X when off */
#ttsToggle .tts-off {
    display: block;
}

#ttsToggle .tts-on {
    display: none;
}

#ttsToggle.active .tts-off {
    display: none;
}

#ttsToggle.active .tts-on {
    display: block;
}

.btn-leave {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-leave:hover,
.btn-leave:focus-visible {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Participants Bar */
.participants-bar {
    background: var(--surface-primary);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-primary);
}

.participants-scroll {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-primary) transparent;
}

.participant-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--surface-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-primary);
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.participant-card:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.participant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.participant-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.participant-name {
    font-weight: 500;
    font-size: 14px;
}

.participant-language {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-add-participant {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--surface-secondary);
    border: 2px dashed var(--border-primary);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-add-participant:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* Chat Section */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    min-height: 0;
}

/* ========================================== */
/* MESSAGE SYSTEM STYLES */
/* ========================================== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-primary) transparent;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}



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

@keyframes highlightPulse {
    0% {
        border-left-color: var(--primary);
        border-left-width: 3px;
    }
    50% {
        border-left-color: var(--primary);
        border-left-width: 4px;
    }
    100% {
        border-left-color: transparent;
        border-left-width: 3px;
    }
}

.message-highlight {
    animation: highlightPulse 1.5s ease-in-out;
    background: rgba(0, 212, 255, 0.05) !important;
    border-left: 3px solid var(--primary) !important;
}

.message-original {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: normal;
    overflow-wrap: break-word;
    max-width: 100%;
    hyphens: none;
}

.translation {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
    opacity: 0.9;
    font-style: italic;
}

.original-text {
    display: none;
    margin-top: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 13px;
    opacity: 0.8;
    unicode-bidi: isolate;
    direction: ltr;
    text-align: left;
}

.original-text.show {
    display: block !important;
}

.show-original-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-tertiary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.show-original-btn:hover {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.show-original-btn.active {
    background: var(--surface-hover);
    color: var(--primary);
}

body.light-mode .original-text {
    background: rgba(0, 0, 0, 0.08);
}

body.light-mode .show-original-btn {
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    background: var(--surface-secondary);
}

.message.system {
    align-items: center;
    margin: 16px 0;
}

.message.system span {
    background: var(--surface-secondary);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========================================== */
/* NEW CLEAN MESSAGE SYSTEM STYLES */
/* ========================================== */
.message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: messageSlide 0.3s ease;
}

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

.message:not(.own) {
    align-items: flex-start;
}

/* RTL Room Logic - Arabic rooms */
.room-arabic .message.own {
    align-items: flex-start; /* Own messages go left in Arabic rooms */
}

.room-arabic .message:not(.own) {
    align-items: flex-end; /* Other messages go right in Arabic rooms */
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
}

.message:not(.own) .message-header {
    justify-content: flex-start;
}

.message-sender {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Clean Message Bubble - 2025 Enhanced */
.message-bubble {
    background: var(--surface-secondary);
    padding: 14px 18px;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    max-width: 70%;
    word-wrap: break-word;
    word-break: normal;
    white-space: normal;
    overflow-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

@media (hover: hover) {
    .message-bubble:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.06);
    }
}

/* Own Message Styling */
.message.own .message-bubble {
    background: var(--primary-gradient);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(255, 107, 107, 0.2);
}

@media (hover: hover) {
    .message.own .message-bubble:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
    }
}

/* Message Text */
.message-text {
    font-size: 14px;
    line-height: 1.5;
}

/* Emoji-only messages - NO bubble, NO translation, NO TTS */
.message-text.emoji-only {
    font-size: 20px !important;
    line-height: 1 !important;
}

/* Remove ALL bubble styling for emojis */
.message.emoji-message .message-bubble {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.message.emoji-message:hover .message-bubble {
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

.message.emoji-message.own .message-bubble {
    background: transparent !important;
    border: none !important;
}

/* Emoji messages in ANY room (Arabic, English, etc.) */
.room-arabic .message.emoji-message .message-bubble,
.room-english .message.emoji-message .message-bubble {
    background: transparent !important;
    border: none !important;
}

/* RTL Currency Fix */
.room-arabic .message-text {
    unicode-bidi: plaintext;
    direction: rtl;
    font-feature-settings: "liga" 1, "kern" 1;
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    /* Fix mobile layout: absolute position gives chat-section a definite height,
       bypassing unreliable flex stretch height propagation across nested flex containers */
    .main-content {
        position: relative;
    }
    .chat-section {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    /* Compact header on mobile */
    .app-header {
        padding: 10px 12px;
    }

    /* Hide participants bar - names show in messages */
    .participants-bar {
        display: none !important;
    }

    /* Swap save transcript for invite button on mobile */
    #saveTranscriptBtn {
        display: none;
    }

    #mobileInviteBtn {
        display: flex;
    }

    /* Header: compact for tablet */
    header {
        padding: 10px 12px;
    }

    .header-left {
        gap: 8px;
        min-width: 0;
        flex: 1;
    }

    .header-center {
        display: none;
    }

    .header-right {
        gap: 6px;
        flex-shrink: 0;
    }

    .logo-text {
        display: none;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }

    .room-info {
        padding: 4px 8px;
        height: 36px;
        gap: 6px;
        min-width: 0;
    }

    .room-badge {
        display: none;
    }

    .room-name {
        font-size: 12px;
        padding: 3px 6px;
    }

    /* Leave button: icon only on mobile */
    .btn-leave span {
        display: none;
    }

    .btn-leave {
        padding: 8px 10px;
        gap: 0;
    }

    /* Messages */
    .messages-container {
        padding: 12px;
        gap: 10px;
    }

    .message-bubble {
        max-width: 88%;
        padding: 12px 16px;
        font-size: 14px;
    }

    .message-header {
        padding: 0 2px;
    }

    .message-sender {
        font-size: 12px;
    }

    .message-time {
        font-size: 10px;
    }

    .message-original {
        font-size: 14px;
    }

    .translation {
        font-size: 12px;
    }

    /* Input area */
    .input-container {
        padding: 10px 12px;
        gap: 8px;
    }

    .input-wrapper-modern {
        padding: 8px 10px;
    }

    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }

    /* Header buttons: smaller to prevent overflow */
    .header-actions .btn-icon {
        min-width: 38px;
        min-height: 38px;
        width: 38px;
        height: 38px;
    }

    .btn-voice, .btn-send {
        min-width: 44px;
        min-height: 44px;
    }

    /* Room setup */
    .room-setup {
        padding: 20px;
        max-width: 95%;
    }

    .room-setup h2 {
        font-size: 18px;
    }

    .user-bar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .connection-status {
        padding: 3px 8px;
        font-size: 10px;
    }
}

@media (max-width: 600px) {
    .room-setup {
        position: fixed;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        padding: 14px;
        width: min(calc(100vw - 16px), 100%);
        max-width: none;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        overflow-y: auto;
        overflow-x: hidden;
        border-radius: 14px;
    }

    .user-bar {
        padding: 8px 10px;
        margin-bottom: 10px;
        border-radius: 10px;
    }

    .user-bar-info > span {
        font-size: 12px;
    }

    .user-bar-balance {
        padding: 4px 8px;
        font-size: 11px;
    }

    .btn-signout-small {
        padding: 4px 8px;
        font-size: 11px;
    }

    .setup-header {
        margin-bottom: 10px;
    }

    .setup-header h2 {
        font-size: 16px;
        margin-bottom: 2px;
    }

    .setup-header p {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .setup-header .connection-status {
        margin-top: 6px;
    }

    .setup-header-compact {
        margin-bottom: 8px;
    }

    .setup-header-compact h2 {
        font-size: 16px;
        gap: 6px;
    }

    .account-menu {
        width: 280px;
        right: -8px;
    }

    .btn-account-icon {
        width: 32px;
        height: 32px;
    }

    .btn-account-icon svg {
        width: 16px;
        height: 16px;
    }

    .form-group {
        margin-bottom: 8px;
    }

    .form-group label {
        font-size: 11px;
        margin-bottom: 3px;
    }

    .form-control {
        padding: 8px 10px;
        font-size: 16px;
    }

    .room-code-row {
        flex-direction: column;
        gap: 8px;
    }

    .auto-detect-toggle {
        justify-content: flex-start;
        align-self: flex-start;
        padding: 6px 0;
        background: transparent;
        border: none;
    }

    .toggle-label {
        font-size: 10px;
    }

    .show-more-btn {
        padding: 8px 12px;
        font-size: 11px;
        margin-top: 8px !important;
    }

    .btn-primary {
        padding: 12px 16px;
        font-size: 14px;
        margin-top: 12px !important;
    }

    .btn-generate {
        padding: 6px 8px;
        font-size: 10px;
    }

    .input-with-button .form-control {
        padding-right: 80px;
    }
}

@media (max-width: 480px) {
    /* Header: ultra-compact */
    .header-left {
        gap: 6px;
    }

    .logo-icon {
        width: 24px;
        height: 24px;
    }

    .room-info {
        height: 32px;
        border-radius: 8px;
        gap: 6px;
        padding: 4px 8px;
    }

    .room-name {
        font-size: 11px;
        padding: 2px 5px;
    }

    .btn-icon-small {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }

    /* Hide TTS toggle on small phones - not essential */
    #ttsToggle {
        display: none;
    }

    .btn-leave {
        padding: 6px 8px;
    }

    /* Input: tighter on small phones */
    .input-container {
        padding: 8px;
        gap: 4px;
    }

    .input-wrapper-modern {
        gap: 4px;
    }

    .input-actions-right {
        gap: 4px;
    }

    /* Emoji button: keep visible on mobile, smaller size */
    #emojiBtn {
        width: 30px;
        height: 30px;
    }

    /* Messages */
    .message-bubble {
        max-width: 92%;
        padding: 10px 12px;
        font-size: 13px;
        border-radius: 14px;
    }

    .message-header {
        padding: 0;
        margin-bottom: 2px;
    }

    .message-sender {
        font-size: 11px;
    }

    .message-time {
        font-size: 11px;
    }

    .message-original {
        font-size: 13px;
        line-height: 1.4;
    }

    .translation {
        font-size: 11px;
        margin-top: 6px;
        padding-top: 6px;
    }

    .show-original-btn {
        font-size: 10px;
        padding: 3px 6px;
    }

    /* Input area */
    .input-wrapper-modern {
        padding: 6px 8px;
        border-radius: 12px;
    }

    .message-input {
        font-size: 16px;
    }

    .btn-voice, .btn-send {
        min-width: 44px;
        min-height: 44px;
    }

    .btn-attach {
        width: 44px;
        height: 44px;
    }

    /* Room setup */
    .room-setup {
        top: 4px;
        padding: 12px;
        width: min(calc(100vw - 8px), 100%);
        max-height: calc(100vh - 8px);
        max-height: calc(100dvh - 8px);
        border-radius: 12px;
    }

    .user-bar {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        padding: 6px 8px;
        margin-bottom: 8px;
    }

    .user-bar-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        align-items: center;
    }

    .user-bar-info > span {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-bar-balance {
        padding: 3px 6px;
        font-size: 10px;
    }

    .account-menu-wrapper {
        flex-shrink: 0;
    }

    .btn-signout-small {
        padding: 3px 6px;
        font-size: 10px;
    }

    .setup-header {
        margin-bottom: 8px;
    }

    .setup-header h2 {
        font-size: 15px;
    }

    .setup-header p {
        font-size: 10px;
        margin-bottom: 4px;
    }

    .setup-header-compact {
        margin-bottom: 6px;
    }

    .setup-header-compact h2 {
        font-size: 15px;
        gap: 4px;
    }

    .account-menu {
        position: fixed;
        top: 80px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: calc(100vw - 32px);
        max-width: 300px;
    }

    .btn-account-icon {
        width: 30px;
        height: 30px;
    }

    .btn-account-icon svg {
        width: 16px;
        height: 16px;
    }

    .form-group {
        margin-bottom: 6px;
    }

    .form-group label {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .form-control {
        padding: 8px 10px;
        font-size: 16px;
    }

    .room-code-row {
        gap: 6px;
    }

    .auto-detect-toggle {
        padding: 4px 0;
        background: transparent;
        border: none;
        gap: 6px;
        justify-content: flex-start;
        align-self: flex-start;
    }

    .toggle-label {
        font-size: 11px;
    }

    .show-more-btn {
        padding: 6px 10px;
        font-size: 10px;
        margin-top: 6px !important;
    }

    .btn-primary {
        padding: 10px 14px;
        font-size: 13px;
        margin-top: 10px !important;
    }

    .btn-generate {
        padding: 6px 10px;
        font-size: 11px;
    }

    .connection-status {
        padding: 2px 6px;
        font-size: 10px;
        border-radius: 8px;
    }

    .status-dot {
        width: 5px;
        height: 5px;
    }

    /* Panel toggle button - smaller on phone */
    .panel-toggle-btn {
        bottom: 80px !important;
        right: 12px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }
}

/* Input Container */
.input-container {
    padding: 16px 24px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--surface-primary);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    max-width: 100%;
    overflow: visible;
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-secondary);
    border-radius: 20px;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    transition: all 0.2s;
    position: relative;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.btn-attach {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border-radius: var(--btn-radius);
}

.btn-attach:hover,
.btn-attach:focus-visible {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.message-input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    resize: none;
    outline: none !important;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.4;
    font-family: inherit;
    box-shadow: none !important;
}

.message-input:focus,
.message-input:focus-visible {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

/* ========================================== */
/* MODERN INPUT AREA - 2025 PREMIUM STYLE */
/* ========================================== */
.input-wrapper-modern {
    flex: 1;
    min-width: 0;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.input-wrapper-modern:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.08);
}

.input-actions-left {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-input-util {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.btn-input-util:hover,
.btn-input-util:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.btn-input-util:active {
    transform: scale(0.98);
}

.btn-input-util svg {
    position: relative;
    z-index: 1;
}

.input-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-voice {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.btn-voice:hover,
.btn-voice:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.btn-voice:active {
    transform: scale(0.98);
}

/* Ultra-modern 2025 recording state - keeps mic icon, adds animations */
.btn-voice.recording {
    background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
    color: white;
    animation: recording-breathe 2s ease-in-out infinite;
}

/* Breathing animation for recording button */
@keyframes recording-breathe {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.6),
                   0 0 20px rgba(255, 0, 0, 0.3);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 12px rgba(255, 0, 0, 0),
                   0 0 30px rgba(255, 0, 0, 0.5);
    }
}

/* Recording ripple effect (ultra-modern) */
.btn-voice.recording::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 0, 0, 0.6);
    transform: translate(-50%, -50%);
    animation: recording-ripple 2s ease-out infinite;
}

@keyframes recording-ripple {
    0% {
        width: 100%;
        height: 100%;
        opacity: 1;
    }
    100% {
        width: 200%;
        height: 200%;
        opacity: 0;
    }
}

/* Secondary ripple for more depth */
.btn-voice.recording::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(204, 0, 0, 0.4);
    transform: translate(-50%, -50%);
    animation: recording-ripple-outer 2s ease-out infinite 0.6s;
}

@keyframes recording-ripple-outer {
    0% {
        width: 100%;
        height: 100%;
        opacity: 1;
    }
    100% {
        width: 220%;
        height: 220%;
        opacity: 0;
    }
}

/* Ensure SVG stays on top of pseudo-elements */
.btn-voice svg {
    position: relative;
    z-index: 1;
}

.btn-send {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.btn-send:hover,
.btn-send:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.btn-send:active {
    transform: scale(0.98);
    transition: all 0.1s;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.btn-send svg {
    position: relative;
    z-index: 1;
}

.btn-emoji {
    width: var(--btn-icon-size);
    height: var(--btn-icon-size);
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 24px;
    border-radius: var(--btn-radius);
    position: relative;
}

.btn-emoji:hover,
.btn-emoji:focus-visible {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.btn-emoji:active {
    opacity: 0.7;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-primary {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cta-gradient);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.btn-icon-primary:hover,
.btn-icon-primary:focus-visible {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-icon-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Send button gets extra pop */
.btn-icon-primary.send {
    background: var(--cta-gradient);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3),
                0 0 0 0 rgba(37, 99, 235, 0.4);
}

.btn-icon-primary.send:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.4),
                0 0 0 4px rgba(37, 99, 235, 0.1);
}

.btn-icon-primary.send svg {
    transform: translateX(1px);
}

/* Intelligence Panel */
.intelligence-panel {
    width: 380px;
    background: var(--surface-primary);
    border-left: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
}

/* Mobile panel toggle button - hidden on desktop */
.panel-toggle-btn {
    display: none;
    position: fixed;
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    z-index: 999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-size: 22px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.panel-toggle-btn:active {
    transform: scale(0.92);
}

/* Mobile panel overlay backdrop */
.panel-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Drag handle - hidden on desktop, shown on mobile via 768px query */
.sheet-drag-handle {
    display: none;
}

.panel-overlay.active {
    display: block;
}

/* Close button inside panel - hidden on desktop */
.panel-close-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1001;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-hover);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    font-size: 18px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Panel Tabs */
.panel-tabs {
    display: flex;
    padding: 12px;
    gap: 8px;
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.panel-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.panel-tab:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.panel-tab.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.tab-icon {
    font-size: 16px;
}

.tab-badge {
    background: var(--error);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
}

/* Panel Content */
.panel-content {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 20px;
    overflow: hidden;
}

.panel-content.active {
    display: flex;
}

/* AI Panel */
.ai-card {
    background: var(--surface-secondary);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-primary);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.ai-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.ai-avatar-container {
    position: relative;
}

.ai-avatar {
    width: 52px;
    height: 52px;
    background: var(--primary-gradient);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2),
                0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ai-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.3),
                0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Animate only when AI is thinking */
.ai-avatar.thinking {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 24px rgba(255, 107, 107, 0.4),
                    0 0 48px rgba(255, 107, 107, 0.2),
                    0 4px 12px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 32px rgba(255, 107, 107, 0.6),
                    0 0 64px rgba(255, 107, 107, 0.3),
                    0 4px 16px rgba(0, 0, 0, 0.4);
    }
}

/* Removed green dot - using avatar animation instead */

.ai-info h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #FFFFFF 0%, #E0E0E0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-status {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-status::before {
    content: '●';
    color: #2563EB;
    font-size: 10px;
    animation: pulse-dot 2s ease-in-out infinite;
}

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


.ai-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-primary);
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* AI Chat Layout */
.ai-chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ai-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    background: var(--surface-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
}

.ai-quick-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.btn-ai-quick {
    flex: 1;
    padding: 10px;
    background: var(--surface-hover);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}

.ai-input-row {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.ai-input-row input {
    flex: 1;
    padding: 12px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

/* ==========================================
   MOBILE BOTTOM SHEET - must be after ALL base styles
   ========================================== */
@media (max-width: 768px) {
    /* Bottom sheet panel */
    .intelligence-panel {
        display: none !important;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        height: 85vh;
        height: 85dvh;
        z-index: 1000;
        border-left: none;
        border-top: 1px solid var(--border-primary);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        will-change: transform;
    }

    .intelligence-panel.mobile-open {
        display: flex !important;
    }

    .sheet-drag-handle {
        display: flex !important;
        justify-content: center;
        padding: 10px 0 4px;
        cursor: grab;
        flex-shrink: 0;
        -webkit-user-select: none;
        user-select: none;
    }

    .sheet-drag-handle .handle-bar {
        width: 40px;
        height: 4px;
        background: var(--text-tertiary);
        border-radius: 4px;
        opacity: 0.5;
    }

    .panel-toggle-btn {
        display: flex !important;
    }

    .panel-close-btn {
        display: flex !important;
        top: 8px;
        right: 12px;
    }

    .panel-tabs {
        padding: 8px 12px;
    }

    .panel-tab {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Mobile: strip card styling for full-width bottom sheet */
    .ai-card {
        border-radius: 0;
        border: none;
        padding: 8px 14px 14px;
        background: transparent;
    }

    .ai-header {
        display: none;
    }

    .ai-chat-messages {
        border-radius: 12px;
    }

    .ai-footer {
        margin-top: 4px;
        padding-top: 4px;
        font-size: 11px;
    }
}

/* Visual Panel */
.visual-placeholder {
    text-align: center;
    padding: 40px 20px;
}

.placeholder-icon-wrapper {
    margin-bottom: 20px;
    opacity: 0.8;
}

/* Typing Indicator - Avatar Animation */
.participant-avatar.typing {
    animation: typingPulse 1.5s infinite ease-in-out;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.3);
}

@keyframes typingPulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.6);
        transform: scale(1.05);
    }
}

.no-events {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 20px;
    font-style: italic;
}

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--surface-primary) 0%, var(--surface-secondary) 100%);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    height: 40px;
    justify-content: center;
}

.action-btn:hover {
    background: var(--cta-gradient);
    color: white;
    border-color: var(--cta);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn .btn-icon {
    font-size: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}


.time-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.time-slot {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.time-slot:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.time-slot.selected {
    background: var(--primary);
    border-color: var(--primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Room Setup Styles - Compact Layout */
/* Auth Header in Room Setup */
.auth-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.auth-signin-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary, #2563EB);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-signin-btn:hover {
    background: #1d4ed8;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-size: 13px;
    color: var(--text-secondary, #888);
}

.balance-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface-secondary, #252540);
    border: 1px solid var(--border-primary, #333);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.balance-display:hover {
    border-color: var(--primary, #2563EB);
}

.balance-display .add-btn {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary, #2563EB);
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}

.logout-btn {
    padding: 6px;
    background: transparent;
    border: 1px solid var(--border-primary, #333);
    border-radius: 6px;
    color: var(--text-secondary, #888);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.logout-btn:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Auth Screen - Shown First */
.auth-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary, #0d0d1a);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px 0;
}

.auth-screen-content {
    background: var(--surface-primary, #1a1a2e);
    border: 1px solid var(--border-primary, #333);
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    margin: auto 0;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary, #fff);
}

.auth-value-prop {
    text-align: center;
    margin-bottom: 28px;
}

.value-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 20px;
    color: var(--primary, #2563EB);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.auth-value-prop p {
    color: var(--text-secondary, #888);
    font-size: 14px;
    margin: 0;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid var(--border-primary, #333);
    border-radius: 10px;
    color: var(--text-secondary, #888);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--primary, #2563EB);
    border-color: var(--primary, #2563EB);
    color: white;
}

.auth-tab:hover:not(.active) {
    border-color: var(--text-secondary, #888);
}

.auth-screen-form .form-group {
    margin-bottom: 16px;
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 44px;
}

.btn-toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-primary, #ccc);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.btn-toggle-password:hover {
    opacity: 1;
}

.auth-error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    padding: 10px 14px;
    color: #ff6b6b;
    font-size: 13px;
    margin-bottom: 16px;
}

.btn-auth-primary {
    width: 100%;
    padding: 14px 20px;
    background: var(--cta-gradient, linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-auth-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-auth-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-primary, #333);
}

.auth-divider span {
    font-size: 12px;
    color: var(--text-tertiary, #666);
}

.oauth-buttons {
    display: flex;
    gap: 12px;
}

.oauth-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface-secondary, #252540);
    border: 1px solid var(--border-primary, #333);
    border-radius: 10px;
    color: var(--text-primary, #fff);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.oauth-btn:hover {
    border-color: var(--primary, #2563EB);
}

/* User Bar in Room Setup */
.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface-secondary, #252540);
    border: 1px solid var(--border-primary, #333);
    border-radius: 12px;
    margin-bottom: 20px;
}

.user-bar-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-bar-info > span {
    font-size: 14px;
    color: var(--text-secondary, #888);
}

.user-bar-info strong {
    color: var(--text-primary, #fff);
}

.user-bar-balance {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface-primary, #1a1a2e);
    border: 1px solid var(--border-primary, #333);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary, #fff);
    cursor: pointer;
    transition: all 0.2s;
}

.user-bar-balance:hover {
    border-color: var(--primary, #2563EB);
}

.user-bar-balance svg {
    color: var(--primary, #2563EB);
}

.topup-link {
    color: var(--primary, #2563EB);
    font-weight: 500;
    margin-left: 4px;
}

.btn-signout-small {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border-primary, #333);
    border-radius: 8px;
    color: var(--text-secondary, #888);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-signout-small:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Account Menu */
.account-menu-wrapper {
    position: relative;
}

.btn-account-icon {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.btn-account-icon:hover {
    border-color: var(--primary, #2563EB);
    color: var(--primary, #2563EB);
}

.account-menu-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #f59e0b;
    border-radius: 50%;
    border: 2px solid var(--surface-secondary);
}

.account-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    animation: accountMenuFadeIn 0.15s ease;
}

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

.account-menu-section {
    padding: 12px 14px;
}

.account-menu-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary, #9AA1B4);
    margin-bottom: 8px;
}

.account-menu-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 0;
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
    position: relative;
}

.account-menu-item:hover {
    background: var(--surface-hover);
}

.account-menu-item svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.account-menu-signout {
    color: #ef4444;
}

.account-menu-signout svg {
    color: #ef4444;
}

.account-menu-signout:hover {
    background: rgba(239, 68, 68, 0.08);
}

.account-menu-delete {
    color: #94a3b8;
    font-size: 12px;
}

.account-menu-delete svg {
    color: #94a3b8;
}

.account-menu-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.account-menu-delete:hover svg {
    color: #ef4444;
}

/* Delete Account Modal */
.delete-account-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.delete-account-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    max-width: 420px;
    width: 100%;
}

.delete-account-modal h3 {
    color: #ef4444;
    margin: 0 0 12px;
    font-size: 18px;
}

.delete-account-modal p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px;
}

.delete-account-modal input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.delete-account-modal input:focus {
    border-color: #ef4444;
    outline: none;
}

.delete-account-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.delete-account-actions button {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.btn-delete-cancel {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-delete-confirm {
    background: #ef4444;
    color: #fff;
}

.btn-delete-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast Notifications */
.lingo-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    max-width: 360px;
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.lingo-toast-visible { opacity: 1; transform: translateX(0); }
.lingo-toast-success { background: #059669; border: 1px solid #10b981; }
.lingo-toast-error { background: #dc2626; border: 1px solid #ef4444; }
.lingo-toast-info { background: #2563eb; border: 1px solid #3b82f6; }

/* Org Modal Styles */
.org-modal-card {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 24px;
    max-width: 480px;
    width: 90%;
    color: var(--text-primary);
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 48px rgba(0,0,0,0.4);
}
.org-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.org-modal-header h3 { margin: 0; font-size: 16px; }
.org-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}
.org-modal-close:hover { background: var(--surface-hover); }
.org-modal-stat {
    margin-bottom: 16px;
    padding: 10px;
    background: var(--surface-secondary, rgba(255,255,255,0.03));
    border-radius: 8px;
}
.org-modal-member {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--surface-secondary, rgba(255,255,255,0.03));
    border-radius: 8px;
}
.org-modal-subtitle {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text-tertiary);
}
.org-modal-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface-secondary, rgba(255,255,255,0.05));
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
.org-modal-input:focus { border-color: var(--primary, #2563EB); }
.org-modal-input::placeholder { color: var(--text-tertiary); }

/* Org Button Styles */
.org-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    border: none;
    transition: opacity 0.15s;
}
.org-btn:hover { opacity: 0.85; }
.org-btn svg { width: 12px; height: 12px; flex-shrink: 0; }
.org-btn-primary { background: #38A3F5; color: #fff; }
.org-btn-secondary { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border-primary); }
.org-btn-danger { background: none; border: 1px solid rgba(239,68,68,0.3); color: #ef4444; }
.org-btn-create {
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    font-size: 12px;
    background: rgba(56,163,245,0.1);
    border: 1px dashed rgba(56,163,245,0.4);
    color: #38A3F5;
}
.org-btn-create:hover { background: rgba(56,163,245,0.2); }
.org-btn-green { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #10b981; }

@media (max-width: 480px) {
    .org-modal-card { padding: 16px; }
}

/* Tablet Responsive for Auth Screen */
@media (max-width: 600px) {
    .auth-screen-content {
        padding: 32px 28px;
        width: 92%;
    }

    .auth-logo {
        margin-bottom: 20px;
    }
}

/* Mobile Responsive for Auth Screen */
@media (max-width: 480px) {
    .auth-screen-content {
        padding: 24px 20px;
        border-radius: 16px;
        width: 95%;
        max-width: none;
    }

    .auth-logo {
        margin-bottom: 16px;
    }

    .auth-logo h1 {
        font-size: 20px;
    }

    .auth-logo svg {
        width: 40px;
        height: 40px;
    }

    .auth-value-prop {
        margin-bottom: 16px;
    }

    .auth-value-prop p {
        font-size: 13px;
    }

    .value-badge {
        font-size: 12px;
        padding: 5px 10px;
    }

    .auth-tabs {
        margin-bottom: 16px;
    }

    .auth-tab {
        padding: 10px 8px;
        font-size: 13px;
    }

    .auth-screen-form .form-group {
        margin-bottom: 12px;
    }

    .auth-screen-form .form-group label {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .auth-screen-form .form-control {
        padding: 10px 12px;
        font-size: 16px;
    }

    .auth-divider {
        margin: 16px 0;
    }

    .oauth-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .oauth-btn {
        padding: 12px 16px;
        font-size: 13px;
    }

    .btn-auth-primary {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Balance Warning Notification */
.balance-notification {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 184, 0, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 184, 0, 0.4);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #FFB800;
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    animation: slideDown 0.35s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    max-width: calc(100% - 32px);
    width: auto;
    box-sizing: border-box;
}

.balance-notification svg {
    flex-shrink: 0;
}

.balance-notification span {
    flex: 1;
    min-width: 0;
}

.balance-notification button {
    background: #FFB800;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 36px;
    transition: all 0.2s;
}

.balance-notification button:hover {
    background: #FFC933;
}

.balance-notification .balance-close {
    background: transparent;
    color: #FFB800;
    padding: 4px;
    min-height: auto;
    font-size: 18px;
    line-height: 1;
    opacity: 0.7;
}

.balance-notification .balance-close:hover {
    background: transparent;
    opacity: 1;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.room-setup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    touch-action: none;
}

.room-setup {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    padding: 24px 32px;
    backdrop-filter: blur(40px) saturate(120%);
    -webkit-backdrop-filter: blur(40px) saturate(120%);
    max-width: 720px;
    width: 90%;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 16px 48px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.room-setup::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, 
        rgba(0, 212, 255, 0.3) 0%, 
        rgba(107, 70, 193, 0.3) 50%,
        rgba(0, 212, 255, 0.3) 100%
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.4;
}

.setup-header {
    text-align: center;
    margin-bottom: 24px;
    margin-top: 0;
}

.setup-header .connection-status {
    margin-top: 16px;
}

.setup-header-compact {
    margin-bottom: 16px;
}

.setup-header-compact h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.setup-header-compact .connection-status {
    margin-top: 0;
    font-size: 10px;
}

.input-with-button {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-button .form-control {
    padding-right: 120px;
}

.btn-generate {
    position: absolute;
    right: 8px;
    background: var(--cta-gradient);
    border: none;
    border-radius: 12px;
    padding: 8px 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    font-size: 12px;
    font-weight: 500;
}

.btn-generate:hover {
    box-shadow:
        0 4px 12px rgba(37, 99, 235, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-generate:active {
    transform: scale(0.98);
    transition: all 0.1s;
}

/* Clean Message System - Desktop Version Styling */

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

.message.ai-response .message-content {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
}


/* ROOM-CONTEXT-BASED RTL SYSTEM */

/* Arabic Room Context */
.room-arabic {
    direction: rtl;
}

.room-arabic .message-content {
    font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', sans-serif;
}

.room-english .message-content {
    font-family: 'Noto Sans', 'Plus Jakarta Sans', sans-serif;
}

/* Message Headers - Room Context Based */
/* Own messages: Always right-aligned regardless of room language */
.message.own .message-header {
    justify-content: flex-end !important;
    text-align: right !important;
    display: flex !important;
    flex-direction: row-reverse !important;
}

.message.own .message-sender,
.message.own .message-time {
    text-align: right !important;
}


/* OWN MESSAGES: ALWAYS RIGHT-ALIGNED (regardless of room language) */

/* OTHER MESSAGES: Room-context based */
/* Other messages in Arabic rooms: Right-aligned */
.room-arabic .message:not(.own) .message-header {
    justify-content: flex-end;
    text-align: right;
}

.room-arabic .message:not(.own) .message-sender,
.room-arabic .message:not(.own) .message-time {
    text-align: right;
}

/* Other messages in English rooms: Left-aligned */
.room-english .message:not(.own) .message-header {
    justify-content: flex-start;
    text-align: left;
}

.room-english .message:not(.own) .message-sender,
.room-english .message:not(.own) .message-time {
    text-align: left;
}

/* RTL Content Support - For mixed content within messages */
.message-content[dir="rtl"] {
    unicode-bidi: embed;
    direction: rtl;
    text-align: right;
    font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', sans-serif;
}

.message-content[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

/* Original text always LTR for readability - merged with main rule */



/* Message animations */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageFloatIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Voice Button States - Ultra-modern 2025 */
.btn-icon-primary.recording {
    background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
    animation: recording-breathe 2s ease-in-out infinite;
    position: relative;
    border-radius: 50%;
}

.btn-icon-primary.recording::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 0, 0, 0.6);
    transform: translate(-50%, -50%);
    animation: recording-ripple 2s ease-out infinite;
}

.btn-icon-primary.recording::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(204, 0, 0, 0.4);
    transform: translate(-50%, -50%);
    animation: recording-ripple 2s ease-out infinite 0.6s;
}

.btn-icon-primary svg {
    position: relative;
    z-index: 1;
}

@keyframes aiThinking {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
    25% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(255, 107, 107, 0.2);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 0 12px rgba(255, 107, 107, 0.1);
    }
    75% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(255, 107, 107, 0.2);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
}

@keyframes aiListening {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.3);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.3);
    }
}

/* ROOM-CONTEXT-BASED INPUT RTL SYSTEM */

/* Arabic Room Input */
.room-arabic .message-input {
    direction: rtl;
    text-align: right;
    font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', sans-serif;
    unicode-bidi: embed;
    writing-mode: horizontal-tb;
}

.room-arabic .message-input::placeholder {
    direction: rtl;
    text-align: right;
}

/* English Room Input */
.room-english .message-input {
    direction: ltr;
    text-align: left;
}

.room-english .message-input::placeholder {
    direction: ltr;
    text-align: left;
}

/* Dynamic RTL Input - For content-based switching */
.message-input[dir="rtl"] {
    direction: rtl;
    text-align: right;
    font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', sans-serif;
    unicode-bidi: embed;
    writing-mode: horizontal-tb;
}

.message-input[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

/* RTL Cursor Positioning Fix - Aggressive */
.message-input[dir="rtl"],
.message-input.arabic-input,
.message-input.rtl-input {
    text-align: right !important;
    direction: rtl !important;
    unicode-bidi: embed !important;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

/* Ensure cursor appears on right side in RTL */
.message-input[dir="rtl"]:focus,
.message-input.arabic-input:focus,
.message-input.rtl-input:focus {
    text-align: right !important;
    direction: rtl !important;
    unicode-bidi: embed !important;
    writing-mode: horizontal-tb !important;
}

/* Force RTL cursor positioning with CSS */
.message-input[dir="rtl"]::selection,
.message-input.arabic-input::selection,
.message-input.rtl-input::selection {
    direction: rtl !important;
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 9999;
    width: 340px;
    max-height: 380px;
    display: none;
    margin-bottom: 8px;
    animation: emojiSlideUp 0.3s ease-out;
}

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

.emoji-picker.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (max-width: 480px) {
    .emoji-picker {
        width: calc(100vw - 32px);
        right: -8px;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }

    .emoji-item {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}

.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-primary);
}

.emoji-picker-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.emoji-search-container {
    margin-bottom: 12px;
}

.emoji-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--surface-secondary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.emoji-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
}

.emoji-categories {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-primary);
    overflow-x: auto;
}

.emoji-category {
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.emoji-category:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.emoji-category.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.emoji-picker-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.emoji-picker-close:hover {
    background: var(--surface-hover);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
    padding: 8px 0;
}

.emoji-item {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
}

.emoji-item:hover {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.2);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

.emoji-item:active {
    transform: scale(0.95);
    background: rgba(255, 107, 107, 0.2);
}

/* Voice Recording Visualizations */
.voice-visualizer {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    align-items: end;
}

.voice-bar {
    width: 3px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: all 0.1s ease;
}

.voice-bar.active {
    background: var(--primary-color);
    height: 12px;
}

.voice-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.voice-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    opacity: 0;
    animation: voicePulse 1.5s infinite;
}

.voice-wave:nth-child(2) {
    animation-delay: 0.5s;
}

.voice-wave:nth-child(3) {
    animation-delay: 1s;
}

@keyframes voicePulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.voice-btn.recording {
    background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
    color: white;
    animation: recording-breathe 2s ease-in-out infinite;
    position: relative;
    border-radius: 50%;
}

.voice-btn.recording::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 0, 0, 0.6);
    transform: translate(-50%, -50%);
    animation: recording-ripple 2s ease-out infinite;
}

.voice-btn.recording::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(204, 0, 0, 0.4);
    transform: translate(-50%, -50%);
    animation: recording-ripple 2s ease-out infinite 0.6s;
}

.voice-btn svg {
    position: relative;
    z-index: 1;
}

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

.room-setup h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.room-setup p {
    color: var(--text-3);
    text-align: center;
    margin-bottom: 16px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-control::placeholder {
    color: var(--text-secondary, #888);
    opacity: 0.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.language-selector {
    background: var(--surface-primary);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.auto-detect-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    flex-shrink: 0;
}

.room-code-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.room-code-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-secondary);
    border: 2px solid var(--border-primary);
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background: var(--primary-gradient);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 0;
}

.language-option {
    padding: 12px 10px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.language-option:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 4px 12px rgba(0, 212, 255, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.language-option:active {
    transform: translateY(0) scale(1);
    transition: all 0.1s;
}

.language-option.selected {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

/* Language grid responsive - MUST be after base styles */
@media (max-width: 768px) {
    .language-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .language-option {
        padding: 10px 6px;
        font-size: 12px;
    }
}

@media (max-width: 600px) {
    .language-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .language-option {
        padding: 10px 6px;
        font-size: 12px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .language-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
    .language-option {
        padding: 10px 4px;
        min-height: 44px;
        font-size: 11px;
        border-radius: 6px;
    }
}

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: var(--cta-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px rgba(37, 99, 235, 0.35),
        0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
    transform: translateY(0);
    transition: all 0.1s;
}

.show-more-btn {
    width: 100%;
    padding: 14px 18px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    font-size: 13px;
}

.show-more-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 4px 12px rgba(0, 212, 255, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.show-more-btn:active {
    transform: translateY(0) scale(1);
    transition: all 0.1s;
}

/* Language Modal */
.language-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    direction: ltr;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overscroll-behavior: contain;
}

.language-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.language-modal {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    max-width: 800px;
    max-height: 80vh;
    max-height: 80dvh;
    width: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 48px rgba(0,0,0,0.4);
    position: relative;
}

/* ========================================== */
/* MODAL & POPUP STYLES */
/* ========================================== */
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 1;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-primary);
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 700;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-language-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-start;
}

.modal-language-option.selected {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Invite Modal Styles */
.invite-section {
    margin-bottom: 24px;
}

.invite-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.invite-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.invite-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--surface-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.invite-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.invite-input[readonly] {
    background: var(--surface-secondary);
    color: var(--text-secondary);
}

.btn-invite {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--cta-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-invite:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.quick-share-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-share {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--surface-secondary);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

.btn-share:hover {
    background: rgba(0, 102, 204, 0.1);
    color: var(--primary);
}

.btn-share svg {
    width: 18px;
    height: 18px;
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-search-container {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-primary);
}

.modal-search {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    color: var(--text-1);
    font-size: 16px;
}

.modal-search::placeholder {
    color: var(--text-tertiary);
}

.modal-body {
    padding: 20px 30px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.language-section {
    margin-bottom: 30px;
}

/* Duplicate removed - using first definition above */

.modal-language-option {
    padding: 12px 16px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    text-align: left;
}

.modal-language-option:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.all-languages-dropdown {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    margin-top: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.type-hint {
    padding: 10px 15px;
    color: var(--text-3);
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    font-style: italic;
}

.modal-lang-btn {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    padding: 12px 16px;
    text-align: left;
    flex: 1 1 200px;
    min-width: 200px;
    max-width: 250px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    font-family: 'Noto Sans', 'Noto Sans Arabic', 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans Devanagari', 'Noto Sans Thai', 'Noto Sans Cyrillic', 'Plus Jakarta Sans', sans-serif;
}

.modal-lang-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.modal-lang-btn:active {
    transform: scale(0.98);
    transition: all 0.1s;
}

.modal-lang-btn .native {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: 'Noto Sans', 'Noto Sans Arabic', 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans Devanagari', 'Noto Sans Thai', 'Noto Sans Cyrillic', 'Plus Jakarta Sans', sans-serif;
    text-align: right;
    white-space: nowrap;
}

/* Arabic Dialect Picker */
.arabic-dialect-back {
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    padding: 6px 14px;
    width: fit-content;
}

.arabic-dialect-back:hover {
    color: var(--text-primary);
    border-color: var(--primary);
}

#arabicDialectSection .modal-language-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

#arabicDialectSection .modal-lang-btn {
    min-width: 0;
    max-width: none;
    width: 100%;
    justify-content: center;
    text-align: center;
}

@media (max-width: 768px) {
    #arabicDialectSection .modal-language-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    #arabicDialectSection .modal-language-grid {
        grid-template-columns: 1fr 1fr;
    }

    #arabicDialectSection .modal-lang-btn {
        padding: 10px 8px;
        font-size: 13px;
    }
}

/* Modal Mobile Responsive */
@media (max-width: 768px) {
    .language-modal {
        max-width: 95%;
        max-height: 85vh;
        border-radius: 16px;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-header h2 {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .modal-body {
        padding: 16px 20px;
    }

    .modal-language-grid {
        gap: 10px;
    }

    .modal-lang-btn {
        min-width: 0;
        max-width: none;
        flex: 1 1 calc(50% - 5px);
    }

    .modal-language-option {
        padding: 10px 14px;
    }

    .modal-close {
        top: 12px;
        right: 12px;
        font-size: 24px;
    }

    .invite-input-group {
        flex-direction: column;
    }

    .invite-input-group .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .language-modal {
        max-width: 98%;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 12px;
        margin: 0 8px;
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-header h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .modal-search {
        padding: 10px 14px;
        font-size: 16px;
    }

    .modal-body {
        padding: 14px 16px;
    }

    .language-section {
        margin-bottom: 20px;
    }

    .section-title {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .modal-language-grid {
        gap: 8px;
    }

    .modal-language-option {
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 8px;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        font-size: 22px;
    }

    .modal-lang-btn {
        padding: 10px 12px;
        font-size: 13px;
        min-width: 0;
        max-width: none;
        flex: 1 1 100%;
    }

    .modal-lang-btn .native {
        font-size: 11px;
    }

    .invite-section h4 {
        font-size: 13px;
    }

    .invite-input {
        padding: 10px 14px;
        font-size: 13px;
    }

    .all-languages-dropdown {
        padding: 14px;
        max-height: 300px;
    }
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator.visible {
    max-height: 30px;
    padding: 4px 20px;
}

.typing-indicator-text {
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
}

.typing-dots {
    display: inline-flex;
    gap: 2px;
    margin-left: 2px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: typingBounce 1.4s infinite;
}

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

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

/* ===== RECORDING ACTIVITY INDICATOR ===== */
.typing-indicator.recording-active .typing-indicator-text {
    color: var(--error, #ef4444);
}

.typing-indicator.recording-active::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error, #ef4444);
    animation: recordingPulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes recordingPulse {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ===== RECORDING TIMER ===== */
.recording-timer {
    display: none;
    align-items: center;
    gap: 6px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: #FF4444;
    font-weight: 600;
    white-space: nowrap;
}

.recording-timer.active {
    display: inline-flex;
}

.recording-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FF4444;
    animation: recordingPulse 1.2s infinite;
}

@keyframes recordingPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* ===== REPLY PREVIEW ===== */
.reply-preview {
    display: none;
    align-items: center;
    padding: 8px 16px;
    background: var(--surface-secondary);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    margin: 0 16px 8px 16px;
    gap: 8px;
}

.reply-preview.visible {
    display: flex;
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
}

.reply-preview-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

.reply-preview-text {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.2s;
}

.reply-preview-close:hover {
    color: var(--text-primary);
}

/* Reply quote inside message bubble */
.reply-quote {
    font-size: 12px;
    color: var(--text-tertiary);
    background: var(--surface-hover);
    border-left: 2px solid var(--primary);
    border-radius: 0 6px 6px 0;
    padding: 6px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
    max-width: 100%;
    overflow: hidden;
}

.reply-quote:hover {
    background: var(--surface-secondary);
}

.reply-quote-sender {
    font-weight: 600;
    color: var(--primary);
    font-size: 11px;
    margin-bottom: 2px;
}

.reply-quote-text {
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message.own .reply-quote {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.message.own .reply-quote-sender {
    color: rgba(255, 255, 255, 0.9);
}

.message.own .reply-quote-text {
    color: rgba(255, 255, 255, 0.7);
}

/* ===== MESSAGE REACTIONS ===== */
.message-bubble-wrapper {
    position: relative;
    max-width: 70%;
}

.message-bubble-wrapper .message-bubble {
    max-width: 100%;
}

.reaction-bar {
    display: none;
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 24px;
    padding: 4px 6px;
    gap: 2px;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: reactionBarIn 0.2s ease;
}

.message.own .reaction-bar {
    left: auto;
    right: 0;
}

.reaction-bar.visible {
    display: flex;
}

@keyframes reactionBarIn {
    from { opacity: 0; transform: translateY(4px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.reaction-bar button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 5px;
    border-radius: 8px;
    transition: background 0.15s, transform 0.15s;
    line-height: 1;
}

.reaction-bar button:hover {
    background: var(--surface-hover);
    transform: scale(1.2);
}

.reaction-bar .reply-btn {
    font-size: 14px;
    color: var(--text-tertiary);
    border-left: 1px solid var(--border-primary);
    margin-left: 2px;
    padding-left: 8px;
}

.reaction-bar .reply-btn:hover {
    color: var(--primary);
}

.reaction-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    padding: 0 4px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.reaction-badge:hover {
    background: var(--surface-hover);
}

.reaction-badge.own-reaction {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

.reaction-badge-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 600;
}

/* Hide reaction bar on emoji-only messages */
.message.emoji-message .reaction-bar {
    display: none !important;
}

@media (max-width: 768px) {
    .message-bubble-wrapper {
        max-width: 85%;
    }

    .reaction-bar {
        top: -38px;
    }

    .reaction-bar button {
        font-size: 16px;
        padding: 3px 4px;
    }

    .recording-timer {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .message-bubble-wrapper {
        max-width: 90%;
    }

    .reply-preview {
        margin: 0 8px 6px 8px;
    }
}

/* ===================
   SUPPORT TICKET STYLES
   =================== */

.btn-support-small {
    background: none;
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    transition: all 0.2s;
    position: relative;
}

.support-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--surface-primary, #0F1219);
}

.btn-support-small:hover {
    color: var(--primary, #2563EB);
    border-color: var(--primary, #2563EB);
}

.support-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.support-tab {
    background: none;
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    padding: 0.375rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    transition: all 0.2s;
}

.support-tab.active {
    background: var(--primary, #2563EB);
    color: #fff;
    border-color: var(--primary, #2563EB);
}

.ticket-item {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ticket-item:hover {
    border-color: var(--primary, #2563EB);
}

.ticket-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.ticket-item-subject {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.ticket-item-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.ticket-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ticket-status.open { background: #854d0e; color: #fde047; }
.ticket-status.replied { background: #166534; color: #86efac; }
.ticket-status.closed { background: #334155; color: #94a3b8; }

.thread-message {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.thread-message.user-msg {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
}

.thread-message.admin-msg {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.thread-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.thread-meta .admin-badge {
    background: var(--primary, #2563EB);
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
}

.ticket-reply-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-primary);
}

.ticket-reply-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--surface-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.ticket-reply-form button {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.625rem;
    background: var(--primary-gradient, #2563EB);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* ========================================== */
/* ONBOARDING MODAL                           */
/* ========================================== */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.onboarding-overlay.visible {
    opacity: 1;
}
.onboarding-card {
    background: var(--surface-primary, #1A1F2B);
    border: 1px solid var(--border-primary, rgba(255,255,255,0.07));
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    padding: 2rem 1.75rem 1.5rem;
    position: relative;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s ease;
}
.onboarding-overlay.visible .onboarding-card {
    transform: translateY(0) scale(1);
}
.onboarding-skip {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-tertiary, #9AA1B4);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 8px;
}
.onboarding-skip:hover {
    color: var(--text-primary, #F7F9FC);
}
.onboarding-slide {
    display: none;
    text-align: center;
}
.onboarding-slide.active {
    display: block;
}
.onboarding-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}
.onboarding-icon svg {
    width: 32px;
    height: 32px;
}
.onboarding-slide h3 {
    color: var(--text-primary, #F7F9FC);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.onboarding-slide p {
    color: var(--text-secondary, #D1D6E3);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}
.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1.25rem;
}
.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border, #303748);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.onboarding-dot.active {
    background: var(--primary, #2563EB);
    transform: scale(1.25);
}
.onboarding-next {
    width: 100%;
    padding: 0.75rem;
    background: var(--cta-gradient, #2563EB);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}
.onboarding-next:hover {
    opacity: 0.9;
}
@media (max-width: 480px) {
    .onboarding-card {
        width: 94%;
        padding: 1.5rem 1.25rem 1.25rem;
    }
    .onboarding-icon {
        width: 52px;
        height: 52px;
        border-radius: 12px;
    }
    .onboarding-icon svg {
        width: 26px;
        height: 26px;
    }
    .onboarding-slide h3 {
        font-size: 1.1rem;
    }
    .onboarding-slide p {
        font-size: 0.85rem;
    }
}

/* ==========================================
   SEARCH BAR
   ========================================== */
.search-bar {
    display: none;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    gap: 8px;
}
.search-bar.active {
    display: flex;
}
.search-bar input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}
.search-bar input:focus {
    border-color: var(--primary-color);
}
#searchCount {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 60px;
}
.search-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 4px;
}
.search-nav-btn:hover {
    background: var(--bg-hover);
}
.message.search-dim {
    opacity: 0.25;
}
.message.search-current {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 12px;
}

/* ==========================================
   HISTORY DIVIDERS
   ========================================== */
.history-divider {
    text-align: center;
    padding: 8px 0;
    margin: 12px 0;
    position: relative;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.history-divider span {
    background: var(--bg-primary);
    padding: 0 12px;
    position: relative;
    z-index: 1;
}
.history-divider::before {
    content: '';
    position: absolute;
    left: 20px;
    right: 20px;
    top: 50%;
    border-top: 1px solid var(--border-color);
}

/* ==========================================
   TRANSLATION STYLE SELECTOR
   ========================================== */
.style-select {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    appearance: auto;
}
.style-select:focus {
    border-color: var(--primary-color);
}
.style-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ==========================================
   SOUND TOGGLE ACTIVE STATE
   ========================================== */
.btn-icon#soundToggle.active {
    color: var(--primary-color);
}

/* ==========================================
   HEADER OVERFLOW MENU
   ========================================== */
#moreBtn {
    display: flex;
}

.header-actions {
    position: relative;
}

.overflow-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    flex-direction: column;
    gap: 2px;
}

.overflow-menu.active {
    display: flex;
}

.overflow-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.overflow-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.light-mode .overflow-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.overflow-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.overflow-style-group {
    flex-direction: column !important;
    gap: 6px !important;
    padding: 10px 12px !important;
    cursor: default;
}

.overflow-style-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.style-pills {
    display: flex;
    gap: 0;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 2px;
    border: 1px solid var(--border-color);
}

.style-pill {
    flex: 1;
    padding: 5px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.style-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.style-pill.active {
    background: #2563EB;
    color: #fff;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.3);
}

body.light-mode .style-pills {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .style-pill:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.light-mode .style-pill.active {
    background: #2563EB;
    color: #fff;
}

/* ==========================================
   RESPONSIVE - MOBILE HEADER
   ========================================== */

/* Tablet: show overflow, hide secondary buttons */
@media (max-width: 768px) {
    .style-select {
        display: none !important;
    }

    #searchBtn,
    #glossaryBtn,
    #soundToggle {
        display: none !important;
    }
}

/* Mobile: overflow menu replaces secondary buttons */
@media (max-width: 600px) {
    #searchBtn,
    #glossaryBtn,
    #saveTranscriptBtn,
    #soundToggle,
    .style-select {
        display: none !important;
    }

    .header-actions {
        gap: 4px;
    }

    .header-actions .btn-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .header-actions .btn-icon svg {
        width: 18px;
        height: 18px;
    }

    /* Hide TTS on small screens - not essential */
    #ttsToggle {
        display: none !important;
    }

    .search-bar {
        padding: 6px 8px;
    }
    .search-bar input {
        font-size: 13px;
        padding: 5px 8px;
    }
}

@media (max-width: 480px) {
    .header-actions .btn-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }

    .header-actions .btn-icon svg {
        width: 16px;
        height: 16px;
    }

    .btn-leave {
        padding: 6px 8px;
        font-size: 11px;
    }
}

/* ========================================== */
/* REDUCED MOTION ACCESSIBILITY               */
/* ========================================== */
@media (prefers-reduced-motion: reduce) {
    .btn-voice.recording::before,
    .btn-voice.recording::after {
        animation: none !important;
    }

    .btn-voice.recording {
        animation: none !important;
    }

    @keyframes messageSlide {
        from { opacity: 1; transform: none; }
        to { opacity: 1; transform: none; }
    }

    .pulse-glow,
    .ai-avatar::after {
        animation: none !important;
    }

    .typing-indicator span {
        animation: none !important;
    }

    .intelligence-panel {
        will-change: auto;
        transition: none !important;
    }

    .message-bubble {
        animation-duration: 0.01ms !important;
    }

    .onboarding-slide {
        transition: none !important;
    }
}


/* Phase 1: Session Timer + Overrun Alerts */
#remainingTimeStat .stat-value { transition: color 0.3s ease; font-variant-numeric: tabular-nums; }
#remainingTimeStat.timer-green .stat-value { color: #22c55e; }
#remainingTimeStat.timer-amber .stat-value { color: #f59e0b; }
#remainingTimeStat.timer-orange .stat-value { color: #f97316; }
#remainingTimeStat.timer-red .stat-value { color: #ef4444; animation: pulse-red 1s ease-in-out infinite; }
@keyframes pulse-red { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.balance-toast {
    background: #1e293b; color: #fff; padding: 12px 20px; border-radius: 10px;
    margin-bottom: 8px; font-size: 14px; font-family: 'Plus Jakarta Sans', sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); display: flex; align-items: center; gap: 10px;
    animation: slideInRight 0.3s ease-out; max-width: 320px; border-left: 4px solid #f59e0b;
}
.balance-toast.severity-amber { border-left-color: #f59e0b; }
.balance-toast.severity-orange { border-left-color: #f97316; }
.balance-toast.severity-red { border-left-color: #ef4444; }
.balance-toast.severity-exhausted { border-left-color: #dc2626; background: #7f1d1d; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.balance-exhausted-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 99999;
    display: flex; align-items: center; justify-content: center; flex-direction: column;
    color: #fff; font-family: 'Plus Jakarta Sans', sans-serif;
}
.balance-exhausted-overlay h2 { font-size: 24px; margin-bottom: 12px; color: #ef4444; }
.balance-exhausted-overlay p { font-size: 16px; color: #cbd5e1; max-width: 400px; text-align: center; }
.balance-exhausted-overlay .topup-btn {
    margin-top: 20px; padding: 12px 32px; background: #6366f1; color: #fff;
    border: none; border-radius: 8px; font-size: 16px; cursor: pointer; font-weight: 600;
}
.balance-exhausted-overlay .topup-btn:hover { background: #4f46e5; }


/* ============================================
   Phase 2: AI Session Summary Styles
   ============================================ */

.session-summary-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.summary-modal-content {
    background: var(--surface-secondary, #1e293b);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-primary, #334155);
    overflow: hidden;
}

.summary-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-primary, #334155);
}

.summary-modal-header h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.summary-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.summary-close-btn:hover {
    background: var(--surface-primary, #0f172a);
    color: var(--text-primary, #f1f5f9);
}

.summary-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    gap: 1rem;
}

.summary-loading p {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.875rem;
    margin: 0;
}

.summary-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-primary, #334155);
    border-top-color: var(--primary, #2563EB);
    border-radius: 50%;
    animation: summarySpinAnim 0.8s linear infinite;
}

@keyframes summarySpinAnim {
    to { transform: rotate(360deg); }
}

#summaryContent {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.summary-section {
    margin-bottom: 1.25rem;
}

.summary-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary, #2563EB);
    margin: 0 0 0.5rem 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
}

.summary-section p {
    color: var(--text-primary, #f1f5f9);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
}

.summary-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.summary-section ul li {
    color: var(--text-primary, #f1f5f9);
    font-size: 0.875rem;
    line-height: 1.6;
    padding: 0.25rem 0 0.25rem 1.25rem;
    position: relative;
}

.summary-section ul li::before {
    content: '\2022';
    color: var(--primary, #2563EB);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.summary-meta {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-primary, #334155);
}

.summary-error {
    padding: 1.5rem;
    text-align: center;
    color: #f87171;
    font-size: 0.875rem;
}

.summary-error button {
    margin-top: 0.75rem;
    padding: 0.5rem 1.25rem;
    background: var(--primary, #2563EB);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.summary-error button:hover {
    opacity: 0.9;
}

.summary-modal-footer {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-primary, #334155);
    flex-wrap: wrap;
}

.btn-summary-export {
    flex: 1;
    min-width: 100px;
    padding: 0.625rem 1rem;
    background: var(--surface-primary, #0f172a);
    color: var(--text-primary, #f1f5f9);
    border: 1px solid var(--border-primary, #334155);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.btn-summary-export:hover {
    background: var(--primary, #2563EB);
    border-color: var(--primary, #2563EB);
    color: #fff;
}

.summary-too-short {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-secondary, #94a3b8);
}

.summary-too-short svg {
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

@media (max-width: 640px) {
    .summary-modal-content {
        max-height: 95vh;
        border-radius: 12px;
    }
    .summary-modal-footer {
        flex-direction: column;
    }
    .btn-summary-export {
        min-width: unset;
    }
}


/* ===========================================
   Phase 3: Collaborative Notes Styles
   =========================================== */

#collabNotesContainer {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

#collabNotesList {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#collabNotesList:empty::before {
    content: 'No notes yet. Add a note below or highlight text in messages.';
    display: block;
    text-align: center;
    padding: 40px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    opacity: 0.6;
}

.collab-note {
    background: var(--surface-hover);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 10px 12px;
    position: relative;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.collab-note .note-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.collab-note .note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.note-author {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

.note-source-badge {
    background: #2563EB22;
    color: #2563EB;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 500;
    margin-left: 6px;
}

.collab-note .note-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.collab-note .note-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.collab-note .note-actions button:hover {
    background: var(--surface-primary);
    color: var(--text-primary);
}

.collab-note .note-actions button.note-delete-btn:hover {
    background: #ef444422;
    color: #ef4444;
}

.note-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-primary);
    align-items: flex-end;
}

.note-input-area textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    min-height: 38px;
    max-height: 100px;
}

.note-input-area textarea:focus {
    border-color: #2563EB;
}

.btn-add-note {
    background: #2563EB;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-add-note:hover {
    background: #1d4ed8;
}

.btn-add-note:disabled {
    background: #2563EB66;
    cursor: not-allowed;
}

/* Highlight flash animation for new notes */
.note-highlight {
    animation: noteHighlight 1.5s ease;
}

@keyframes noteHighlight {
    0% { background: #2563EB33; border-color: #2563EB; }
    100% { background: var(--surface-hover); border-color: var(--border-primary); }
}

/* Fade out animation for deleted notes */
.note-fade-out {
    animation: noteFadeOut 0.3s ease forwards;
}

@keyframes noteFadeOut {
    0% { opacity: 1; transform: translateX(0); max-height: 200px; }
    100% { opacity: 0; transform: translateX(20px); max-height: 0; padding: 0; margin: 0; border: 0; overflow: hidden; }
}

/* Inline edit mode */
.note-edit-mode .note-content {
    background: var(--surface-primary);
    border: 1px solid #2563EB;
    border-radius: 6px;
    padding: 6px 8px;
    outline: none;
}

/* Text selection tooltip for "Add to Notes" */
.text-selection-tooltip {
    position: fixed;
    z-index: 9999;
    background: #2563EB;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: opacity 0.15s;
    white-space: nowrap;
    pointer-events: auto;
}

.text-selection-tooltip:hover {
    background: #1d4ed8;
}
