/* css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    overflow-x: hidden;
}

/* حالت روز با بک‌گراند آبی سبز روشن */
body.light-mode {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

body.light-mode .chat-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

body.light-mode .chat-messages {
    background: rgba(248, 249, 250, 0.7);
}

body.light-mode .message.other .message-content {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.light-mode .chat-input-container {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
}

/* صفحه لاگین */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    width: 100%;
    max-width: 400px;
}

.login-box {
    padding: 40px 30px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-icon {
    background: transparent;
    color: #667eea;
    font-size: 18px;
    padding: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.users-list {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.users-list h3 {
    margin-bottom: 10px;
    color: #333;
}

.users-list ul {
    list-style: none;
}

.users-list li {
    padding: 5px 0;
    border-bottom: 1px solid #ddd;
}

/* چت روم */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: white;
    max-width: 1200px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.chat-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    z-index: 100;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
    object-fit: cover;
}

.username {
    font-weight: bold;
    font-size: 18px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    position: relative;
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* پیام کاربر فعلی (سمت چپ) */
.message.own {
    flex-direction: row;
    justify-content: flex-start;
}

.message.own .message-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 18px 18px 18px 0;
    order: 2;
}

.message.own .message-avatar {
    order: 1;
}

/* پیام سایر کاربران (سمت راست) */
.message.other {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.message.other .message-content {
    background: white;
    color: #333;
    border-radius: 18px 18px 0 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    order: 1;
}

.message.other .message-avatar {
    order: 2;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* حل مشکل نمایش فارسی - روش جدید */
.message-text {
    word-wrap: break-word;
    line-height: 1.4;
    margin-bottom: 8px;
    direction: rtl;
    unicode-bidi: embed;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-sender {
    font-weight: bold;
    font-size: 14px;
    direction: rtl;
}

/* استایل برای نمایش فایل */
.file-display {
    margin: 10px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: 100%;
    box-sizing: border-box;
}

.message.other .file-display {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.file-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.file-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.file-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    word-break: break-all;
    flex: 1;
    min-width: 0;
    direction: rtl;
}

.file-link:hover {
    text-decoration: underline;
}

.file-size {
    font-size: 12px;
    opacity: 0.8;
    margin-right: 5px;
}

/* استایل برای تصاویر */
.message-image {
    max-width: 100% !important;
    max-height: 300px;
    border-radius: 8px;
    display: block;
    margin-top: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    object-fit: contain;
    width: auto;
    height: auto;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-footer {
    margin-top: 5px;
    font-size: 11px;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    direction: rtl;
}

.delete-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    padding: 2px 5px;
    border-radius: 3px;
}

.delete-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* بخش ورود پیام - کاملاً اصلاح شده */
.chat-input-container {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 90;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    min-height: 50px;
}

#message-input {
    flex: 1;
    min-width: 120px; /* حداقل عرض برای کادر متن */
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    min-height: 44px;
    direction: rtl;
    text-align: right;
    font-family: inherit;
}

#message-input:focus {
    border-color: #667eea;
}

#message-input::placeholder {
    text-align: right;
    direction: rtl;
}

/* دکمه‌ها با سایز ثابت */
.input-group .btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group .btn-primary {
    width: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background: #e9ecef;
    border-radius: 8px;
    direction: rtl;
}

.file-info button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
}

/* مودال */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    left: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

/* نوتیفیکیشن */
.notification {
    position: fixed;
    top: 20px;
    left: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-right: 4px solid #667eea;
    z-index: 1001;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* استایل پنل ایموجی */
.emoji-picker {
    position: fixed;
    bottom: 100%;
    left: 10px;
    right: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 15px 15px 0 0;
    padding: 20px 15px 15px 15px;
    max-height: 50vh;
    overflow-y: auto;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.15);
    z-index: 1100;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.emoji-picker.show {
    transform: translateY(100%);
}

.emoji-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.emoji-header h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.close-emoji {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 5px;
}

.emoji-category {
    margin-bottom: 15px;
}

.emoji-category strong {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    gap: 8px;
}

.emoji-grid span {
    font-size: 22px;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    background: #f8f9fa;
    border: 1px solid transparent;
}

.emoji-grid span:hover {
    background-color: #667eea;
    color: white;
    transform: scale(1.1);
    border-color: #667eea;
}

/* مودال زوم تصویر */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.image-modal.show {
    display: flex !important;
}

.image-modal-content {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    object-fit: contain;
    margin: auto;
}

.close-image-modal {
    position: fixed;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid white;
}

.close-image-modal:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #ccc;
}

/* ایندیکیتور تایپینگ */
.typing-indicator {
    padding: 10px 15px;
    font-style: italic;
    color: #666;
    font-size: 14px;
    display: none;
    direction: rtl;
}

.typing-indicator.show {
    display: block;
}

.typing-dots {
    display: inline-block;
}

.typing-dots span {
    animation: typing 1.4s infinite;
    display: inline-block;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.online-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #00b894;
    border-radius: 50%;
    margin-right: 5px;
}

/* رسپانسیو */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        max-width: 100%;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
    }
    
    .message-content {
        max-width: 75%;
    }
    
    .chat-messages {
        padding: 15px 10px;
        padding-bottom: 80px;
    }
    
    .chat-input-container {
        padding: 12px 15px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }
    
    .input-group {
        gap: 6px;
    }
    
    #message-input {
        padding: 10px 14px;
        font-size: 16px;
        min-height: 40px;
        min-width: 100px;
    }
    
    .input-group .btn {
        width: 40px;
        height: 40px;
    }
    
    .input-group .btn-primary {
        width: 45px;
    }
    
    /* ایموجی پیکر در موبایل */
    .emoji-picker {
        left: 0;
        right: 0;
        max-height: 60vh;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
    
    .message-image {
        max-height: 200px !important;
    }
    
    .file-display {
        padding: 10px;
    }
    
    .message-avatar {
        width: 25px;
        height: 25px;
    }
}

@media (max-width: 480px) {
    .message-content {
        max-width: 80%;
        padding: 10px 12px;
    }
    
    .emoji-picker {
        max-height: 55vh;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .modal-content {
        padding: 15px;
        margin: 5% auto;
    }
    
    .file-display {
        margin: 6px 0;
        padding: 8px;
    }
    
    .message-image {
        max-height: 150px !important;
    }
    
    .chat-header {
        padding: 10px 12px;
    }
    
    .header-actions {
        gap: 5px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
    
    .chat-input-container {
        padding: 10px 12px;
    }
    
    #message-input {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 36px;
        min-width: 80px;
    }
    
    .input-group .btn {
        width: 36px;
        height: 36px;
    }
    
    .input-group .btn-primary {
        width: 40px;
    }
}

/* اسکرول بار */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* حالت تاریک */
body.dark-mode {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ecf0f1;
}

body.dark-mode .chat-container {
    background: #2c3e50;
}

body.dark-mode .chat-messages {
    background: #34495e;
}

body.dark-mode .message.other .message-content {
    background: #3d566e;
    color: #ecf0f1;
}

body.dark-mode .chat-input-container {
    background: #2c3e50;
    border-top-color: #34495e;
}

body.dark-mode #message-input {
    background: #34495e;
    border-color: #4a6572;
    color: #ecf0f1;
}

body.dark-mode .file-info {
    background: #3d566e;
    color: #ecf0f1;
}

body.dark-mode .modal-content {
    background: #2c3e50;
    color: #ecf0f1;
}

body.dark-mode .emoji-picker {
    background: #2c3e50;
    border-color: #34495e;
}

body.dark-mode .emoji-category strong {
    color: #ecf0f1;
    border-bottom-color: #4a6572;
}

body.dark-mode .emoji-grid span {
    background: #3d566e;
}

body.dark-mode .emoji-grid span:hover {
    background-color: #667eea;
}

body.dark-mode .file-display {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .message.other .file-display {
    background: #3d566e;
    border-color: #4a6572;
}

/* ایموجی بک‌دراپ */
.emoji-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

.emoji-backdrop.show {
    display: block;
}

/* اضافه کردن این استایل‌ها به فایل CSS */

/* استایل برای پیش‌نمایش نقل قول */
.reply-preview {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 20px;
    direction: rtl;
}

.reply-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.reply-header {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.reply-username {
    font-weight: bold;
    color: #667eea;
    flex-shrink: 0;
}

.reply-text {
    color: #6c757d;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-cancel-reply {
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-cancel-reply:hover {
    background: #e9ecef;
    color: #dc3545;
}

/* استایل برای نقل قول در پیام */
.message-reply {
    background: rgba(0, 0, 0, 0.05);
    border-right: 3px solid #667eea;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.message-reply:hover {
    background: rgba(102, 126, 234, 0.1);
}

.reply-indicator {
    font-size: 12px;
    color: #667eea;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.reply-indicator i {
    font-size: 10px;
}

.reply-preview-text {
    font-size: 13px;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* استایل برای دکمه‌های action */
.message-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.action-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
    border-radius: 3px;
    font-size: 12px;
    transition: all 0.2s;
}

.action-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.reply-btn {
    color: #667eea;
}

.delete-btn {
    color: #dc3545;
}

/* حالت تاریک برای نقل قول */
body.dark-mode .reply-preview {
    background: #34495e;
    border-bottom-color: #4a6572;
}

body.dark-mode .message-reply {
    background: rgba(255, 255, 255, 0.1);
    border-right-color: #667eea;
}

body.dark-mode .reply-indicator {
    color: #667eea;
}

body.dark-mode .reply-preview-text {
    color: #b8c2cc;
}

/* اضافه کردن این استایل‌ها به فایل CSS */

/* هدر فیکس شده و جمع شونده */
.chat-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    z-index: 100;
    position: sticky;
    top: 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chat-header.collapsed {
    padding: 10px 20px;
}

.chat-header.collapsed .header-actions,
.chat-header.collapsed .username {
    display: none;
}

.chat-header.collapsed .user-info {
    justify-content: center;
    width: 100%;
}

/* منوی کشویی */
.header-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 101;
    display: none;
    flex-direction: column;
    padding: 10px 0;
    direction: rtl;
}

.header-menu.show {
    display: flex;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: right;
    font-size: 14px;
    cursor: pointer;
}

.menu-item:hover {
    background: #f8f9fa;
}

.menu-item i {
    width: 20px;
    text-align: center;
    color: #667eea;
}

.menu-item.logout {
    color: #dc3545;
}

.menu-item.logout i {
    color: #dc3545;
}

.menu-divider {
    height: 1px;
    background: #e9ecef;
    margin: 8px 0;
}

/* آیکون هامبورگر */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* بخش پیام‌ها با padding جدید */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 80px 20px 100px 20px; /* فضای برای هدر و input فیکس شده */
    background: #f8f9fa;
    position: relative;
}

/* رسپانسیو */
@media (max-width: 768px) {
    .chat-header {
        padding: 12px 15px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 200;
    }
    
    .chat-header.collapsed {
        padding: 8px 15px;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .header-actions {
        display: none;
    }
    
    .username {
        display: block;
    }
    
    .chat-messages {
        padding: 70px 10px 90px 10px;
        margin-top: 60px;
    }
    
    .header-menu {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        border-radius: 15px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-header.collapsed {
        padding: 6px 12px;
    }
    
    .chat-messages {
        padding: 60px 8px 80px 8px;
        margin-top: 50px;
    }
    
    .header-menu {
        top: 50px;
        left: 5px;
        right: 5px;
    }
}

/* اضافه کردن این استایل‌ها به فایل CSS */

/* استایل برای ضبط صدا */
.voice-recording {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 10px;
    padding: 10px 15px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: pulse 1.5s infinite;
}

.voice-recording-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #721c24;
}

.recording-icon {
    color: #dc3545;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.recording-text {
    font-weight: bold;
}

.recording-timer {
    font-family: 'Courier New', monospace;
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.btn-stop-recording {
    padding: 6px 12px;
    font-size: 14px;
}

/* استایل برای پخش ویدیو */
.message-video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 8px;
    background: #000;
}

/* استایل برای پخش صوت */
.message-audio {
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.audio-player {
    width: 100%;
    height: 40px;
    margin-bottom: 8px;
}

.audio-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    font-size: 14px;
}

.audio-info i {
    color: #667eea;
}

/* برای پیام‌های دیگران */
.message.other .message-audio {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

/* رسپانسیو */
@media (max-width: 768px) {
    .message-video {
        max-height: 200px;
    }
    
    .voice-recording {
        padding: 8px 12px;
    }
    
    .recording-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .message-video {
        max-height: 150px;
    }
    
    .voice-recording {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}