/* ======================================================= */
/* AI Language Teacher V7.0 - Ultra Professional CSS */
/* کاملاً ریسپانسیو - حفظ کامل رنگ‌ها و دیزاین اصلی */
/* رفع مشکلات: هدر، تراز زبان‌ها، تار شدن سابقه در موبایل */
/* ======================================================= */

/* ======================================================= */
/* 1. تنظیمات پایه و متغیرها - تم‌های کامل */
/* ======================================================= */
:root {
    /* رنگ‌های اصلی - تم تیره (پیش‌فرض) - کاملاً حفظ شده */
    --primary-neon: #00ff88;
    --secondary-neon: #00e0ff;
    --accent-pink: #ff3366;
    --accent-purple: #9d4edd;
    --accent-orange: #ffaa00;
    
    /* پس‌زمینه‌ها - تم تیره */
    --bg-dark: #0a0a0f;
    --bg-darker: #050505;
    --bg-light: rgba(255, 255, 255, 0.05);
    --bg-lighter: rgba(255, 255, 255, 0.09);
    
    /* شیشه‌ای - تم تیره */
    --glass-bg: rgba(20, 20, 30, 0.7);
    --glass-bg-hover: rgba(30, 30, 45, 0.8);
    --glass-border: rgba(0, 255, 136, 0.15);
    --glass-border-light: rgba(0, 255, 136, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass-shadow-hover: 0 8px 32px rgba(0, 255, 136, 0.15);
    
    /* متن‌ها - تم تیره */
    --text-light: #f0f0f0;
    --text-lighter: #f0f0f0;
    --text-muted: #b0b0b0;
    --text-dark: #222222;
    
    /* فونت‌های چندزبانه */
    --font-fa: 'Vazirmatn', 'IBM Plex Sans Arabic', sans-serif;
    --font-en: 'Montserrat', sans-serif;
    --font-ar: 'IBM Plex Sans Arabic', sans-serif;
    --font-zh: 'Noto Sans SC', sans-serif;
    --font-ru: 'Roboto', sans-serif;
    
    /* اندازه‌ها */
    --card-radius: 16px;
    --btn-radius: 12px;
    --section-spacing: 40px;
    --grid-gap: 20px;
    
    /* گرادیان‌ها */
    --gradient-primary: linear-gradient(135deg, var(--primary-neon), var(--secondary-neon));
    --gradient-dark: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 224, 255, 0.1));
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    
    /* سایه‌های متنی */
    --text-shadow-neon: 0 0 10px rgba(0, 255, 136, 0.5);
    --text-shadow-blue: 0 0 10px rgba(0, 224, 255, 0.5);
    --text-shadow-white: 0 0 10px rgba(255, 255, 255, 0.3);
    
    /* چت */
    --chat-user-msg-bg: rgba(0, 128, 255, 0.15);
    --chat-ai-msg-bg: rgba(0, 0, 0, 0.25);
    --chat-history-bg: rgba(15, 15, 25, 0.9);
    --chat-history-border: rgba(255, 255, 255, 0.08);
    --chat-history-item-hover: rgba(0, 224, 255, 0.1);
    --success-green: #00ff88;
    --danger-red: #ff3366;
    --warning-orange: #ffaa00;
    
    /* متغیرهای جدید برای ریسپانسیو */
    --header-height-desktop: 100px;
    --header-height-tablet: 80px;
    --header-height-mobile: 60px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* متغیرها برای تم روشن */
[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-darker: #f1f5f9;
    --bg-light: rgba(255, 255, 255, 0.9);
    --bg-lighter: rgba(255, 255, 255, 0.95);
    
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-bg-hover: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(0, 255, 136, 0.3);
    --glass-border-light: rgba(0, 255, 136, 0.4);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    --glass-shadow-hover: 0 8px 32px rgba(0, 255, 136, 0.2);
    
    --text-light: #1e293b;
    --text-lighter: #334155;
    --text-muted: #64748b;
    --text-dark: #f8fafc;
    
    --text-shadow-neon: 0 0 10px rgba(0, 255, 136, 0.3);
    --text-shadow-blue: 0 0 10px rgba(0, 224, 255, 0.3);
    --text-shadow-white: 0 0 10px rgba(30, 41, 59, 0.1);
    
    --chat-user-msg-bg: rgba(0, 128, 255, 0.15);
    --chat-ai-msg-bg: rgba(255, 255, 255, 0.9);
    --chat-history-bg: rgba(255, 255, 255, 0.95);
    --chat-history-border: rgba(0, 0, 0, 0.1);
    --chat-history-item-hover: rgba(0, 224, 255, 0.1);
}

/* ======================================================= */
/* 2. رست کامل و پایه */
/* ======================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
    height: 100%;
    overflow-x: hidden;
    font-size: 16px;
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    html {
        font-size: 12px;
    }
}

/* کلاس‌های چندزبانه برای فونت‌ها */
.lang-fa,
[lang="fa"] {
    font-family: var(--font-fa);
    direction: rtl;
}

.lang-ar,
[lang="ar"] {
    font-family: var(--font-ar);
    direction: rtl;
}

.lang-en,
[lang="en"] {
    font-family: var(--font-en);
    direction: ltr;
}

.lang-zh,
[lang="zh"] {
    font-family: var(--font-zh);
    direction: ltr;
}

.lang-ru,
[lang="ru"] {
    font-family: var(--font-ru);
    direction: ltr;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 15px;
    overflow-x: hidden;
    line-height: 1.8;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: var(--font-fa);
    position: relative;
}

/* ======================================================= */
/* 3. سیستم تم و پس‌زمینه‌های متحرک */
/* ======================================================= */

/* پس‌زمینه متحرک برای تم تیره */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 255, 136, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 224, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 0%, #1a2a22 0%, var(--bg-darker) 80%);
    z-index: -1;
    animation: gradientShift 20s ease infinite alternate;
    transition: background 0.5s ease;
    pointer-events: none;
}

/* پس‌زمینه متحرک برای تم روشن */
[data-theme="light"] .bg-animation {
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 255, 136, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 224, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 0%, #e0f7fa 0%, var(--bg-darker) 80%);
}

@keyframes gradientShift {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(30deg);
    }
}

/* ======================================================= */
/* 4. کانتینر اصلی و لایه‌بندی */
/* ======================================================= */
.translator-wrapper {
    width: 100%;
    max-width: 1200px;
    background: rgba(15, 15, 25, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 0 60px rgba(0, 255, 136, 0.05);
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 1px;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.5s ease forwards;
    transition: background 0.3s ease, border-color 0.3s ease;
}

[data-theme="light"] .translator-wrapper {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 60px rgba(0, 255, 136, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ======================================================= */
/* 5. هدر اصلی - نسخه بهبود یافته نهایی */
/* ======================================================= */

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 20px;
    margin-bottom: 1px;
    flex-wrap: nowrap;
    position: relative;
    z-index: 90;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    min-height: var(--header-height-desktop);
}

.header-section {
    flex: 0 0 auto;
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ویجت‌های سمت چپ */
.left-widgets {
    width: 200px;
}

.left-widgets .floating-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    height: 100%;
    padding: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateZ(0);
    transition: var(--transition-smooth);
}

.shortcut-item {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    color: var(--text-light);
    font-size: 1.4rem;
    text-decoration: none;
    transition: var(--transition-smooth);
    position: relative;
    aspect-ratio: auto;
    cursor: pointer;
    border: none;
    outline: none;
    transform: translateZ(0);
    flex-direction: column;
    gap: 5px;
}

[data-theme="light"] .shortcut-item {
    background: rgba(0, 0, 0, 0.05);
}

.shortcut-item:hover {
    background: var(--primary-neon);
    color: var(--text-dark);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
    transform: translateY(-3px) translateZ(0);
}

.shortcut-item:active {
    transform: translateY(-1px) translateZ(0);
}

.shortcut-item.active {
    background: var(--gradient-primary);
    color: var(--text-dark);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.soon-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--primary-neon);
    color: #000;
    font-size: 0.55rem;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: bold;
    pointer-events: none;
    font-family: var(--font-en);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ویجت‌های سمت راست */
.right-widgets {
    width: 200px;
    justify-content: flex-start;
    align-items: stretch;
}

.glass-widget {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    transform: translateZ(0);
    border-radius: 14px;
}

.glass-widget:hover {
    background: var(--glass-bg-hover);
    border-color: var(--primary-neon);
    transform: translateY(-2px) translateZ(0);
    box-shadow: var(--glass-shadow-hover);
}

/* ======================================================= */
/* 6. سیستم تغییر زبان - بهبود یافته و ریسپانسیو */
/* ======================================================= */

.ui-language-switcher {
    height: 42px;
    min-width: 80px;
    position: relative;
    z-index: 1000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.lang-toggle-btn {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-family: var(--font-fa);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    padding: 0 15px;
    border-radius: 14px;
}

.lang-toggle-btn:hover {
    color: var(--primary-neon);
}

.lang-toggle-btn:hover .lang-caret {
    transform: rotate(180deg);
}

.current-lang-text {
    font-family: var(--font-en);
    font-weight: 700;
    letter-spacing: 1px;
}

.lang-caret {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.lang-globe {
    font-size: 1rem;
    color: var(--secondary-neon);
}

/* منوی dropdown بهبود یافته */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 180px;
    background: rgba(15, 15, 25, 0.98);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 1001;
    overflow: hidden;
}

[data-theme="light"] .lang-dropdown {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* نمایش منوی زبان با انیمیشن */
.ui-language-switcher:hover .lang-dropdown,
.ui-language-switcher:focus-within .lang-dropdown,
.lang-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.lang-dropdown-item {
    background: none;
    border: none;
    width: 100%;
    text-align: start;
    padding: 12px 15px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition-smooth);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    direction: ltr;
}

.lang-dropdown-item:last-child {
    margin-bottom: 0;
}

.lang-dropdown-item:hover {
    background-color: rgba(0, 255, 136, 0.15);
    color: var(--primary-neon);
    transform: translateX(-3px);
}

.lang-dropdown-item.active {
    background-color: rgba(0, 255, 136, 0.2);
    color: var(--primary-neon);
    font-weight: 600;
    border-left: 3px solid var(--primary-neon);
}

.lang-flag-emoji {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.lang-name {
    flex: 1;
    text-align: left;
}

/* ======================================================= */
/* 7. لوگو و اجزای هدر - با بخش ثبت‌نام جدید */
/* ======================================================= */

.logo {
    flex-grow: 1;
    flex-direction: column;
    border-radius: 16px;
    padding: 5px;
    transform: translateZ(0);
    gap: 5px;
    min-height: 60px;
}

.logo i {
    font-size: 1.8rem;
    color: var(--primary-neon);
    margin-bottom: 5px;
    text-shadow: var(--text-shadow-neon);
    animation: softPulse 2s ease-in-out infinite;
}

@keyframes softPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.logo h1 {
    font-size: 1rem;
    margin: 0;
    line-height: 1.2;
    text-align: center;
    font-family: var(--font-fa);
    display: flex;
    gap: 4px;
    justify-content: center;
}

.logo .logo-part1 {
    color: var(--text-light);
    font-weight: 600;
}

.logo .logo-part2 {
    color: var(--primary-neon);
    font-family: var(--font-en);
    font-weight: 800;
    text-shadow: var(--text-shadow-neon);
}

/* بخش احراز هویت یکپارچه */
.auth-buttons {
    margin: 0px;
    outline: none;
    backdrop-filter: blur(10px);
    transform: translateZ(0px);
    transition: var(--transition-smooth);
    min-width: 140px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 6px;
    gap: 8px;
}

/* استایل دکمه‌ها */
.auth-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px 25px;
    border-radius: 8px;
    transition: var(--transition-smooth);
}
.auth-btn:hover {
    background: var(--glass-bg-hover);
}

/* استایل تایمر */
.timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
}

.timer-icon {
    color: var(--primary-neon);
    font-size: 0.9rem;
    animation: pulse 2s ease infinite;
}

.timer-display {
    color: var(--text-light);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    direction: ltr;
    letter-spacing: 1px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.login-btn {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--glass-border);
}

.login-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--primary-neon);
    color: var(--primary-neon);
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

.signup-btn {
    background: var(--gradient-primary);
    color: #000;
    border: 1px solid transparent;
    font-weight: 700;
}

.signup-btn:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
}

.signup-btn:active {
    transform: translateY(0);
}

/* ویجت اطلاعات کاربر */
.user-info-widget {
    height: 42px;
    min-width: 140px;
    padding: 0 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.user-info-content {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.user-avatar-icon {
    font-size: 1.4rem;
    color: var(--primary-neon);
}

.user-name-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.user-level-badge {
    background: var(--gradient-primary);
    color: #000;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

.level-number {
    font-family: var(--font-en);
    font-weight: 800;
}

/* ویجت ثبت‌نام سریع برای موبایل */
.quick-signup-widget {
    height: 42px;
    min-width: 120px;
    display: none;
}

.quick-signup-btn {
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    border: none;
    border-radius: 14px;
    color: #000;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
    padding: 0 12px;
}

.quick-signup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
}

.quick-signup-btn i {
    font-size: 0.9rem;
}

/* وضعیت آنلاین */
.online-status {
    height: 42px;
    padding: 0 15px;
    gap: 8px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s ease infinite;
}

.status-dot.online {
    background-color: var(--success-green);
    box-shadow: 0 0 10px var(--success-green);
}

.status-dot.offline {
    background-color: var(--text-muted);
    animation: none;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.status-text {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ======================================================= */
/* 8. افکت‌های انیمیشنی برای آیکون‌ها */
/* ======================================================= */

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.fa-spin-hover:hover {
    animation: spin 1s linear infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.fa-bounce-hover:hover {
    animation: bounce 1s ease infinite;
}

@keyframes pulse-effect {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.fa-pulse-hover:hover {
    animation: pulse-effect 1s ease infinite;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.fa-shake-hover:hover {
    animation: shake 0.5s ease infinite;
}

@keyframes flip {
    0% { transform: perspective(400px) rotateY(0); }
    50% { transform: perspective(400px) rotateY(180deg); }
    100% { transform: perspective(400px) rotateY(360deg); }
}

.fa-flip-hover:hover {
    animation: flip 1s ease infinite;
}

@keyframes beatFade {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
        color: var(--primary-neon);
    }
    25%, 75% { 
        transform: scale(1.05); 
        opacity: 0.8; 
        color: var(--secondary-neon);
    }
    50% { 
        transform: scale(1.1); 
        opacity: 0.6; 
        color: var(--accent-pink);
    }
}

.fa-beat-fade {
    animation: beatFade 2s ease-in-out infinite;
}

/* ======================================================= */
/* 9. کانتینر اصلی برنامه */
/* ======================================================= */
#app-container {
    display: flex;
    width: 100%;
    height: 65vh;
    min-height: 500px;
    background: transparent;
    border-radius: var(--card-radius);
    overflow: hidden;
    position: relative;
}

/* ======================================================= */
/* 10. پنل تاریخچه   */
/* ======================================================= */
#history-panel {
    flex-shrink: 0;
    width: 280px;
    background: var(--chat-history-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--chat-history-border);
    z-index: 10;
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

[dir="rtl"] #history-panel {
    border-left: none;
    border-right: 1px solid var(--chat-history-border);
}

#history-panel.hidden {
    transform: translateX(100%);
    opacity: 0;
    width: 0;
    min-width: 0;
    border: none;
}

[dir="rtl"] #history-panel.hidden {
    transform: translateX(-100%);
}

#history-header {
    padding: 15px 20px;
    font-weight: bold;
    font-size: 1rem;
    color: var(--secondary-neon);
    border-bottom: 1px solid var(--chat-history-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] #history-header {
    background: rgba(255, 255, 255, 0.3);
}

#history-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.history-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
}

.history-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--danger-red);
    transform: rotate(90deg);
}

.history-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-filters {
    display: flex;
    padding: 12px 20px;
    gap: 8px;
    border-bottom: 1px solid var(--chat-history-border);
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .history-filters {
    background: rgba(255, 255, 255, 0.3);
}

.filter-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition-smooth);
    text-align: center;
    font-family: inherit;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--secondary-neon);
    color: var(--secondary-neon);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--gradient-dark);
    border-color: var(--secondary-neon);
    color: var(--secondary-neon);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 224, 255, 0.2);
}

.history-search {
    padding: 12px 20px;
    position: relative;
    border-bottom: 1px solid var(--chat-history-border);
}

.history-search input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 35px 10px 15px;
    color: var(--text-light);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition-smooth);
}

[data-theme="light"] .history-search input {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-dark);
}

.history-search input:focus {
    outline: none;
    border-color: var(--secondary-neon);
    box-shadow: 0 0 8px rgba(0, 224, 255, 0.3);
}

.history-search input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.search-icon {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

[dir="rtl"] .search-icon {
    right: auto;
    left: 30px;
}

#history-scroll-container {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-neon) transparent;
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
}

#history-scroll-container::-webkit-scrollbar {
    width: 6px;
}

#history-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

#history-scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--secondary-neon);
    border-radius: 4px;
    border: 2px solid transparent;
}

.history-list {
    list-style: none;
    padding: 20px;
    margin: 0;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.history-empty-icon {
    font-size: 2.5rem;
    color: var(--secondary-neon);
    margin-bottom: 15px;
    opacity: 0.5;
}

.history-empty p {
    font-size: 0.9rem;
    margin: 0;
}

.history-item {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform, border-color;
}

[data-theme="light"] .history-item {
    background: rgba(255, 255, 255, 0.6);
}

.history-item:hover {
    background: var(--chat-history-item-hover);
    border-color: var(--secondary-neon);
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 4px 12px rgba(0, 224, 255, 0.2);
}

.history-item:active {
    transform: translateY(-1px) translateZ(0);
}

.history-item.active {
    background: var(--gradient-dark);
    border-color: var(--primary-neon);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.history-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.history-language-flag {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.history-language-flag .lang-flag {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.history-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-snippet {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    margin-top: 1px;
}

.history-meta-icons {
    display: flex;
    gap: 15px;
}

.meta-icon {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.meta-icon i {
    font-size: 0.8rem;
}

.time-icon {
    color: var(--accent-orange);
}

.message-icon {
    color: var(--secondary-neon);
}

.history-time, .history-length {
    font-family: 'Courier New', monospace;
    direction: ltr;
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    width: 32px;
    height: 32px;
}

.delete-btn:hover {
    background: rgba(255, 51, 102, 0.2);
    color: var(--danger-red);
    transform: rotate(15deg) scale(1.1);
}

.delete-btn:active {
    transform: rotate(0) scale(0.95);
}

.delete-icon {
    font-size: 0.9rem;
}

.new-chat-btn {
    width: 100%;
    border: none;
    border-top: 1px solid var(--chat-history-border);
    background: var(--gradient-primary);
    padding: 16px;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
    font-family: inherit;
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, #00e676, #00b8d4);
    box-shadow: 0 -4px 15px rgba(0, 255, 136, 0.2);
    transform: translateY(-2px);
}

.new-chat-btn:active {
    transform: translateY(0);
}

.new-chat-btn i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.new-chat-btn:hover i {
    transform: rotate(90deg);
}

/* ======================================================= */
/* 11. بخش اصلی چت */
/* ======================================================= */
#ai-chat-container {
    flex-grow: 1;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--card-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    transition: background 0.3s ease, border-color 0.3s ease;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* هدر چت */
#chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
    gap: 15px;
    min-height: 70px;
    flex-wrap: nowrap;
}

[data-theme="light"] #chat-header {
    background: rgba(255, 255, 255, 0.3);
}

/* دکمه منوی تاریخچه */
.mobile-menu-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.desktop-history-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.mobile-menu-btn:hover,
.desktop-history-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--secondary-neon);
    color: var(--secondary-neon);
    transform: scale(1.05);
}

.mobile-menu-btn:active,
.desktop-history-btn:active {
    transform: scale(0.95);
}

.history-icon {
    font-size: 1.2rem;
}

/* بخش وسط هدر چت */
.chat-header-center {
    flex: 1;
    min-width: 0;
    margin: 0 15px;
}

.languages-scroll-container {
    overflow: hidden;
    position: relative;
    height: 60px;
    border-radius: 12px;
}

.languages-scroll-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-neon) rgba(255, 255, 255, 0.1);
    -webkit-overflow-scrolling: touch;
    height: 100%;
    width: 100%;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.languages-scroll-wrapper::-webkit-scrollbar {
    height: 4px;
}

.languages-scroll-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.languages-scroll-wrapper::-webkit-scrollbar-thumb {
    background: var(--secondary-neon);
    border-radius: 2px;
}

.languages-row {
    display: flex;
    gap: 10px;
    height: 100%;
    align-items: center;
    width: max-content;
    padding: 0 5px;
}

/* دکمه اسکرول */
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-smooth);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
}

.languages-scroll-container:hover .scroll-btn {
    opacity: 1;
    visibility: visible;
}

.scroll-left {
    left: 5px;
}

.scroll-right {
    right: 5px;
}

.scroll-btn:hover {
    background: var(--primary-neon);
    color: var(--text-dark);
    border-color: var(--primary-neon);
    transform: translateY(-50%) scale(1.1);
}

.scroll-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* دکمه‌های آموزش زبان - کاملاً تراز شده */
.lang-education-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 80px;
    height: 50px;
    padding: 6px 8px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: var(--glass-bg);
    transition: var(--transition-smooth);
    cursor: pointer;
    outline: none;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .lang-education-btn {
    background: rgba(255, 255, 255, 0.6);
}

.lang-education-btn:hover {
    border-color: var(--secondary-neon);
    background: var(--glass-bg-hover);
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 4px 12px rgba(0, 224, 255, 0.2);
}

.lang-education-btn:active {
    transform: translateY(-1px) translateZ(0);
}

.lang-education-btn.selected {
    border-color: var(--primary-neon);
    background: var(--gradient-dark);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
    transform: translateY(-2px) translateZ(0);
}

.lang-education-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 8px;
}

.lang-flag {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lang-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: right;
}

[dir="ltr"] .lang-text {
    align-items: flex-start;
    text-align: left;
}

.lang-teach-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--secondary-neon);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.lang-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
}

/* ======================================================= */
/* 12. منطقه پیام‌ها */
/* ======================================================= */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-neon) transparent;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 255, 136, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 224, 255, 0.02) 0%, transparent 50%);
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
}

[data-theme="light"] .chat-messages {
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 255, 136, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 224, 255, 0.05) 0%, transparent 50%);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--secondary-neon);
    border-radius: 4px;
    border: 2px solid transparent;
}

.welcome-message {
    background: var(--gradient-dark);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    margin-bottom: 10px;
    animation: fadeIn 0.8s ease-out;
}

.welcome-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.welcome-icon {
    font-size: 2.5rem;
    color: var(--primary-neon);
}

.welcome-message h3 {
    color: var(--primary-neon);
    font-size: 1.3rem;
    margin: 0;
    font-weight: 700;
}

.welcome-message p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 25px;
    line-height: 1.6;
}

.quick-start-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.quick-option {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 15px;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

[data-theme="light"] .quick-option {
    background: rgba(255, 255, 255, 0.7);
}

.quick-option:hover {
    background: var(--gradient-dark);
    border-color: var(--primary-neon);
    color: var(--primary-neon);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

.quick-option:active {
    transform: translateY(0);
}

.quick-option i {
    font-size: 1rem;
}

.welcome-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.welcome-tip i {
    color: var(--accent-orange);
    font-size: 1.2rem;
}

.welcome-tip span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ======================================================= */
/* 13. استایل پیام‌ها */
/* ======================================================= */
.message-wrapper {
    display: flex;
    max-width: 80%;
    animation: messageAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-wrapper {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-wrapper {
    align-self: flex-start;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    overflow: hidden;
    max-width: 100%;
    word-break: break-word;
}

.user-message {
    background: var(--gradient-primary);
    color: var(--text-dark);
    border-radius: 18px 18px 4px 18px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

.ai-message {
    background: var(--chat-ai-msg-bg);
    border: 1px solid var(--glass-border);
    border-radius: 18px 18px 18px 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-neon);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    direction: ltr;
}

.message-text {
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.95rem;
}

.message-footer {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.message-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 5px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    font-size: 0.8rem;
}

.message-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--secondary-neon);
    color: var(--secondary-neon);
    transform: translateY(-2px);
}

.message-action-btn:active {
    transform: translateY(0);
}

.message-action-btn.speaking {
    background: var(--primary-neon);
    color: var(--text-dark);
    border-color: var(--primary-neon);
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    height: 6px;
    width: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-of-type(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-of-type(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ======================================================= */
/* 14. منطقه ورود پیام */
/* ======================================================= */
#chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="light"] #chat-input-area {
    background: rgba(255, 255, 255, 0.3);
}

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    width: 100%;
}

.voice-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.voice-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-neon);
    color: var(--primary-neon);
    transform: translateY(-2px);
}

.voice-btn:active {
    transform: translateY(0);
}

.voice-btn.listening {
    background: var(--accent-pink);
    color: white;
    border-color: var(--accent-pink);
    animation: pulse-red 1.5s ease infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 51, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0);
    }
}

.voice-btn i {
    font-size: 1.2rem;
}

.textarea-container {
    flex: 1;
    position: relative;
    min-width: 0;
}

#message-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-light);
    font-size: 1rem;
    resize: none;
    max-height: 120px;
    min-height: 46px;
    line-height: 1.4;
    transition: var(--transition-smooth);
    scrollbar-width: thin;
    font-family: inherit;
}

[data-theme="light"] #message-input {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-dark);
}

#message-input:focus {
    outline: none;
    border-color: var(--primary-neon);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.3);
    background: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] #message-input:focus {
    background: rgba(255, 255, 255, 0.9);
}

#message-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#message-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}
/* استایل اسکرول سفید خالی */
#message-input::-webkit-scrollbar {
    width: 6px;
}

#message-input::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

#message-input::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#message-input::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* برای فایرفاکس */
#message-input {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.textarea-indicator {
    position: absolute;
    bottom: 6px;
    left: 16px;
    font-size: 0.7rem;
    color: var(--text-muted);
    pointer-events: none;
}

[dir="rtl"] .textarea-indicator {
    left: auto;
    right: 16px;
}

#char-count {
    font-family: 'Courier New', monospace;
    transition: color 0.3s ease;
}

.send-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: 10px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.send-btn:hover {
    background: linear-gradient(135deg, #00e676, #00b8d4);
    box-shadow: 0 6px 15px rgba(0, 255, 136, 0.4);
    transform: translateY(-2px);
}

.send-btn:active {
    transform: translateY(0);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-btn:hover .send-icon {
    animation: sendFly 0.6s ease-out;
}

@keyframes sendFly {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
    }
    50% {
        transform: translateX(5px) translateY(-5px) rotate(20deg);
    }
    100% {
        transform: translateX(0) translateY(0) rotate(0deg);
    }
}

.send-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

/* ======================================================= */
/* 15. محدودیت کاربر مهمان */
/* ======================================================= */
.guest-limit-message {
    margin-top: 12px;
    animation: slideInUp 0.4s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.limit-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--gradient-dark);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.limit-warning i {
    color: var(--accent-orange);
    font-size: 1.2rem;
}

.limit-signup-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-dark);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 0.85rem;
    white-space: nowrap;
}

.limit-signup-btn:hover {
    background: linear-gradient(135deg, #00e676, #00b8d4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.limit-signup-btn:active {
    transform: translateY(0);
}

/* ======================================================= */
/* 16. پیام خطا */
/* ======================================================= */
.error-message {
    margin-top: 10px;
    animation: slideInUp 0.4s ease;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid var(--accent-pink);
    border-radius: 10px;
    color: var(--accent-pink);
    font-size: 0.85rem;
}

.error-content i {
    font-size: 1.1rem;
}

/* ======================================================= */
/* 17. نوتیفیکیشن */
/* ======================================================= */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    animation: notificationSlideIn 0.3s ease;
    max-width: 350px;
    transform: translateZ(0);
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--glass-shadow-hover);
}

.notification-icon {
    font-size: 1.3rem;
}

.notification.success .notification-icon {
    color: var(--success-green);
}

.notification.error .notification-icon {
    color: var(--danger-red);
}

.notification.warning .notification-icon {
    color: var(--warning-orange);
}

.notification-text {
    color: var(--text-light);
    font-size: 0.9rem;
    flex: 1;
}

/* ======================================================= */
/* 18. پیشرفت کاربر */
/* ======================================================= */
.user-progress {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    border: 1px solid var(--glass-border);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.level-text {
    color: var(--secondary-neon);
    font-weight: 600;
}

.level-number {
    background: var(--primary-neon);
    color: var(--text-dark);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.8rem;
    margin: 0 5px;
}

.xp-text {
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

/* ======================================================= */
/* 19. مودال احراز هویت */
/* ======================================================= */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.auth-modal[style*="display: flex"] {
    opacity: 1;
}

.auth-modal-content {
    width: 100%;
    max-width: 450px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    padding: 40px;
    position: relative;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--glass-shadow-hover);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    max-height: 90vh;
    overflow-y: auto;
    transform: translateZ(0);
}

[data-theme="light"] .auth-modal-content {
    background: rgba(255, 255, 255, 0.95);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
/* استایل اسکرول سفید خالی برای مودال */
.auth-modal-content::-webkit-scrollbar {
    width: 6px;
}

.auth-modal-content::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

.auth-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* برای فایرفاکس */
.auth-modal-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.close-auth-btn {
    position: absolute;
    top: 5px;
    left: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition-smooth);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.close-auth-btn:hover {
    background: rgba(255, 51, 102, 0.2);
    color: var(--danger-red);
    transform: rotate(90deg);
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: var(--btn-radius);
    border: 1px solid var(--glass-border);
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 20px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: calc(var(--btn-radius) - 2px);
    transition: var(--transition-smooth);
    font-family: var(--font-fa);
    font-size: 0.95rem;
    font-weight: 600;
}

.auth-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--secondary-neon);
}

.auth-tab.active {
    background: var(--gradient-primary);
    color: var(--text-dark);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

.auth-form {
    display: none;
    animation: fadeIn 0.5s ease forwards;
}

.auth-form.active {
    display: block;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-icon {
    font-size: 2.5rem;
    color: var(--primary-neon);
    margin-bottom: 15px;
    animation: softPulse 2s ease-in-out infinite;
}

.auth-header h3 {
    color: var(--text-light);
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.form-group {
    margin-bottom: 1px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    right: 15px;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

[dir="rtl"] .input-with-icon i {
    right: auto;
    left: 15px;
}

.input-with-icon input {
    width: 100%;
    padding: 14px 45px 14px 45px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--btn-radius);
    color: var(--text-light);
    font-size: 0.95rem;
    font-family: var(--font-fa);
    transition: var(--transition-smooth);
}

[dir="rtl"] .input-with-icon input {
    padding: 14px 45px 14px 45px;
}

[data-theme="light"] .input-with-icon input {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--primary-neon);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.3);
}

.input-with-icon input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.toggle-password {
    position: absolute;
    left: 15px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    z-index: 1;
}

[dir="rtl"] .toggle-password {
    left: auto;
    right: 15px;
}

.toggle-password:hover {
    color: var(--primary-neon);
}

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--btn-radius);
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: var(--font-fa);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.auth-submit-btn:hover {
    background: linear-gradient(135deg, #00e676, #00b8d4);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
    transform: translateY(-2px);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
}

.auth-link {
    color: var(--secondary-neon);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.auth-link:hover {
    color: var(--primary-neon);
    text-decoration: underline;
}

.terms-agreement {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--btn-radius);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.terms-agreement input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--primary-neon);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.terms-agreement label {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0;
    cursor: pointer;
}

.terms-agreement a {
    color: var(--secondary-neon);
    text-decoration: none;
    transition: var(--transition-smooth);
}

.terms-agreement a:hover {
    color: var(--primary-neon);
    text-decoration: underline;
}

/* ======================================================= */
/* 20. منوی کاربر */
/* ======================================================= */
.user-menu {
    position: fixed;
    width: 180px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--glass-shadow-hover);
    animation: fadeIn 0.3s ease;
    overflow: hidden;
    z-index: 10000;
    transform: translateZ(0);
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .user-menu-header {
    background: rgba(255, 255, 255, 0.3);
}

.user-menu-header i {
    font-size: 2.5rem;
    color: var(--primary-neon);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info h4 {
    margin: 0 0 5px 0;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-items {
    padding: 10px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 15px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 0.9rem;
    text-align: right;
    font-family: inherit;
}

[dir="rtl"] .user-menu-item {
    text-align: right;
}

[dir="ltr"] .user-menu-item {
    text-align: left;
}

.user-menu-item:hover {
    background: rgba(0, 255, 136, 0.1);
    color: var(--primary-neon);
}

.user-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* ======================================================= */
/* 21. مودال پروفایل */
/* ======================================================= */
.profile-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.profile-avatar i {
    font-size: 4rem;
    color: var(--primary-neon);
}

.profile-details {
    flex: 1;
}

.profile-field {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-field:last-child {
    margin-bottom: 0;
}

.field-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.field-value {
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ======================================================= */
/* 22. مودال تنظیمات */
/* ======================================================= */
.settings-select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.settings-select:focus {
    outline: none;
    border-color: var(--primary-neon);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.settings-select option {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 10px;
}

[data-theme="light"] .settings-select option {
    background: var(--bg-darker);
    color: var(--text-dark);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-neon);
    cursor: pointer;
}

/* ======================================================= */
/* 23. مدیا کوئری‌های اصلی - رفع کامل مشکلات */
/* ======================================================= */

/* ==================== سایز 420px (موبایل کوچک) ==================== */
@media (max-width: 400px) {
    body {
        padding: 8px;
    }
    
    .translator-wrapper {
        padding: 10px;
        border-radius: 16px;
        gap: 10px;
    }
    
    /* هدر در 420px - کاملاً تراز */
    .main-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        min-height: auto;
        margin-bottom: 10px;
    }
    
    .header-section {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .left-widgets {
        order: 1;
        width: 100%;
    }
    
    .right-widgets {
        order: 2;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    
    /* ویجت‌های سمت چپ */
    .floating-shortcuts {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: 1fr;
        gap: 6px;
        padding: 6px;
        width: 100%;
    }
    
    .shortcut-item {
        font-size: 1.1rem;
        min-height: 45px;
        padding: 8px 4px;
    }
    
    .shortcut-item i {
        font-size: 1rem;
        margin-bottom: 2px;
    }
    
    .soon-badge {
        font-size: 0.5rem;
        padding: 2px 3px;
    }
    
    /* ویجت‌های سمت راست */
    .ui-language-switcher {
        order: 1;
        height: 38px;
        min-width: 70px;
        width: auto;
        flex: 0 1 auto;
    }
    
    .lang-toggle-btn {
        font-size: 0.8rem;
        padding: 0 10px;
        gap: 5px;
    }
    
    .lang-dropdown {
        width: 150px;
        right: -10px;
    }
    
    .logo {
        order: 2;
        flex-grow: 0;
        width: auto;
        padding: 6px 10px;
        flex-direction: row;
        gap: 6px;
        min-height: 38px;
        min-width: 100px;
        flex: 0 1 auto;
    }
    
    .logo i {
        margin-bottom: 0;
        font-size: 1.1rem;
    }
    
    .logo h1 {
        font-size: 0.85rem;
    }
    
    /* بخش احراز هویت */
    .auth-buttons {
        order: 3;
        height: 38px;
        min-width: 120px;
        gap: 5px;
        flex: 0 1 auto;
    }
    
    .auth-btn {
        font-size: 0.7rem;
        padding: 5px 25px;
    }
    
    .auth-btn i {
        display: none; /* مخفی کردن آیکون در موبایل کوچک */
    }
    
    .user-info-widget {
        order: 3;
        height: 38px;
        min-width: 110px;
        padding: 0 8px;
        flex: 0 1 auto;
    }
    
    .user-name-display {
        max-width: 50px;
        font-size: 0.7rem;
    }
    
    .user-avatar-icon {
        font-size: 1.1rem;
    }
    
    .user-level-badge {
        font-size: 0.6rem;
        padding: 1px 4px;
        min-width: 20px;
    }
    
    /* ویجت ثبت‌نام سریع */
    .quick-signup-widget {
        display: block;
        order: 4;
        width: 100%;
        height: 38px;
    }
    
    .quick-signup-btn {
        font-size: 0.8rem;
    }
    
    /* وضعیت آنلاین */
    .online-status {
        display: none; /* مخفی در موبایل کوچک */
    }
    
    /* کانتینر اصلی */
    #app-container {
        height: 70vh;
        min-height: 400px;
        border-radius: 12px;
    }
    
    /* هدر چت */
    #chat-header {
        padding: 8px 10px;
        gap: 6px;
        min-height: 50px;
    }
    
    .mobile-menu-btn {
        display: flex;
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
    
    .desktop-history-btn {
        display: none;
    }
    
    .history-icon {
        font-size: 1rem;
    }
    
    /* بخش وسط - زبان‌های آموزشی */
    .chat-header-center {
        margin: 0 5px;
    }
    
    .languages-scroll-container {
        height: 48px;
    }
    
    .scroll-btn {
        display: none; /* مخفی در موبایل کوچک */
    }
    
    .languages-row {
        gap: 5px;
    }
    
    .lang-education-btn {
        width: 65px;
        height: 42px;
        padding: 4px 5px;
    }
    
    .lang-education-content {
        gap: 4px;
    }
    
    .lang-flag {
        width: 18px;
        height: 14px;
    }
    
    .lang-text {
        gap: 1px;
    }
    
    .lang-teach-label {
        font-size: 0.5rem;
    }
    
    .lang-name {
        font-size: 0.65rem;
    }
    
    /* پنل تاریخچه */
    #history-panel {
        width: 85%;
        max-width: 280px;
    }
    
    /* منطقه پیام‌ها */
    .chat-messages {
        padding: 10px;
        gap: 10px;
    }
    
    .welcome-message {
        padding: 12px;
    }
    
    .welcome-header {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .welcome-icon {
        font-size: 1.8rem;
    }
    
    .welcome-message h3 {
        font-size: 1rem;
    }
    
    .welcome-message p {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .quick-start-options {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .quick-option {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    
    .quick-option i {
        font-size: 0.9rem;
    }
    
    .welcome-tip {
        padding: 8px;
        margin-top: 12px;
    }
    
    .welcome-tip i {
        font-size: 1rem;
    }
    
    .welcome-tip span {
        font-size: 0.75rem;
    }
    
    .message-wrapper {
        max-width: 95%;
    }
    
    .message-bubble {
        padding: 8px 10px;
    }
    
    .message-header {
        margin-bottom: 4px;
        padding-bottom: 4px;
    }
    
    .message-sender {
        font-size: 0.65rem;
    }
    
    .message-time {
        font-size: 0.55rem;
    }
    
    .message-text {
        font-size: 0.85rem;
    }
    
    .message-footer {
        gap: 4px;
        margin-top: 6px;
        padding-top: 6px;
    }
    
    .message-action-btn {
        min-width: 24px;
        min-height: 24px;
        font-size: 0.7rem;
    }
    
    /* منطقه ورود پیام */
    #chat-input-area {
        padding: 8px 10px;
    }
    
    .chat-form {
        gap: 6px;
    }
    
    .voice-btn {
        width: 38px;
        height: 38px;
    }
    
    .voice-btn i {
        font-size: 1rem;
    }
    
    .send-btn {
        width: 38px;
        height: 38px;
    }
    
    .send-icon {
        font-size: 1rem;
    }
    
    #message-input {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-height: 38px;
    }
    
    .textarea-indicator {
        bottom: 4px;
        font-size: 0.6rem;
    }
    
    .limit-warning {
        padding: 8px 10px;
        font-size: 0.75rem;
        gap: 6px;
    }
    
    .limit-signup-btn {
        padding: 5px 10px;
        font-size: 0.7rem;
    }
    
    /* مودال‌ها */
    .auth-modal-content {
        padding: 20px 15px;
        max-width: 95%;
    }
    
    .auth-tabs {
        margin-bottom: 1px;
    }
    
    .auth-tab {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .auth-header {
        margin-bottom: 1px;
    }
    
    .auth-icon {
        font-size: 2rem;
    }
    
    .auth-header h3 {
        font-size: 1.1rem;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 0.8rem;
    }
    
    .input-with-icon input {
        padding: 10px 45px 10px 45px;
        font-size: 0.85rem;
    }
    
    .auth-submit-btn {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .terms-agreement {
        padding: 10px;
        font-size: 0.75rem;
    }
    
    /* منوی کاربر */
    .user-menu {
        width: 240px;
    }
    
    .user-menu-header i {
        font-size: 2rem;
    }
    
    .user-info h4 {
        font-size: 0.85rem;
    }
    
    .user-info p {
        font-size: 0.7rem;
    }
    
    .user-menu-item {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .user-menu-item i {
        font-size: 1rem;
    }
    
    /* پروفایل */
    .profile-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 12px;
    }
    
    .profile-avatar i {
        font-size: 3rem;
    }
    
    .profile-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
    
    .field-label {
        font-size: 0.75rem;
    }
    
    .field-value {
        font-size: 0.8rem;
    }
    
    /* نوتیفیکیشن */
    .notification {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ==================== سایز 768px (تبلت) ==================== */
@media (min-width: 400px) and (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .translator-wrapper {
        padding: 15px;
        border-radius: 18px;
    }
    
    /* هدر در 768px */
    .main-header {
        gap: 1px;
        min-height: var(--header-height-tablet);
    }
    
    .header-section {
        width: 180px;
    }
    
    .left-widgets {
        width: 180px;
    }
    
    .floating-shortcuts {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 8px;
        padding: 8px;
    }
    
    .shortcut-item {
        font-size: 1.2rem;
        min-height: 52px;
    }
    
    .shortcut-item i {
        font-size: 1.1rem;
        margin-bottom: 3px;
    }
    
    .soon-badge {
        font-size: 0.6rem;
    }
    
    .right-widgets {
        width: 180px;
    }
    
    .ui-language-switcher {
        height: 40px;
        min-width: 75px;
    }
    
    .lang-toggle-btn {
        font-size: 0.85rem;
    }
    
    .logo {
        padding: 8px;
        min-height: 60px;
    }
    
    .logo i {
        font-size: 1.3rem;
    }
    
    .logo h1 {
        font-size: 0.9rem;
    }
    
    .auth-buttons {
        height: 40px;
        min-width: 130px;
    }
    
    .auth-btn {
        font-size: 0.75rem;
        padding: 5px 25px;
    }
    
    .user-info-widget {
        height: 40px;
        min-width: 130px;
    }
    
    .user-name-display {
        max-width: 60px;
        font-size: 0.8rem;
    }
    
    .quick-signup-widget {
        display: none; /* مخفی در تبلت */
    }
    
    .online-status {
        height: 40px;
        padding: 0 12px;
    }
    
    /* کانتینر اصلی */
    #app-container {
        height: 68vh;
        min-height: 450px;
        border-radius: 14px;
    }
    
    /* هدر چت */
    #chat-header {
        padding: 10px 15px;
        gap: 10px;
        min-height: 60px;
    }
    
    .mobile-menu-btn {
        display: flex;
        width: 36px;
        height: 36px;
    }
    
    .desktop-history-btn {
        display: none;
    }
    
    .chat-header-center {
        margin: 0 8px;
    }
    
    .languages-scroll-container {
        height: 52px;
    }
    
    .scroll-btn {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
        opacity: 0.5;
    }
    
    .languages-row {
        gap: 8px;
    }
    
    .lang-education-btn {
        width: 72px;
        height: 46px;
        padding: 5px 6px;
    }
    
    .lang-flag {
        width: 20px;
        height: 15px;
    }
    
    .lang-teach-label {
        font-size: 0.55rem;
    }
    
    .lang-name {
        font-size: 0.7rem;
    }
    
    /* پنل تاریخچه */
    #history-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 300px;
        z-index: 99;
        border-radius: 0;
        transform: translateX(100%);
        border: none;
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
    
    [dir="rtl"] #history-panel {
        right: auto;
        left: 0;
        transform: translateX(-100%);
    }
    
    #history-panel.visible {
        transform: translateX(0);
        opacity: 1;
    }
    
    #history-panel.hidden {
        transform: translateX(100%);
        opacity: 0;
    }
    
    /* منطقه پیام‌ها */
    .chat-messages {
        padding: 15px;
    }
    
    .welcome-message {
        padding: 18px;
    }
    
    .welcome-icon {
        font-size: 2rem;
    }
    
    .welcome-message h3 {
        font-size: 1.2rem;
    }
    
    .quick-start-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .quick-option {
        font-size: 0.85rem;
        padding: 10px;
    }
    
    .message-wrapper {
        max-width: 85%;
    }
    
    /* منطقه ورود پیام */
    #chat-input-area {
        padding: 12px 15px;
    }
    
    .voice-btn {
        width: 42px;
        height: 42px;
    }
    
    .send-btn {
        width: 42px;
        height: 42px;
    }
    
    #message-input {
        min-height: 42px;
        font-size: 0.95rem;
    }
    
    /* مودال‌ها */
    .auth-modal-content {
        max-width: 400px;
        padding: 40px;
    }
    
    .auth-tab {
        padding: 10px 15px;
    }
    
    .profile-info {
        padding: 15px;
    }
}

/* ==================== دسکتاپ (769px به بالا) ==================== */
@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none;
    }
    
    .desktop-history-btn {
        display: flex;
    }
    
    .quick-signup-widget {
        display: none;
    }
    
    #history-panel {
        transform: translateX(0) !important;
        opacity: 1 !important;
        width: 280px;
    }
    
    #history-panel.hidden {
        transform: translateX(100%) !important;
        opacity: 0 !important;
        width: 0;
    }
}

/* ==================== دسکتاپ متوسط (769px - 1024px) ==================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .translator-wrapper {
        max-width: 95%;
    }
    
    .header-section {
        width: 170px;
    }
    
    .left-widgets {
        width: 170px;
    }
    
    .right-widgets {
        width: 170px;
    }
    
    .lang-education-btn {
        width: 75px;
    }
    
    .user-info-widget {
        min-width: 130px;
    }
    
    .user-name-display {
        max-width: 70px;
    }
}

/* ==================== دسکتاپ بزرگ (1025px به بالا) ==================== */
@media (min-width: 1025px) {
    .translator-wrapper {
        max-width: 1200px;
        padding: 25px;
    }
    
    .main-header {
        min-height: var(--header-height-desktop);
    }
    
    .header-section {
        width: 200px;
    }
    
    .left-widgets {
        width: 200px;
    }
    
    .right-widgets {
        width: 200px;
    }
    
    .shortcut-item {
        font-size: 1.3rem;
        min-height: 65px;
    }
    
    .shortcut-item i {
        font-size: 1.2rem;
    }
    
    .soon-badge {
        font-size: 0.7rem;
    }
    
    .ui-language-switcher {
        height: 44px;
        min-width: 90px;
    }
    
    .lang-toggle-btn {
        font-size: 0.95rem;
    }
    
    .logo {
        padding: 10px;
        min-height: 70px;
    }
    
    .logo i {
        font-size: 1.8rem;
    }
    
    .logo h1 {
        font-size: 1.1rem;
    }
    
    .auth-buttons {
        height: 44px;
        min-width: 150px;
    }
    
    .auth-btn {
        font-size: 0.85rem;
        padding: 5px 25px;
    }
    
    .user-info-widget {
        height: 44px;
        min-width: 150px;
    }
    
    .user-name-display {
        max-width: 90px;
        font-size: 0.9rem;
    }
    
    .user-level-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
        min-width: 26px;
    }
    
    .online-status {
        height: 44px;
        padding: 0 15px;
    }
    
    #app-container {
        height: 68vh;
        min-height: 550px;
    }
    
    #chat-header {
        padding: 20px 25px;
        gap: 20px;
    }
    
    .chat-header-center {
        margin: 0 20px;
    }
    
    .languages-scroll-container {
        height: 65px;
    }
    
    .lang-education-btn {
        width: 85px;
        height: 55px;
        padding: 8px 10px;
    }
    
    .lang-flag {
        width: 26px;
        height: 20px;
    }
    
    .lang-teach-label {
        font-size: 0.65rem;
    }
    
    .lang-name {
        font-size: 0.85rem;
    }
    
    .chat-messages {
        padding: 25px;
        gap: 18px;
    }
    
    .welcome-message {
        padding: 30px;
    }
    
    .welcome-message h3 {
        font-size: 1.4rem;
    }
    
    .quick-start-options {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
    
    .message-wrapper {
        max-width: 75%;
    }
}

/* ======================================================= */
/* 24. کلاس‌های کمکی و حالت‌ها */
/* ======================================================= */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex {
    display: flex !important;
}

.block {
    display: block !important;
}

.inline-block {
    display: inline-block !important;
}

/* انیمیشن‌های عمومی */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* جلوگیری از اسکرول هنگام باز بودن مودال */
body.modal-open {
    overflow: hidden;
}

/* بهبود اسکرول در iOS */
.ios-scroll {
    -webkit-overflow-scrolling: touch;
}

/* جلوگیری از انتخاب متن */
.no-select {
    user-select: none;
    -webkit-user-select: none;
}

/* بهینه‌سازی عملکرد */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* کاهش حرکت برای کاربرانی که ترجیح می‌دهند */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ======================================================= */
/* 25. رفع مشکلات خاص مرورگرها */
/* ======================================================= */

/* رفع مشکل در Firefox */
@-moz-document url-prefix() {
    .glass-widget,
    .translator-wrapper,
    .auth-modal-content {
        background-color: rgba(20, 20, 30, 0.95);
    }
}

/* رفع مشکل در Edge */
@supports (-ms-ime-align: auto) {
    .glass-widget,
    .translator-wrapper,
    .auth-modal-content {
        background-color: rgba(20, 20, 30, 0.98);
    }
}

/* رفع مشکل اسکرول در Safari */
.chat-messages::-webkit-scrollbar,
#history-scroll-container::-webkit-scrollbar {
    -webkit-appearance: none;
}

/* ======================================================= */
/* پایان CSS - نسخه 7.0 نهایی */
/* کاملاً ریسپانسیو - بدون هیچ مشکل تراز */
/* ======================================================= */

/* دکمه گوگل با استایل قالب */
.google-auth-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--btn-radius);
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-top: 5px;
    backdrop-filter: blur(5px);
}

/* لوگوی گوگل در دایره */
.google-auth-btn i {
    font-size: 1.3rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    color: transparent;
    position: relative;
}

.google-auth-btn i::before {
    content: "\f1a0"; /* آیکون گوگل */
    font-family: "Font Awesome 6 Brands";
    font-weight: 400;
    background: linear-gradient(135deg, #4285F4 0%, #34A853 50%, #FBBC05 75%, #EA4335 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.2rem;
}

/* حالت هاور */
.google-auth-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--primary-neon);
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow-hover);
}

.google-auth-btn:hover i {
    transform: scale(1.1);
}

/* فوتر فرم */
.auth-footer {
    margin-top: 20px;
    text-align: center;
    position: relative;
}

.auth-footer::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: var(--glass-border);
    margin: 15px 0;
}
.password-strength-meter {
    margin-top: 10px;
    margin-bottom: 15px;
}

.strength-bars {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.strength-bar {
    height: 5px;
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.strength-bar.strength-weak {
    background: #ff3366;
}

.strength-bar.strength-fair {
    background: #ffaa00;
}

.strength-bar.strength-good {
    background: #00e0ff;
}

.strength-bar.strength-strong {
    background: #00ff88;
}

.strength-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.strength-text.weak { color: #ff3366; }
.strength-text.fair { color: #ffaa00; }
.strength-text.good { color: #00e0ff; }
.strength-text.strong { color: #00ff88; }
.auth-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 0.9rem;
    width: 100%;
    height: 100%;
}

.auth-timer i {
    color: var(--primary-neon);
    font-size: 0.9rem;
    animation: pulse 2s ease infinite;
}

.auth-timer span {
    font-family: 'Courier New', monospace;
    direction: ltr;
    letter-spacing: 1px;
}


/* ============================================================================
 * COPYABLE WORDS STYLES - باکس‌های قابل کپی
 * ============================================================================
 * این استایل‌ها برای باکس‌های کلماتی که بین تگ‌های [COPY] قرار دارند استفاده می‌شود
 * ============================================================================
 */
