/* ============================================
   🎨 متغیرهای رنگی
   ============================================ */
:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-chat: #0d1130;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-bg-strong: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-1: #00d4ff;
    --accent-2: #00ff88;
    --accent-3: #7b2ff7;
    --gradient-1: linear-gradient(135deg, #00d4ff 0%, #00ff88 100%);
    --gradient-2: linear-gradient(135deg, #7b2ff7 0%, #00d4ff 100%);
    --message-sent: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 255, 136, 0.15));
    --message-received: rgba(255, 255, 255, 0.05);
    --input-bg: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.1);
    --danger: #ff4757;
}

[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-chat: #e8eef5;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-bg-strong: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --text-primary: #1a1f3a;
    --text-secondary: rgba(26, 31, 58, 0.7);
    --accent-1: #0099cc;
    --accent-2: #00cc6a;
    --accent-3: #5a1fb8;
    --message-sent: linear-gradient(135deg, rgba(0, 153, 204, 0.15), rgba(0, 204, 106, 0.1));
    --message-received: rgba(255, 255, 255, 0.9);
    --input-bg: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.08);
    --hover-bg: rgba(0, 0, 0, 0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(0, 212, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 255, 136, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(123, 47, 247, 0.08) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.app-container { display: flex; height: 100vh; width: 100%; overflow: hidden; }

/* ============================================
   📋 سایدبار
   ============================================ */
.sidebar {
    width: 340px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

.user-profile { display: flex; align-items: center; gap: 12px; }

.avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; color: white;
    flex-shrink: 0;
}

.avatar.large { width: 100px; height: 100px; font-size: 2.5rem; }

.user-info h3 { font-size: 1rem; font-weight: 600; }
.user-info .status { font-size: 0.8rem; color: var(--accent-2); }

.theme-toggle {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
}

.theme-toggle:hover { background: var(--hover-bg); border-color: var(--accent-1); }

[data-theme="light"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon,
:root:not([data-theme="light"]) .moon-icon { display: none; }

.search-box {
    position: relative;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-box svg {
    position: absolute;
    right: 32px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

.search-box input:focus { border-color: var(--accent-1); }
.search-box input::placeholder { color: var(--text-secondary); }

.chat-list { flex: 1; overflow-y: auto; padding: 10px; }
.chat-list::-webkit-scrollbar { width: 6px; }
.chat-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.chat-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: 14px;
    cursor: pointer; transition: all 0.2s;
    margin-bottom: 4px;
}

.chat-item:hover { background: var(--hover-bg); }
.chat-item.active { background: var(--glass-bg-strong); border: 1px solid var(--border-color); }

.chat-avatar { width: 50px; height: 50px; font-size: 1.2rem; }

.saved-avatar {
    background: var(--gradient-2);
}

.chat-info { flex: 1; min-width: 0; }

.chat-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 4px;
}

.chat-header h4 { font-size: 0.95rem; font-weight: 600; }
.chat-header .time, .saved-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--glass-bg);
    padding: 2px 8px;
    border-radius: 10px;
}

.last-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   💬 بخش اصلی چت
   ============================================ */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    position: relative;
}

.chat-header {
    display: flex; align-items: center; gap: 15px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.back-btn {
    display: none;
    background: none; border: none;
    color: var(--text-primary);
    cursor: pointer; padding: 8px;
    border-radius: 10px;
    transition: background 0.2s;
}

.back-btn:hover { background: var(--hover-bg); }

.chat-header-info {
    display: flex; align-items: center; gap: 12px;
    flex: 1;
}

.chat-header-info h3 { font-size: 1rem; font-weight: 600; }
.chat-header-info .status { font-size: 0.8rem; color: var(--accent-2); }

.chat-actions { display: flex; gap: 8px; }

.icon-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover { background: var(--hover-bg); border-color: var(--accent-1); }

.call-btn:hover {
    background: rgba(0, 255, 136, 0.15);
    border-color: var(--accent-2);
    color: var(--accent-2);
}

/* ============================================
   📨 پیام‌ها
   ============================================ */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.messages-container::-webkit-scrollbar { width: 6px; }
.messages-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.message {
    display: flex;
    animation: messageIn 0.3s ease;
    position: relative;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.sent { justify-content: flex-end; }
.message.received { justify-content: flex-start; }

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    cursor: context-menu;
}

.message.sent .message-content {
    background: var(--message-sent);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-bottom-right-radius: 4px;
}

.message.received .message-content {
    background: var(--message-received);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-content p { font-size: 0.95rem; line-height: 1.5; margin-bottom: 4px; }
.message-content img { max-width: 100%; border-radius: 12px; margin-bottom: 6px; display: block; }
.message-content audio { width: 240px; max-width: 100%; margin-bottom: 6px; border-radius: 20px; }

.message-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: block;
    text-align: left;
    margin-top: 4px;
}

.message.sent .message-time { text-align: right; }

/* استیکر در پیام */
.message.sticker .message-content {
    background: transparent !important;
    border: none !important;
    padding: 0;
}

.message.sticker .sticker-content {
    font-size: 6rem;
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.message.sticker .message-time {
    text-align: center;
    margin-top: 8px;
}

/* نشان ذخیره شده */
.saved-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 22px;
    height: 22px;
    background: var(--gradient-2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(123, 47, 247, 0.4);
}

.saved-badge svg { width: 12px; height: 12px; color: white; }

/* ============================================
    پیش‌نمایش فایل
   ============================================ */
.file-preview {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 12px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.preview-content {
    flex: 1;
    display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem;
}

.preview-content img {
    width: 50px; height: 50px;
    object-fit: cover;
    border-radius: 8px;
}

.cancel-preview {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}

.cancel-preview:hover { background: rgba(255, 0, 0, 0.2); border-color: #ff4444; }

/* ============================================
   😀 پنل استیکر
   ============================================ */
.sticker-panel {
    position: absolute;
    bottom: 70px;
    right: 20px;
    width: 320px;
    max-height: 300px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    z-index: 100;
    animation: slideUp 0.3s ease;
}

.sticker-panel.show { display: flex; }

.sticker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.sticker-header h4 { font-size: 1rem; }

.close-sticker {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}

.close-sticker:hover { background: var(--hover-bg); }

.sticker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 15px;
    overflow-y: auto;
    max-height: 240px;
}

.sticker-grid::-webkit-scrollbar { width: 4px; }
.sticker-grid::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

.sticker-item {
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    padding: 8px;
    border-radius: 12px;
    user-select: none;
}

.sticker-item:hover {
    background: var(--hover-bg);
    transform: scale(1.2);
}

/* ============================================
   ️ ناحیه ورودی
   ============================================ */
.input-area {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.attach-btn, .send-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attach-btn:hover { background: var(--hover-bg); border-color: var(--accent-1); transform: scale(1.05); }

.sticker-btn:hover {
    background: rgba(123, 47, 247, 0.15);
    border-color: var(--accent-3);
    color: var(--accent-3);
}

.send-btn {
    background: var(--gradient-1);
    border: none;
    color: white;
}

.send-btn:hover { transform: scale(1.1); box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.input-wrapper {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 8px 18px;
    transition: all 0.3s;
}

.input-wrapper:focus-within { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1); }

#messageInput {
    width: 100%;
    background: transparent;
    border: none; outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
}

#messageInput::placeholder { color: var(--text-secondary); }

.voice-btn.recording {
    background: #ff4444 !important;
    border-color: #ff4444 !important;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(255, 68, 68, 0); }
}

/* ============================================
   📞 مودال تماس صوتی
   ============================================ */
.call-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.call-modal.show { display: flex; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.call-content {
    text-align: center;
    color: white;
    max-width: 400px;
    width: 90%;
}

.call-avatar {
    position: relative;
    display: inline-block;
    margin-bottom: 30px;
}

.call-wave {
    position: absolute;
    inset: -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.call-modal.active .call-wave { opacity: 1; }

.call-wave span {
    display: block;
    width: 4px;
    height: 20px;
    background: var(--accent-2);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.call-wave span:nth-child(2) { animation-delay: 0.1s; }
.call-wave span:nth-child(3) { animation-delay: 0.2s; }
.call-wave span:nth-child(4) { animation-delay: 0.3s; }

@keyframes wave {
    0%, 100% { height: 10px; }
    50% { height: 40px; }
}

.call-content h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.call-status {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}

.call-timer {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-2);
    font-variant-numeric: tabular-nums;
    margin-bottom: 40px;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.call-control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.75rem;
    font-family: inherit;
}

.call-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.call-control-btn.active {
    background: var(--accent-1);
    border-color: var(--accent-1);
}

.call-control-btn.end-btn {
    background: #ff4444;
    border-color: #ff4444;
}

.call-control-btn.end-btn:hover {
    background: #ff3333;
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.5);
}

/* ============================================
   📋 منوی پیام
   ============================================ */
.message-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 8px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 500;
    display: none;
    min-width: 180px;
    animation: menuIn 0.2s ease;
}

@keyframes menuIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.message-menu.show { display: block; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.menu-item:hover { background: var(--hover-bg); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: rgba(255, 71, 87, 0.15); }

/* ============================================
   📱 ریسپانسیو
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        right: 0; top: 0; bottom: 0;
        width: 100%;
        z-index: 10;
        transform: translateX(0);
    }
    
    .sidebar.hidden { transform: translateX(100%); }
    
    .chat-main { width: 100%; }
    .back-btn { display: flex; }
    
    .message-content { max-width: 85%; }
    .message-content audio { width: 200px; }
    
    .sticker-panel {
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .sticker-grid { grid-template-columns: repeat(8, 1fr); }
    
    .call-controls { gap: 12px; }
    .call-control-btn { width: 60px; height: 60px; }
}

@media (max-width: 480px) {
    .chat-header { padding: 12px 15px; }
    .messages-container { padding: 15px; }
    .input-area { padding: 10px 12px; }
    .attach-btn, .send-btn { width: 40px; height: 40px; }
    .message.sticker .sticker-content { font-size: 4.5rem; }
}
/* ============================================
   🔐 Authentication Styles
   ============================================ */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 20px;
}

.auth-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--glass-shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-large {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}

.auth-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--gradient-1);
    border-color: transparent;
    color: white;
}

.auth-form .input-group {
    margin-bottom: 20px;
}

.auth-form input {
    width: 100%;
    padding: 14px 18px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.auth-form input:focus {
    border-color: var(--accent-1);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--gradient-1);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
}

.error-msg {
    margin-top: 15px;
    color: var(--danger);
    font-size: 0.9rem;
    text-align: center;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 40px);
    margin: 20px;
    padding: 12px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    border-radius: 12px;
    color: var(--danger);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
}

/* استایل لوگو */
.logo-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* ============================================
   📱 ریسپانسیو اصلاح شده برای موبایل
   ============================================ */

@media (max-width: 768px) {
    /* کانتینر اصلی */
    .app-container {
        height: 100vh;
        height: 100dvh; /* برای موبایل‌های جدید */
    }
    
    /* سایدبار در موبایل */
    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        z-index: 100;
        transform: translateX(0);
    }
    
    .sidebar.hidden {
        transform: translateX(100%);
    }
    
    /* بخش اصلی چت */
    .chat-main {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }
    
    /* هدر چت */
    .chat-header {
        padding: 12px 15px;
        flex-shrink: 0;
    }
    
    /* ناحیه پیام‌ها */
    .messages-container {
        flex: 1;
        overflow-y: auto;
        padding: 15px;
        min-height: 0; /* مهم برای موبایل */
    }
    
    /* پیش‌نمایش فایل */
    .file-preview {
        padding: 8px 15px;
        flex-shrink: 0;
    }
    
    /* پنل استیکر */
    .sticker-panel {
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 250px;
        bottom: 80px;
    }
    
    .sticker-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 5px;
        padding: 10px;
    }
    
    .sticker-item {
        font-size: 1.8rem;
        padding: 5px;
    }
    
    /* ناحیه ورودی */
    .input-area {
        padding: 10px 12px;
        gap: 8px;
        flex-shrink: 0;
        flex-wrap: wrap;
    }
    
    .attach-btn, .send-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .input-wrapper {
        flex: 1;
        min-width: 0;
        order: 3;
        width: calc(100% - 110px);
    }
    
    #messageInput {
        max-height: 80px;
        font-size: 16px; /* جلوگیری از زوم در آیفون */
    }
    
    /* پیام‌ها */
    .message-content {
        max-width: 85%;
        padding: 10px 12px;
    }
    
    .message-content img {
        max-width: 200px;
    }
    
    .message-content audio {
        width: 180px;
    }
    
    /* دکمه بازگشت */
    .back-btn {
        display: flex;
    }
    
    /* آواتار */
    .avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .chat-avatar {
        width: 45px;
        height: 45px;
    }
    
    /* مودال تماس */
    .call-content {
        width: 95%;
        padding: 30px 20px;
    }
    
    .call-avatar .avatar.large {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .call-controls {
        gap: 10px;
    }
    
    .call-control-btn {
        width: 60px;
        height: 60px;
        font-size: 0.7rem;
    }
    
    .call-control-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* برای گوشی‌های خیلی کوچک */
@media (max-width: 480px) {
    .chat-header h3 {
        font-size: 0.95rem;
    }
    
    .chat-header-info .status {
        font-size: 0.75rem;
    }
    
    .message-content {
        max-width: 90%;
        font-size: 0.9rem;
    }
    
    .message-content img {
        max-width: 180px;
    }
    
    .sticker-item {
        font-size: 1.5rem;
    }
    
    .input-wrapper {
        width: calc(100% - 95px);
    }
}

/* اصلاح ارتفاع برای iOS */
@supports (-webkit-touch-callout: none) {
    .app-container {
        height: -webkit-fill-available;
    }
    
    .chat-main {
        height: -webkit-fill-available;
    }
}

/* جلوگیری از اسکرول افقی */
body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* فیکس input در موبایل */
input, textarea {
    font-size: 16px !important; /* جلوگیری از زوم خودکار در iOS */
}