/* ========================
   MAHIXO WEB - Complete Theme
   Dark (default) & Light
   ======================== */

:root {
  /* -------- تم روشن ---------- */
  --primary: #8c52ff;
  --primary-dark: #7840d6;
  --danger: #e94545;
  --success: #10b981;
  --warning: #f59e0b;
  --bg: #f8f9fc;
  --bg-gradient: linear-gradient(135deg, #ffffff 0%, #e4e8f0 100%);
  --card-bg: rgb(255, 255, 255);
  --card-border: rgba(0, 0, 0, 0.08);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --input-bg: rgba(0, 0, 0, 0.04);
  --input-border: rgba(0, 0, 0, 0.1);
  --modal-bg: rgba(255, 255, 255, 0.92);
  --navbar-bg: rgba(255, 255, 255, 0.7);
  --btn-header-text: #1e293b;
  --btn-day-bg: #e2e8f0;
  --btn-day-text: #1e293b;
}

body.dark {
  --primary: #8c52ff;
  --primary-dark: #7840d6;
  --danger: #e94545;
  --success: #10b981;
  --warning: #f59e0b;
  --bg: #0f0f13;
  --bg-gradient: linear-gradient(135deg, #0f0f13 0%, #1a1a2e 100%);
  --card-bg: rgba(20, 20, 35, 0.6);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-main: #f0f0f5;
  --text-muted: #a0a0b0;
  --input-bg: rgba(255, 255, 255, 0.06);
  --input-border: rgba(255, 255, 255, 0.1);
  --modal-bg: rgba(20, 20, 35, 0.85);
  --navbar-bg: rgba(255, 255, 255, 0.04);
  --btn-header-text: #ffffff;
  --btn-day-bg: #2d3436;
  --btn-day-text: #fdcb6e;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; font-family: 'Vazirmatn', system-ui, sans-serif; }
body { background: var(--bg-gradient); color: var(--text-main); min-height: 100vh; padding: 20px; overflow-x: hidden; transition: background 0.4s, color 0.4s; }
.hidden { display: none !important; }
ul { list-style: none; }
input, textarea { user-select: text; }

/* ====== آیکون‌های SVG ====== */
svg { display: inline-block; vertical-align: middle; }
.icon { width: 1.3em; height: 1.3em; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }

/* داخل دکمه‌ها و متن‌ها */
.btn-header .icon,
.btn-primary .icon,
.btn-outline .icon,
.btn-primary-small .icon,
.btn-outline-small .icon,
.context-item .icon,
.notification-btn .icon,
.profile-edit-btn .icon,
.profile-action-btn .icon,
.profile-back-btn .icon,
.stat-icon .icon,
.feed-like-btn .icon,
.feed-delete-btn .icon,
.feed-tab .icon,
.chat-send-btn .icon,
.btn-delete-all .icon,
.upload-btn-select .icon,
.upload-btn-upload .icon {
    width: 1.1em; height: 1.1em;
}
.card h3 .icon { width: 1.4em; height: 1.4em; }
.upload-area .icon, .file-item .icon { width: 1.3em; height: 1.3em; }

/* -------- لودر ---------- */
.loader-wrapper { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 10000; }
.loader { width: 50px; height: 50px; border: 4px solid rgba(128,128,128,0.2); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -------- احراز هویت ---------- */
.auth-container { min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; padding: 2rem 1.5rem; text-align: center; background: var(--card-bg); backdrop-filter: blur(16px); border: 1px solid var(--card-border); border-radius: 32px; color: var(--text-main); }
.auth-card h1 { font-size: 2rem; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 0.5rem; }
.auth-tabs { display: flex; gap: 1rem; margin: 1.5rem 0; background: rgba(0,0,0,0.1); border-radius: 50px; padding: 0.25rem; }
.auth-tab { flex: 1; padding: 0.75rem; border: none; background: transparent; color: var(--text-main); font-weight: bold; border-radius: 50px; cursor: pointer; transition: 0.2s; }
.auth-tab.active { background: var(--primary); color: white; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form input { padding: 14px 18px; border: 1px solid var(--input-border); border-radius: 50px; background: var(--input-bg); color: var(--text-main); font-size: 1rem; outline: none; }
.auth-form input::placeholder { color: var(--text-muted); }
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(140,82,255,0.3); }
.btn-primary { background: var(--primary); border: none; padding: 14px; border-radius: 50px; color: white; font-weight: bold; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-outline { background: transparent; border: 2px solid var(--text-muted); padding: 12px; border-radius: 50px; color: var(--text-main); font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.error-msg { color: #f87171; font-size: 0.8rem; margin-top: -0.5rem; }

/* -------- داشبورد: نوار ناوبری ---------- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--navbar-bg);
    backdrop-filter: blur(16px);
    padding: 12px 28px;
    border-radius: 60px;
    margin-bottom: 30px;
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 15px;
    position: relative;       /* اضافه شد */
    z-index: 100;             /* اضافه شد */
}

/* -------- گرید کارت‌ها ---------- */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    position: relative;       /* اضافه شد */
    z-index: 1;               /* اضافه شد */
}

.header-right, .header-left { display: flex; align-items: center; gap: 12px; }
.logo-area { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 40px; height: 40px; background: linear-gradient(135deg, #6e44ff, #4530f0); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; }
.logo-icon .icon-fill { width: 22px; height: 22px; }
.logo-text { font-weight: 700; font-size: 1.2rem; color: var(--text-main); }
.datetime { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; opacity: 0.8; background: rgba(0,0,0,0.04); padding: 6px 15px; border-radius: 20px; white-space: nowrap; color: var(--text-main); }
.clock-time { font-weight: 700; }
.clock-date { font-size: 0.85rem; opacity: 0.7; }

.btn-header { border: none; padding: 10px 18px; border-radius: 30px; cursor: pointer; font-weight: 700; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px; transition: 0.2s; color: var(--btn-header-text); min-height: 44px; background: var(--input-bg); }
.btn-logout { background: var(--danger); color: white; }
.btn-logout:hover { background: #c0392b; }
.btn-day { background: var(--btn-day-bg); color: var(--btn-day-text); }
.btn-day:hover { background: #3d4a4d; color: white; }
.btn-msg { background: #0984e3; color: white; }
.btn-msg:hover { background: #0a7bd0; }
.btn-panel { background: white; color: #2d3436; }
.btn-panel:hover { background: #f1f2f6; }
.btn-wall { background: #00b894; color: white; }
.btn-wall:hover { background: #00a382; }

.user-info { display: flex; align-items: center; gap: 12px; }
.avatar { width: 45px; height: 45px; border-radius: 50%; background: linear-gradient(135deg, #7c3aed, #a855f7); display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.2rem; color: white; background-size: cover; background-position: center; cursor: pointer; }

/* -------- گرید کارت‌ها ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.card { background: var(--card-bg); backdrop-filter: blur(14px); border: 1px solid var(--card-border); border-radius: 28px; padding: 28px; box-shadow: 0 12px 40px rgba(0,0,0,0.1); transition: transform 0.2s; color: var(--text-main); }
.card:hover { transform: translateY(-4px); }
.card h3 { font-size: 1.3rem; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

/* -------- وظایف ---------- */
.todo-input-group { display: flex; gap: 10px; margin-bottom: 20px; direction: rtl; }
.todo-input-group button { width: 55px; height: 55px; border-radius: 50%; background: var(--primary); border: none; color: white; font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; flex-shrink: 0; }
.todo-input-group button:hover { background: var(--primary-dark); }
.todo-input-group input { flex: 1; padding: 14px 18px; border-radius: 40px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-main); font-family: inherit; outline: none; transition: 0.2s; }
.todo-input-group input:focus { border-color: var(--primary); }
.todo-list li { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: rgba(0,0,0,0.02); border-radius: 40px; margin-bottom: 6px; transition: 0.2s; cursor: pointer; color: var(--text-main); }
.todo-list li:hover { background: rgba(0,0,0,0.06); }
.todo-list li.completed span { text-decoration: line-through; opacity: 0.5; }
.todo-list li span { flex: 1; }
.todo-list li button { background: transparent; border: none; color: var(--danger); font-size: 1rem; cursor: pointer; padding: 5px; transition: 0.2s; }
.todo-list li button:hover { color: white; background: rgba(255,0,0,0.2); border-radius: 50%; }

/* -------- فضای ابری ---------- */
.upload-area { background: var(--input-bg); border: 2px dashed var(--input-border); border-radius: 20px; padding: 20px; text-align: center; margin-bottom: 20px; transition: 0.3s; }
.upload-area:hover { border-color: var(--primary); }
.upload-hint { margin-bottom: 15px; opacity: 0.7; }
.upload-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.upload-btn-select { display: inline-flex; align-items: center; padding: 10px 20px; background: var(--input-bg); border-radius: 30px; color: var(--text-main); cursor: pointer; font-weight: 600; transition: 0.2s; border: 1px solid var(--input-border); }
.upload-btn-select:hover { background: var(--card-border); }
.upload-or { margin: 0 10px; opacity: 0.6; font-size: 0.9rem; }
.upload-btn-upload { display: inline-flex; align-items: center; padding: 10px 20px; background: var(--primary); border: none; border-radius: 30px; color: white; font-weight: 600; cursor: pointer; transition: 0.2s; }
.upload-btn-upload:hover { background: var(--primary-dark); }
.file-list { margin-top: 1rem; }
.file-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: rgba(0,0,0,0.02); border-radius: 40px; margin-bottom: 8px; }
.file-item a { color: var(--text-main); text-decoration: none; flex: 1; font-size: 0.9rem; }
.file-item button { background: var(--danger); border: none; width: 30px; height: 30px; border-radius: 50%; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.btn-delete-all { width: 100%; margin-top: 15px; padding: 14px; background: var(--danger); border: none; border-radius: 30px; color: white; font-family: inherit; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* -------- مدال‌ها ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 100000 !important;  /* افزایش و ثابت کردن */
    display: none;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-box { width: 90%; max-width: 400px; padding: 1.8rem; text-align: center; border-radius: 32px; background: var(--modal-bg); backdrop-filter: blur(16px); border: 1px solid var(--card-border); color: var(--text-main); }
.modal-box h3 { margin-bottom: 1.2rem; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; gap: 8px; }
.modal-box input { width: 100%; padding: 12px 16px; margin-bottom: 1rem; border: 1px solid var(--input-border); border-radius: 50px; background: var(--input-bg); color: var(--text-main); font-size: 0.9rem; outline: none; }
.modal-box input:focus { border-color: var(--primary); }
.modal-buttons { display: flex; gap: 10px; margin-top: 1rem; }
.modal-buttons button { flex: 1; padding: 10px; border-radius: 50px; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-cancel { background: rgba(128,128,128,0.2); color: var(--text-main); }

/* About Modal */
.modal-about { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); z-index: 11000; display: none; justify-content: center; align-items: center; }
.modal-about.active { display: flex; }
.modal-about .glass { width: 85%; max-width: 350px; padding: 2rem; text-align: center; border-radius: 32px; background: var(--card-bg); backdrop-filter: blur(16px); border: 1px solid var(--card-border); color: white; }

/* Confirm Modal */
#confirmModal {
    z-index: 200000 !important;  /* بالاتر از همه */
}
#confirmModal.active {
    display: flex !important;
}
#confirmModal .modal-box {
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeUp 0.3s ease;
    position: relative;
    z-index: 200001 !important;
}
#confirmModal .modal-box p { white-space: pre-line; text-align: center; line-height: 1.6; margin: 1.2rem 0; font-size: 0.9rem; max-height: 300px; overflow-y: auto; padding: 0 5px; word-break: break-word; }
#confirmModal .modal-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 1rem; }
#confirmModal .modal-buttons button { min-width: 110px; padding: 12px 20px; font-size: 0.9rem; border-radius: 50px; cursor: pointer; }
#confirmModal .btn-primary { background: linear-gradient(135deg, #ef4444, #dc2626); border: none; color: white; }
#confirmModal .btn-cancel { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.2); }

/* Role Modal */
.role-options { display: flex; flex-direction: column; gap: 0.8rem; margin: 1rem 0; }
.role-option-btn { padding: 12px; border-radius: 50px; font-size: 1rem; cursor: pointer; background: rgba(255,255,255,0.15); color: white; border: none; display: flex; align-items: center; justify-content: center; gap: 8px; }
.role-option-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.02); }
.role-option-btn[data-role="owner"] { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1e293b; }
.role-option-btn[data-role="admin"] { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.role-option-btn[data-role="user"] { background: rgba(255,255,255,0.2); }

/* ========== پروفایل خود کاربر (بازطراحی مدرن) ========== */
.profile-page {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(16px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}
.profile-page.hidden { display: none; }

.profile-container {
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    color: var(--text-main);
    animation: fadeUp 0.3s ease;
}

/* هدر */
.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0.5rem;
}
.profile-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}
.profile-close-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(128,128,128,0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}
.profile-close-btn:hover {
    background: var(--danger);
    color: white;
}

/* بخش بالایی */
.profile-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1.5rem 1.5rem;
    gap: 0.8rem;
}
.profile-avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.4);
    flex-shrink: 0;
}
.profile-names {
    text-align: center;
}
.profile-names h3 {
    font-size: 1.4rem;
    margin: 0;
    color: var(--text-main);
}
.profile-names span {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}
.profile-role-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 16px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}
/* رنگ‌ها از کلاس‌های قبلی استفاده می‌کنند (owner/admin/user) */

/* کارت‌های آمار */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
}
.stat-item {
    background: rgba(128,128,128,0.05);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.2rem 0.5rem;
    text-align: center;
    transition: transform 0.2s;
}
.stat-item:hover {
    transform: translateY(-2px);
}
.stat-item .stat-icon {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary);
    opacity: 0.8;
}
.stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    color: var(--text-main);
}
.stat-item .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* اطلاعات حساب (قابل ویرایش) */
.profile-info-list {
    padding: 0 1.5rem 1rem;
}
.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--card-border);
}
.info-item label {
    font-weight: 600;
    color: var(--text-main);
}
.info-value {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}
.info-value span {
    font-size: 0.9rem;
}
.profile-edit-btn {
    background: rgba(128,128,128,0.15);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}
.profile-edit-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* دکمه‌های پایین */
.profile-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--card-border);
}
.profile-action-btn {
    width: 100%;
    padding: 12px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.profile-action-btn.danger {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.3);
}
.profile-action-btn.danger:hover {
    background: rgba(239,68,68,0.3);
}
/* ========== پنل مدیریت (بازطراحی کامل) ========== */
.admin-panel {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(12px);
    z-index: 30000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}
.admin-panel.hidden { display: none; }

.admin-container {
    width: 100%;
    max-width: 950px;
    max-height: 92vh;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeUp 0.3s ease;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem 0.5rem;
    border-bottom: 1px solid var(--card-border);
}
.admin-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}
.admin-close-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(128,128,128,0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}
.admin-close-btn:hover {
    background: var(--danger);
    color: white;
}

/* کارت‌های آمار */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--card-border);
}
.admin-stats .stat-card {
    background: rgba(128,128,128,0.05);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.2rem 1rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 0;
    position: relative;
    overflow: hidden;
}
.admin-stats .stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
}
.admin-stats .stat-card:nth-child(1)::before { background: #6366f1; }
.admin-stats .stat-card:nth-child(2)::before { background: #f59e0b; }
.admin-stats .stat-card:nth-child(3)::before { background: #10b981; }
.admin-stats .stat-card:nth-child(4)::before { background: #8b5cf6; }
.admin-stats .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.admin-stats .stat-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}
.admin-stats .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.2rem;
}
.admin-stats .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* جستجو */
.admin-search {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--card-border);
}
.admin-search input {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid var(--input-border);
    border-radius: 50px;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(140,82,255,0.2);
}

/* لیست کاربران */
.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 50vh;
}
.user-item {
    background: rgba(0,0,0,0.02);
    backdrop-filter: blur(4px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s, box-shadow 0.2s;
}
.user-item:hover {
    background: rgba(0,0,0,0.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.05);
}
.user-info h4 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}
.user-role-icon {
    font-size: 1.2rem;
}
.role-badge {
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 0.5rem;
}
.role-badge.owner { background: #fbbf24; color: #1e293b; }
.role-badge.admin { background: #3b82f6; color: white; }
.role-badge.user  { background: rgba(255,255,255,0.15); color: white; }
.user-username, .user-joined {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.user-actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}
.user-actions button {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    background: transparent;
    color: var(--text-main);
}
.btn-view-user { border-color: var(--card-border); }
.btn-view-user:hover { background: rgba(59,130,246,0.1); border-color: #3b82f6; color: #3b82f6; }
.btn-change-role { border-color: var(--card-border); color: #8b5cf6; }
.btn-change-role:hover { background: rgba(139,92,246,0.1); border-color: #8b5cf6; }
.btn-delete-user { border-color: var(--danger); color: var(--danger); }
.btn-delete-user:hover { background: var(--danger); color: white; }

/* دکمه‌های پایینی */
.admin-actions {
    padding: 1rem 2rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    gap: 1rem;
    justify-content: center;
}
.admin-actions .btn-primary,
.admin-actions .btn-outline {
    flex: 1;
    padding: 0.8rem 1rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s;
}
.admin-actions .btn-primary {
    background: var(--primary);
    color: white;
    border: none;
}
.admin-actions .btn-primary:hover {
    background: var(--primary-dark);
}
.admin-actions .btn-outline {
    background: transparent;
    border: 2px solid var(--card-border);
    color: var(--text-main);
}
.admin-actions .btn-outline:hover {
    background: rgba(128,128,128,0.1);
}

/* حالت بدون کاربر */
.no-users {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* ========== دیوار عمومی (پاپ‌آپ مدرن) ========== */
.public-feed-page {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    z-index: 25000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}
.public-feed-page.hidden { display: none; }

/* کادر شیشه‌ای اصلی */
.feed-container {
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 36px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
/* اضافه کردن کلاس glass در صورت نبود */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 36px;
}

/* هدر */
.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0.8rem;
}
.feed-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-main);
}
.feed-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(128, 128, 128, 0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}
.feed-close-btn:hover {
    background: var(--danger);
    color: white;
}

/* ناحیه نوشتن پست */
.feed-post-input {
    margin: 0 1.5rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 24px;
    padding: 1rem;
}
.feed-post-input textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 70px;
}
.feed-post-input textarea::placeholder {
    color: var(--text-muted);
}
.post-input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.8rem;
}
.char-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.btn-primary-small {
    background: var(--primary);
    border: none;
    padding: 0.6rem 1.6rem;
    border-radius: 30px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s, transform 0.1s;
}
.btn-primary-small:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* تب‌ها */
.feed-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 0 1.5rem 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}
.feed-tab {
    background: transparent;
    border: 1px solid var(--card-border);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s, color 0.2s;
}
.feed-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.feed-tab:hover:not(.active) {
    background: rgba(128, 128, 128, 0.1);
}

/* لیست پست‌ها */
.feed-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 160px;
}

/* کارت هر پست */
.feed-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 1.2rem;
    transition: background 0.2s, box-shadow 0.2s;
    position: relative;
}
.feed-item:hover {
    background: rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}
.feed-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.feed-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.feed-user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    color: white;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}
.feed-user-details {
    display: flex;
    flex-direction: column;
}
.feed-user-name {
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--text-main);
    transition: color 0.2s;
}
.feed-user-name:hover {
    color: var(--primary);
}
.feed-user-username {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.feed-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.feed-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-main);
    margin: 0.8rem 0 1rem 0;
    padding-right: 58px; /* هم‌تراز با آواتار */
    word-break: break-word;
}
.feed-actions {
    display: flex;
    gap: 0.8rem;
    padding-right: 58px;
}
.feed-like-btn,
.feed-delete-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.feed-like-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: #ef4444;
}
.feed-like-btn.liked {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}
.feed-delete-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: #ef4444;
}

/* فوتر */
.feed-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: center;
}
.btn-outline-small {
    background: transparent;
    border: 1px solid var(--card-border);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}
.btn-outline-small:hover {
    background: rgba(128, 128, 128, 0.1);
}

/* تنظیمات اسکرول */
.feed-list::-webkit-scrollbar { width: 5px; }
.feed-list::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

/* ========== پروفایل عمومی (بازطراحی مدرن) ========== */
.public-profile-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(16px);
    z-index: 30000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}
.public-profile-modal.hidden {
    display: none;
}

.public-profile-container {
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    color: var(--text-main);
    animation: fadeUp 0.3s ease;
}

/* هدر */
.public-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0.5rem;
}
.public-profile-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}
.public-profile-close-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(128,128,128,0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}
.public-profile-close-btn:hover {
    background: var(--danger);
    color: white;
}

/* بخش بالایی: آواتار + اسم */
.public-profile-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem 2rem;
    gap: 1rem;
}
.public-profile-avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.4);
    flex-shrink: 0;
}
.public-profile-names {
    text-align: center;
}
.public-profile-names h3 {
    font-size: 1.4rem;
    margin: 0;
    color: var(--text-main);
}
.public-profile-names span {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}
.public-profile-role-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* رنگ‌های نقش (با inline استایل در JS پر می‌شود) */
.public-profile-role-badge .role-badge-public {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}
/* رنگ‌ها از کلاس‌های قبلی استفاده می‌کنند: .role-badge-public.owner و ... */

/* کارت‌های آمار */
.public-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 0 1.5rem 1.5rem;
}
.public-stat-item {
    background: rgba(128,128,128,0.05);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.2rem 0.5rem;
    text-align: center;
    transition: transform 0.2s;
}
.public-stat-item:hover {
    transform: translateY(-2px);
}
.public-stat-icon {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary);
    opacity: 0.8;
}
.public-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    color: var(--text-main);
}
.public-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* footer */
.public-profile-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--card-border);
    font-size: 0.85rem;
    color: var(--text-muted);
}
/* -------- اعلان‌ها (بازطراحی کامل) ---------- */

/* دکمه زنگوله */
.notification-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.25s, background 0.25s;
    color: #fbbf24;
    font-size: 1.2rem;
}
.notification-btn:hover {
    transform: scale(1.08);
    background: rgba(251, 191, 36, 0.15);
}

/* نشان تعداد */
.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 40px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.6);
    animation: pulseBadge 2s infinite;
}
.notification-badge.hidden { display: none; }

@keyframes pulseBadge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); }
}

/* انیمیشن */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* پنل کشویی اعلان‌ها */
.notification-dropdown {
    position: absolute !important;  /* تغییر از absolute به fixed */
    top: auto 10px !important;
    left: auto !important;
    right: -310px !important;
    bottom: auto !important;
    width: 360px;
    max-width: 85vw;
    max-height: 480px;
    background: rgba(20, 20, 35, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    z-index: 999999 !important;
    display: none !important;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInDown 0.2s ease;
}

/* لایه blur پشت نوتیفیکیشن */
.notification-blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999998;
    display: none;
    animation: fadeIn 0.2s ease;
}

.notification-blur-overlay.show {
    display: block;
}

@media (max-width: 500px) {
    .notification-dropdown {
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 90vw;
    }
}

/* تنظیم کانتینر دکمه نوتیفیکیشن برای position relative */
.notification-container {
    position: relative;
    display: inline-block;
}


.notification-dropdown.show {
    display: flex !important;
}

/* هدر پنل */
.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--card-border);
    background: var(--input-bg);
}
.notification-header span {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.clear-notifications {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 16px;
    border-radius: 40px;
    color: var(--danger);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.clear-notifications:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
    border-color: var(--danger);
}

/* لیست اعلان‌ها */
.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
}
.notification-empty {
    text-align: center;
    padding: 42px 20px;
    opacity: 0.5;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* هر آیتم اعلان */
.notification-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    transition: background 0.2s, transform 0.15s;
    cursor: pointer;
    position: relative;
}
.notification-item:hover {
    background: var(--card-border);
    transform: translateX(-4px);
}
.notification-item.unread {
    background: rgba(16, 185, 129, 0.08);
    border-right: 4px solid #10b981;
}

/* آواتار */
.notification-avatar {
    width: 44px;
    height: 44px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
}

/* محتوا */
.notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.notification-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-main);
    font-weight: 500;
}
.notification-text strong {
    color: #fbbf24;
    font-weight: 700;
}
.notification-time {
    font-size: 0.7rem;
    opacity: 0.5;
    color: var(--text-muted);
}

/* دکمه حذف */
.notification-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notification-item:hover .notification-delete {
    opacity: 1;
}
.notification-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* انیمیشن */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* اسکرول */
.notification-list::-webkit-scrollbar {
    width: 5px;
}
.notification-list::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

/* رسپانسیو */
@media (max-width: 500px) {
    .notification-dropdown {
        width: 310px;
        right: 10px !important;
    }
}

/* -------- چت (طرح Liquid Glass) ---------- */
.chat-page {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(16px);
    z-index: 35000;
    display: flex; justify-content: center; align-items: center;
    padding: 1.5rem;
}
.chat-page.hidden { display: none; }

.chat-container {
    width: 90%; max-width: 1100px; height: 85vh;
    display: flex; flex-direction: row;
    background: var(--card-bg);
    backdrop-filter: blur(35px) saturate(180%);
    -webkit-backdrop-filter: blur(35px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
    position: relative;
    transition: all 0.3s;
}

/* هدر اصلی (عنوان و دکمه بستن) */
.chat-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.8rem;
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    z-index: 10;
    border-radius: 32px 32px 0 0;
}
.chat-header h2 {
    font-size: 1.2rem; font-weight: 700;
    display: flex; align-items: center; gap: 8px;
    color: var(--text-main);
}
.chat-close-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(128,128,128,0.1);
    border: none; cursor: pointer;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.chat-close-btn:hover {
    background: var(--danger); color: white;
}

/* ---------- سایدبار (لیست کاربران) ---------- */
.chat-sidebar {
    width: 300px;
    border-left: 1px solid var(--card-border);
    background: rgba(0,0,0,0.02);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex; flex-direction: column;
    margin-top: 60px; height: 100%;
    flex-shrink: 0;
}
.chat-users-search {
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
}
.chat-users-search input {
    width: 100%; padding: 10px 14px;
    border-radius: 28px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    font-family: inherit; font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.chat-users-search input:focus { border-color: var(--primary); }

.chat-users-list {
    flex: 1; overflow-y: auto; padding: 0.5rem;
}

.chat-user-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 16px;
    cursor: pointer; transition: background 0.2s;
    margin-bottom: 4px;
    background: transparent;
}
.chat-user-item:hover { background: rgba(255,255,255,0.08); }
.chat-user-item.active {
    background: rgba(94, 106, 210, 0.2); /* رنگ ملایم */
    border-right: 3px solid var(--primary);
}

.chat-user-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1rem; color: white;
    background-size: cover; background-position: center;
    position: relative; flex-shrink: 0;
}
.chat-user-online-dot {
    position: absolute; bottom: 0; right: 0;
    width: 12px; height: 12px;
    background: #10b981; border: 2px solid var(--card-bg);
    border-radius: 50%;
}
.chat-user-info { flex: 1; min-width: 0; }
.chat-user-name {
    font-weight: 600; font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-user-username {
    font-size: 0.7rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-user-preview {
    font-size: 0.7rem; color: var(--text-muted);
    margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-user-unread-badge {
    background: #ef4444; color: white;
    font-size: 0.65rem; padding: 2px 7px;
    border-radius: 20px; min-width: 20px; text-align: center;
}

/* ---------- بخش اصلی چت ---------- */
.chat-main {
    flex: 1; display: flex; flex-direction: column;
    margin-top: 60px;
    height: calc(100% - 60px);
    min-width: 0;
}

/* هدر مکالمه */
.chat-conversation-header {
    display: flex; align-items: center;
    padding: 0.8rem 1.5rem;
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
}
.chat-with-info { display: flex; align-items: center; gap: 12px; }
.chat-with-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1rem; color: white;
    background-size: cover; background-position: center;
    flex-shrink: 0;
}
.chat-with-name { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.chat-with-status { font-size: 0.75rem; color: #10b981; margin-top: 2px; }

/* ---------- پیام‌ها ---------- */
.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 1.5rem;
    display: flex; flex-direction: column; gap: 0.8rem;
    background: rgba(0,0,0,0.01);
}
.chat-placeholder {
    text-align: center; padding: 3rem;
    opacity: 0.6; color: var(--text-muted);
}

.chat-message {
    display: flex; flex-direction: column;
    max-width: 75%; position: relative;
    animation: fadeIn 0.3s ease;
}
/* راست‌چین: sent = خودمان = سمت راست (flex-start) */
.chat-message.sent { align-self: flex-start; }
/* دریافتی = سمت چپ (flex-end) */
.chat-message.received { align-self: flex-end; }

.chat-message-bubble {
    padding: 12px 18px;
    border-radius: 24px;
    word-break: break-word;
    font-size: 0.95rem; line-height: 1.6;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    position: relative;
    color: white;
}
.chat-message.sent .chat-message-bubble {
    background: linear-gradient(135deg, var(--primary), #5e6ad2);
    border-bottom-right-radius: 8px;
    margin-left: auto; margin-right: 0;
}
.chat-message.received .chat-message-bubble {
    background: rgba(0,0,0,0.05);
    color: var(--text-main);
    border-bottom-left-radius: 8px;
    margin-right: auto; margin-left: 0;
}

/* دم‌های حباب */
.chat-message.sent .chat-message-bubble::after {
    content: '';
    position: absolute; bottom: 0; right: -8px;
    width: 16px; height: 14px;
    background: #5e6ad2;
    clip-path: polygon(0 0, 0% 100%, 100% 100%);
    border-bottom-right-radius: 2px;
}
.chat-message.received .chat-message-bubble::after {
    content: '';
    position: absolute; bottom: 0; left: -8px;
    width: 16px; height: 14px;
    background: rgba(0,0,0,0.05);
    backdrop-filter: blur(4px);
    clip-path: polygon(100% 0, 0% 100%, 100% 100%);
}

.chat-message-footer {
    display: flex; align-items: center; gap: 6px;
    margin-top: 4px; padding: 0 8px;
}
.chat-message.sent .chat-message-footer { justify-content: flex-start; }
.chat-message.received .chat-message-footer { justify-content: flex-end; }
.chat-message-time {
    font-size: 0.7rem; opacity: 0.7; color: var(--text-muted);
}
.chat-message-delete {
    background: transparent; border: none;
    color: rgba(255,255,255,0.4); cursor: pointer;
    font-size: 0.7rem; padding: 2px 6px; border-radius: 20px;
    opacity: 0; transition: opacity 0.2s;
}
.chat-message:hover .chat-message-delete { opacity: 1; }
.chat-message-delete:hover { background: rgba(239,68,68,0.2); color: #f87171; }

/* ---------- ورودی پیام ---------- */
.chat-input-area {
    display: flex; gap: 10px;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--card-border);
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.chat-input-area textarea {
    flex: 1; padding: 12px 18px;
    border-radius: 28px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-main);
    font-family: inherit; font-size: 0.9rem;
    resize: none; max-height: 100px;
    outline: none; transition: border-color 0.2s;
}
.chat-input-area textarea:focus { border-color: var(--primary); }
.chat-input-area button {
    display: flex; align-items: center; gap: 6px;
    padding: 0 22px; border-radius: 28px;
    background: linear-gradient(135deg, var(--primary), #5e6ad2);
    border: none; color: white; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(94, 106, 210, 0.45);
}
.chat-input-area button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(94, 106, 210, 0.6);
}



/* ---------- جداکننده تاریخ ---------- */
.chat-date-divider {
    text-align: center; font-size: 0.7rem;
    opacity: 0.5; margin: 0.8rem 0;
}
.chat-date-divider span {
    background: rgba(0,0,0,0.4); padding: 4px 14px; border-radius: 30px;
}

/* انیمیشن */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 700px) {
    .chat-sidebar { width: 75px; }
    .chat-user-info, .chat-user-preview, .chat-user-unread-badge { display: none; }
    .chat-user-item { justify-content: center; padding: 10px; }
    .chat-user-avatar { width: 48px; height: 48px; }
}



/* ========== کارت تقویم ========== */
.calendar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.calendar-header {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--text-main);
    text-align: center;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    width: 100%;
    max-width: 280px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 280px;
}

.calendar-day {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(0,0,0,0.02);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: default;
    transition: background 0.2s, transform 0.15s;
    position: relative;
    color: var(--text-main);
}
.calendar-day:hover {
    background: rgba(140, 82, 255, 0.18);
    transform: scale(1.08);
    z-index: 2;
}

.calendar-day.other-month {
    opacity: 0.35;
}

.calendar-day.today {
    background: var(--primary);
    color: white;
    font-weight: 700;
    box-shadow: 0 0 14px rgba(140, 82, 255, 0.5);
}

/* تولتیپ مناسبت */
.calendar-tooltip {
    display: none;
    position: fixed;
    background: rgba(20,20,35,0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 0.8rem;
    color: white;
    white-space: nowrap;
    z-index: 500;
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

/* ====== کارت آب‌وهوا (جدید) ====== */
.weather-card {
    text-align: center;
    padding: 24px;
}

.weather-card h3 {
    margin-bottom: 16px;
}

.weather-current {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.weather-temp {
    font-size: 4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.weather-desc {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin: 8px 0;
}

.weather-range {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 1rem;
    color: var(--text-main);
}

.weather-range span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.weather-forecast {
    border-top: 1px solid var(--card-border);
    padding-top: 16px;
    margin-top: 16px;
}

.forecast-title {
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}

.forecast-list {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.forecast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.forecast-day {
    font-weight: 600;
    margin-bottom: 4px;
}

.forecast-icon {
    font-size: 1.5rem;
    margin: 4px 0;
}

.forecast-temp {
    font-weight: 600;
    color: var(--text-main);
}

.weather-updated {
    margin-top: 16px;
    font-size: 0.7rem;
    opacity: 0.6;
}


/* -------- منوی کلیک راست (هماهنگ با تم) ---------- */
.custom-context {
    position: fixed;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0.5rem 0;
    min-width: 240px;
    z-index: 10001;
    display: none;
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: popIn 0.15s ease;
}
.custom-context.active { display: block; }

.context-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-main);
}
.context-item:hover {
    background: var(--input-bg);   /* پس‌زمینهٔ ملایم روی هاور */
}
.context-item.danger {
    color: var(--danger);
}
.divider {
    height: 1px;
    background: var(--card-border);
    margin: 6px 0;
}

/* ====== Toast حرفه‌ای ====== */
#toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-radius: 16px;
    background: rgba(25, 25, 35, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 280px;
    max-width: 420px;
    position: relative;
    overflow: hidden;
    animation: toastSlideIn 0.35s ease forwards;
    transition: all 0.3s ease;
}

.toast.removing {
    opacity: 0;
    transform: translateX(100%);
}

.toast::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
}

.toast .toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast .toast-icon svg {
    width: 18px;
    height: 18px;
    stroke: white;
    stroke-width: 2.5;
}

.toast .toast-text {
    flex: 1;
    line-height: 1.5;
}

.toast .toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.toast.success .toast-icon { background: #10b981; }
.toast.success::before { background: #10b981; }
.toast.error .toast-icon { background: #ef4444; }
.toast.error::before { background: #ef4444; }
.toast.info .toast-icon { background: #3b82f6; }
.toast.info::before { background: #3b82f6; }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* -------- انیمیشن‌ها ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* -------- واکنش‌گرایی ---------- */
@media (max-width: 850px) {
  .grid { grid-template-columns: 1fr; }
  .navbar { flex-direction: column; align-items: flex-start; }
  .header-left { flex-wrap: wrap; width: 100%; justify-content: flex-start; }
  .chat-sidebar { width: 85px; }
  .chat-user-info { display: none; }
  .chat-user-item { justify-content: center; padding: 10px; }
  .chat-user-avatar { width: 50px; height: 50px; margin: 0 auto; }
  .chat-user-unread-badge { position: absolute; top: -5px; right: -5px; font-size: 0.6rem; padding: 2px 6px; }
  .chat-message { max-width: 90%; }
  .feed-item-header { flex-wrap: wrap; gap: 8px; }
  .feed-content { padding-right: 0; margin-top: 8px; }
  .feed-actions { padding-right: 0; }
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(138, 155, 176, 0.3);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 155, 176, 0.6);
}

/* ========== کارت دیوار عمومی (پیش‌نمایش) ========== */
.public-feed-preview-card {
    grid-column: span 2;  /* کل عرض رو بگیره */
}

.public-feed-preview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0 4px;
}

.feed-preview-item {
    background: rgba(128,128,128,0.05);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 14px 16px;
    transition: all 0.2s;
}

.feed-preview-item:hover {
    background: rgba(128,128,128,0.1);
    transform: translateX(-4px);
}

.feed-preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.feed-preview-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    color: white;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.feed-preview-user {
    flex: 1;
}

.feed-preview-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

.feed-preview-username {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.feed-preview-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.feed-preview-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-main);
    margin: 8px 0 10px 52px;
    word-break: break-word;
}

.feed-preview-like-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 52px;
}

.feed-preview-like-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: #ef4444;
}

.feed-preview-like-btn.liked {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

.feed-preview-loading,
.feed-preview-empty {
    text-align: center;
    padding: 40px;
    opacity: 0.6;
    color: var(--text-muted);
}

.public-feed-preview-list::-webkit-scrollbar {
    width: 4px;
}

.public-feed-preview-list::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

@media (max-width: 850px) {
    .public-feed-preview-card {
        grid-column: span 1;
    }
}

/* Edit Modal */
#editModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    z-index: 100000;
    display: none;
    justify-content: center;
    align-items: center;
}

#editModal.active {
    display: flex;
}

#editModal .modal-box {
    width: 90%;
    max-width: 400px;
    padding: 1.8rem;
    text-align: center;
    border-radius: 32px;
    background: var(--modal-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    animation: fadeUp 0.3s ease;
}

/* استایل دکمه پیوست فایل */
.chat-attach-btn {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.chat-attach-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.05);
}

/* استایل فایل در پیام */
.chat-message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-top: 6px;
}

.chat-message-file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.chat-message-file-info {
    flex: 1;
    min-width: 0;
}

.chat-message-file-name {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-message-file-size {
    font-size: 0.65rem;
    opacity: 0.6;
}

.chat-message-file-download {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-message-file-download:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* پیش‌نمایش عکس در پیام */
.chat-message-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 12px;
    margin-top: 6px;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-message-image:hover {
    transform: scale(1.02);
}

.chat-input-wrapper {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input-wrapper textarea {
    flex: 1;
}

body.modal-open {
    overflow: hidden !important;
    padding-right: 0px; /* جلوگیری از لرزش صفحه */
}
/* ========== مودال‌های اصلی ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    z-index: 100000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-box {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    padding: 1.8rem;
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    color: var(--text-main);
    animation: fadeUp 0.3s ease;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.modal-box h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-box input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 1rem;
    border: 1px solid var(--input-border);
    border-radius: 50px;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
}

.modal-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(140, 82, 255, 0.2);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
}

.modal-buttons button {
    flex: 1;
    padding: 10px;
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
}

.btn-cancel {
    background: rgba(128, 128, 128, 0.2);
    color: var(--text-main);
    transition: background 0.2s;
}

.btn-cancel:hover {
    background: rgba(128, 128, 128, 0.4);
}

/* قفل کردن بدنه هنگام باز بودن مودال */
body.modal-open {
    overflow: hidden !important;
}