/*
* فونت وزیرمتن برای ظاهر بهتر فارسی
*/
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #25D366; /* سبز واتساپی */
    --primary-dark: #128C7E;
    --primary-light: #dcf8c6;
    --secondary-color: #34B7F1;
    --light-green-sent: #dcf8c6;
    --white-received: #ffffff;
    --background-grey: #f0f2f5;
    --light-grey: #f8f9fa;
    --border-grey: #e0e0e0;
    --text-dark: #1c1e21;
    --text-light: #65676b;
    --danger-color: #ff4444;
    --warning-color: #ffbb33;
    --success-color: #00C851;
}

/* --- استایل‌های عمومی --- */
body {
    font-family: 'Vazirmatn', sans-serif;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

* {
    box-sizing: border-box;
    font-family: "Vazirmatn";
    -webkit-tap-highlight-color: transparent;
}

/* =================================================== */
/* === استایل‌های مربوط به صفحه ورود و ثبت‌نام === */
/* =================================================== */

.auth-container {
    background: white;
    padding: 2rem 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-grey);
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.tab-button {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    font-size: 1rem;
    font-family: 'Vazirmatn';
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button.active {
    color: var(--primary-color);
    font-weight: 600;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

.auth-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-section.active {
    display: block;
}

.auth-section h2 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.auth-section form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-section input[type="text"],
.auth-section input[type="tel"],
.auth-section input[type="password"],
.auth-section input[type="file"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-grey);
    border-radius: 12px;
    font-size: 1rem;
    direction: rtl;
    text-align: right;
    font-family: 'Vazirmatn';
    transition: all 0.3s ease;
    background: var(--light-grey);
}

.auth-section input[type="text"]:focus,
.auth-section input[type="tel"]:focus,
.auth-section input[type="password"]:focus {
    border-color: var(--primary-color);
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.auth-section input[type="file"] {
    background-color: #f9f9f9;
    cursor: pointer;
    padding: 12px;
}

.auth-section label {
    align-self: flex-end;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: -12px;
    font-weight: 500;
}

.auth-section button {
    padding: 14px;
    background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    margin-top: 10px;
}

.auth-section button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.9rem;
    margin-top: 10px;
    min-height: 1em;
    padding: 8px;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 8px;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 5px 0;
}

.form-group-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-group-checkbox label {
    margin: 0;
    font-size: 0.9rem;
}

/* ================================================= */
/* === استایل‌های مربوط به صفحه اصلی چت === */
/* ================================================= */

.chat-container {
    display: flex;
    width: 97%;
    height: 97vh;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sidebar {
    width: 380px;
    display: flex;
    flex-direction: column;
    background: var(--light-grey);
    border-left: 1px solid var(--border-grey);
    position: relative;
    z-index: 10;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 20px;
    background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
    color: white;
    gap: 15px;
    min-height: 80px;
}

.sidebar-header .user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

.sidebar-header .user-profile img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sidebar-header h4 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.sidebar-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sidebar-header button:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.contact-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    background: white;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    background: white;
    border: 2px solid transparent;
    position: relative;
    min-height: 80px;
}

.contact-item:hover {
    background: var(--light-grey);
    transform: translateX(-4px);
    border-color: var(--border-grey);
}

.contact-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.contact-item.active .contact-info small {
    color: rgba(255,255,255,0.9);
}

.contact-avatar {
    position: relative;
    margin-left: 16px;
}

.contact-avatar img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-grey);
    transition: all 0.3s ease;
}

.contact-item.active .contact-avatar img {
    border-color: white;
}

.contact-info {
    flex-grow: 1;
    text-align: right;
    overflow: hidden;
}

.contact-info h4 {
    margin: 0 0 6px 0;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.contact-info p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.message-time {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* تیک آبی تأیید شده */
.verified-badge {
    color: var(--secondary-color);
    font-size: 1em;
    margin-right: 5px;
    filter: drop-shadow(0 2px 4px rgba(52, 183, 241, 0.3));
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.contact-item.active .verified-badge {
    color: white;
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.5));
}

/* بادج آنلاین */
.online-badge {
    position: absolute;
    left: 12px;
    top: 12px;
    width: 12px;
    height: 12px;
    background: var(--success-color);
    border-radius: 50%;
    border: 2px solid white;
}

/* ========== پنجره چت ========== */
.chat-window {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    position: relative;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-light);
    text-align: center;
    padding: 20px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" viewBox="0 0 200 200"><path fill="%2325D366" opacity="0.05" d="M45.5,-45.5C57.4,-30.9,64.2,-15.4,63.8,-0.3C63.3,14.8,55.6,29.6,43.7,40.5C31.8,51.4,15.9,58.4,0.9,57.5C-14.2,56.6,-28.3,47.8,-39.2,36.9C-50.1,26,-57.7,13,-58.4,-0.5C-59.2,-14,-53,-28,-42.1,-42.5C-31.2,-57,-15.6,-72,0,-72C15.6,-72,31.2,-57,45.5,-45.5Z" transform="translate(100 100)"/></svg>') center/cover;
}

.welcome-screen h2 {
    color: var(--primary-dark);
    margin-bottom: 15px;
    font-size: 2.2rem;
}

.welcome-screen p {
    font-size: 1.1rem;
    max-width: 400px;
    line-height: 1.6;
}

.chat-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path fill="%2325D366" opacity="0.03" d="M11 18a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm9 0a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm9 0a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"/></svg>');
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    border-bottom: 2px solid var(--border-grey);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 5;
}

.back-button {
    background: var(--light-grey);
    border: none;
    color: var(--text-dark);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.back-button:hover {
    background: var(--border-grey);
    transform: translateX(-2px);
}

.chat-header img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: 15px;
    border: 3px solid var(--primary-color);
}

.chat-header h3 {
    margin: 0;
    font-weight: 600;
    flex-grow: 1;
    text-align: right;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========== پیام‌ها ========== */
.messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: url('https://web.whatsapp.com/img/bg-chat-tile-light_6ad68e73307567780005.png');
    background-repeat: repeat;
    background-size: 400px;
}

.message {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 22px;
    position: relative;
    animation: messageAppear 0.3s ease;
    line-height: 1.5;
    word-wrap: break-word;
    transition: all 0.3s ease;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.sent {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 8px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.2);
}

.message.received {
    background: white;
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.message img {
    max-width: 100%;
    border-radius: 16px;
    margin-bottom: 8px;
    border: 2px solid rgba(0,0,0,0.1);
}

.message .caption {
    display: block;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    margin-top: 8px;
    text-align: right;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.message.received .caption {
    color: var(--text-light);
    border-top-color: rgba(0,0,0,0.1);
}

/* زمان پیام */
.message-time {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 6px;
    text-align: left;
    direction: ltr;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message.sent .message-time {
    color: rgba(255,255,255,0.9);
}

.message.received .message-time {
    color: var(--text-light);
}

/* ========== فرم ارسال پیام ========== */
.chat-form-container {
    padding: 20px;
    background: white;
    border-top: 2px solid var(--border-grey);
}

.chat-form-container form {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--light-grey);
    padding: 12px 20px;
    border-radius: 30px;
    border: 2px solid var(--border-grey);
    transition: all 0.3s ease;
}

.chat-form-container form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
    transform: translateY(-2px);
}

.chat-form-container input[type="text"] {
    flex-grow: 1;
    padding: 14px 0;
    border: none;
    background: transparent;
    font-size: 1rem;
    direction: rtl;
    text-align: right;
    font-family: 'Vazirmatn';
    outline: none;
    color: var(--text-dark);
}

#captionInput {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-grey);
    border-radius: 16px;
    font-size: 0.95rem;
    direction: rtl;
    text-align: right;
    margin-top: 12px;
    font-family: 'Vazirmatn';
    background: white;
    display: none;
}

.chat-form-container .attach-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-form-container .attach-btn:hover {
    background: var(--primary-dark);
    transform: rotate(15deg) scale(1.1);
}

.chat-form-container button[type="submit"] {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chat-form-container button[type="submit"]:hover {
    transform: scale(1.1) rotate(360deg);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

/* ========== منوی راست‌کلیک ========== */
.context-menu {
    display: none;
    position: absolute;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 180px;
    direction: rtl;
    overflow: hidden;
    border: 2px solid var(--border-grey);
    animation: menuAppear 0.2s ease;
}

@keyframes menuAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu ul {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.context-menu ul li {
    padding: 14px 20px;
    cursor: pointer;
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.context-menu ul li:hover {
    background: var(--light-grey);
    padding-right: 25px;
}

.context-menu ul li i {
    font-size: 1.1rem;
    width: 20px;
}

.context-menu ul li.danger {
    color: var(--danger-color);
    border-top: 2px solid var(--border-grey);
    margin-top: 8px;
    padding-top: 18px;
}

.context-menu ul li.danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

/* ========== مودال تنظیمات ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    margin: auto;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideUpModal 0.4s ease;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-button {
    color: var(--text-light);
    float: left;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 20px;
    left: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--light-grey);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    color: var(--danger-color);
    transform: rotate(90deg);
    background: rgba(255, 68, 68, 0.1);
}

.modal-content h2 {
    color: var(--primary-dark);
    margin-bottom: 25px;
    font-size: 1.8rem;
    text-align: center;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-grey);
    border-radius: 12px;
    font-size: 1rem;
    direction: rtl;
    text-align: right;
    font-family: 'Vazirmatn';
    transition: all 0.3s ease;
    background: var(--light-grey);
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus {
    border-color: var(--primary-color);
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-grey);
    border-radius: 12px;
    font-size: 0.9rem;
    background-color: #f9f9f9;
    cursor: pointer;
}

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.settings-options button,
#saveSettingsBtn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.05rem;
    font-family: inherit;
    transition: all 0.3s ease;
    font-weight: 600;
}

#saveSettingsBtn {
    background: linear-gradient(to right, var(--primary-color), var(--primary-dark));
    color: white;
}

#saveSettingsBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3);
}

.settings-options button.danger {
    background: var(--danger-color);
    color: white;
}

.settings-options button.danger:hover {
    background: #ff3333;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 68, 68, 0.3);
}

.settings-options button.danger-secondary {
    background: transparent;
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

.settings-options button.danger-secondary:hover {
    background: var(--danger-color);
    color: white;
}

/* ========== واکنش‌گرا ========== */
@media (max-width: 768px) {
    body {
        padding: 0;
        background: var(--primary-color);
    }
    
    .chat-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
    
    .sidebar {
        width: 100%;
        position: absolute;
        transform: translateX(0);
        transition: transform 0.3s ease;
    }
    
    .sidebar.hidden {
        transform: translateX(100%);
    }
    
    .chat-window {
        width: 100%;
        position: absolute;
        display: none;
    }
    
    .chat-window.active {
        display: flex;
    }
    
    .back-button {
        display: flex;
    }
    
    .message {
        max-width: 85%;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
}

/* ========== اسکرول بار زیبا ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-grey);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ========== انیمیشن‌های اضافی ========== */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ========== استایل‌های جدید ========== */
.unread-badge {
    background: var(--danger-color);
    color: white;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 12px;
    margin-right: auto;
    min-width: 20px;
    text-align: center;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.last-message-time {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 15px;
    background: white;
    border-radius: 20px;
    width: fit-content;
    margin: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* استایل‌های نوتیفیکیشن و لودینگ در فایل main.js تعریف شده‌اند */

/* ... تمام استایل‌های قبلی تا انتهای فایل باقی می‌مانند ... */

/* ========== استایل‌های جدید برای ویژگی‌های اضافه شده ========== */

/* دکمه انتخابگر ایموجی */
.emoji-picker-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.emoji-picker-btn:hover {
    color: var(--primary-color);
    background: rgba(37, 211, 102, 0.1);
}

/* کانتینر انتخابگر ایموجی */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    right: 80px;
    width: 300px;
    max-height: 200px;
    background: white;
    border: 1px solid var(--border-grey);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    padding: 10px;
    overflow-y: auto;
    z-index: 1000;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
}

.emoji-picker .emoji {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.emoji-picker .emoji:hover {
    background: var(--light-grey);
}

/* استایل‌های ریپلای */
.message-reply {
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-right: 3px solid var(--primary-color);
    font-size: 0.85rem;
    color: var(--text-light);
    cursor: pointer;
}

.message-reply .reply-author {
    font-weight: 600;
    color: var(--text-dark);
}

.message.sent .message-reply {
    border-right-color: white;
    background: rgba(255,255,255,0.2);
}

.message.sent .message-reply .reply-author {
    color: white;
}

/* استایل‌های ویرایش و حذف پیام */
.message-actions {
    position: absolute;
    top: 5px;
    left: 5px;
    display: none;
    gap: 5px;
}

.message:hover .message-actions {
    display: flex;
}

.message-action-btn {
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.message-action-btn:hover {
    background: rgba(0,0,0,0.8);
}

.message-edited-indicator {
    font-size: 0.7rem;
    font-style: italic;
    opacity: 0.7;
    margin-right: 5px;
}

/* استایل‌های لینک و منشن */
.message-text a {
    color: var(--secondary-color);
    text-decoration: none;
}

.message-text a:hover {
    text-decoration: underline;
}

.mention {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
}

/* استایل‌های وضعیت آنلاین */
.online-indicator {
    width: 12px;
    height: 12px;
    background-color: #25D366;
    border-radius: 50%;
    border: 2px solid white;
    position: absolute;
    bottom: 2px;
    right: 2px;
}

.chat-header .contact-info {
    display: flex;
    flex-direction: column;
}

.chat-header .online-status {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* مودال ریپلای */
.reply-modal {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid var(--border-grey);
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    z-index: 1001;
    max-width: 300px;
}

.reply-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--text-dark);
}

.reply-modal-header button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
}

#replyToText {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* بهبود واکنش‌گرایی برای موبایل */
@media (max-width: 768px) {
    .emoji-picker {
        width: 90%;
        right: 5%;
        bottom: 70px;
        grid-template-columns: repeat(6, 1fr);
    }
    
    .message-actions {
        top: auto;
        bottom: 5px;
        left: auto;
        right: 5px;
    }
    
    .message-action-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    /* استایل‌های جدید برای نوتیفیکیشن مرورگر و مودال */

/* منوی راست کلیک پیام‌ها */
#messageContextMenu {
    display: none;
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 1002;
    min-width: 150px;
    overflow: hidden;
    border: 1px solid var(--border-grey);
}

#messageContextMenu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#messageContextMenu li {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
    text-align: right;
    border-bottom: 1px solid var(--border-grey);
}

#messageContextMenu li:last-child {
    border-bottom: none;
}

#messageContextMenu li:hover {
    background: #f0f0f0;
}

/* استایل برای مودال افزودن مخاطب */
.add-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.add-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--light-grey);
    border: 2px solid var(--border-grey);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: right;
    font-family: 'Vazirmatn', sans-serif;
}

.add-option-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.add-option-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.add-option-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.add-option-btn.disabled:hover {
    background: var(--light-grey);
    border-color: var(--border-grey);
    transform: none;
}

.add-option-btn span {
    flex: 1;
    font-weight: 600;
}

.add-option-btn small {
    color: var(--text-light);
    font-size: 0.8rem;
}

/* بهبود واکنش‌گرایی برای موبایل */
@media (max-width: 768px) {
    /* بهبود سایدبار در موبایل */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 1000;
        transform: translateX(0);
        transition: transform 0.3s ease;
    }
    
    .sidebar.hidden {
        transform: translateX(100%);
    }
    
    /* پنجره چت */
    .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1001;
        display: none;
    }
    
    .chat-window.active {
        display: flex;
    }
    
    /* هدر چت */
    .chat-header {
        padding: 15px;
        min-height: 70px;
    }
    
    .back-button {
        display: flex;
        margin-left: 10px;
    }
    
    /* پیام‌ها */
    .message {
        max-width: 85%;
        padding: 12px 15px;
    }
    
    /* فرم ارسال */
    .chat-form-container {
        padding: 15px;
    }
    
    .chat-form-container form {
        padding: 10px 15px;
    }
    
    /* مودال‌ها */
    .modal-content {
        width: 95% !important;
        margin: 10px;
        padding: 20px;
    }
    
    /* بهبود تاچ */
    .contact-item {
        padding: 12px;
        min-height: 70px;
    }
    
    .contact-avatar img {
        width: 48px;
        height: 48px;
    }
    
    /* ایموجی پیکر */
    .emoji-picker {
        width: 90%;
        right: 5%;
        bottom: 70px;
        grid-template-columns: repeat(6, 1fr);
    }
    
    /* منوی راست کلیک */
    #messageContextMenu {
        min-width: 130px;
        font-size: 14px;
    }
    
    #messageContextMenu li {
        padding: 10px 15px;
    }
    
    /* مودال افزودن مخاطب */
    .add-option-btn {
        padding: 12px;
    }
    
    /* جلوگیری از زوم در اینپوت‌ها در آیفون */
    @media screen and (max-width: 480px) {
        input[type="text"],
        input[type="tel"],
        input[type="password"],
        textarea {
            font-size: 16px;
        }
    }
    
    /* بهبود ناوبری */
    .sidebar-header {
        padding: 15px;
        min-height: 70px;
    }
    
    /* مخفی کردن عناصر غیرضروری در موبایل */
    .welcome-screen h2 {
        font-size: 1.8rem;
    }
    
    .welcome-screen p {
        font-size: 1rem;
    }
    
    /* بهبود اسکرول */
    .messages {
        padding: 15px;
    }
}

/* بهبود برای تبلت */
@media (min-width: 769px) and (max-width: 1024px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .sidebar {
        width: 320px;
    }
    
    .message {
        max-width: 80%;
    }
}

/* استایل برای موبایل‌های خیلی کوچک */
@media (max-width: 360px) {
    .chat-header h3 {
        font-size: 1rem;
    }
    
    .message {
        max-width: 90%;
        padding: 10px 12px;
    }
    
    .contact-info h4 {
        font-size: 0.95rem;
    }
}
/* استایل‌های مودال افزودن مخاطب */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-grey);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-grey);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
    text-align: right;
    background: #f8f9fa;
    transition: all 0.3s ease;
    color: var(--text-dark);
}

.form-group input:focus {
    border-color: var(--primary-color);
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 8px;
    text-align: right;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-grey);
    background: #f9f9f9;
}

.modal-footer .btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Vazirmatn', sans-serif;
}

.btn-secondary {
    background: #f0f2f5;
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #e4e6eb;
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}
/* استایل‌های مودال ساخت گروه */
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-grey);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
    text-align: right;
    background: #f8f9fa;
    transition: all 0.3s ease;
    color: var(--text-dark);
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

textarea:focus {
    border-color: var(--primary-color);
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.members-container {
    margin-top: 10px;
}

.members-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.members-input input {
    flex: 1;
}

.btn-add-member {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-member:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.members-list {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid var(--border-grey);
    border-radius: 10px;
    padding: 10px;
    background: #f8f9fa;
    margin-bottom: 10px;
}

.empty-members {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 0.9rem;
    opacity: 0.7;
}

.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-grey);
    transition: all 0.3s ease;
}

.member-item:hover {
    background: #f0f2f5;
    border-color: var(--primary-color);
    transform: translateX(-3px);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-info i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.member-phone {
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 500;
}

.btn-remove-member {
    background: #ff4444;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-remove-member:hover {
    background: #cc0000;
    transform: scale(1.1);
}

/* اسکرول بار برای لیست اعضا */
.members-list::-webkit-scrollbar {
    width: 6px;
}

.members-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.members-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.members-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}
/* استایل‌های مودال انتخاب */
.add-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.add-option {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    border: 2px solid var(--border-grey);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: right;
    gap: 15px;
}

.add-option:hover {
    border-color: var(--primary-color);
    background: #f0fff4;
    transform: translateX(-5px);
    box-shadow: 0 5px 20px rgba(37, 211, 102, 0.15);
}

.add-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.add-option.disabled:hover {
    border-color: var(--border-grey);
    background: white;
    transform: none;
    box-shadow: none;
}

.option-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.option-content {
    flex: 1;
}

.option-content h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.option-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.4;
}

.option-arrow {
    color: var(--text-light);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.add-option:hover .option-arrow {
    color: var(--primary-color);
    transform: translateX(-5px);
}
}