/**
 * استایل‌های توییتر لوکال
 * فایل CSS اصلی - ماژولار شده
 */

/* ==================== RESET & VARIABLES ==================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Lights Out - سیاه خالص (AMOLED) - پیش‌فرض */
  --bg: #000000;
  --bg-secondary: #16181c;
  --bg-hover: #1d1f23;
  --text: #e7e9ea;
  --text-secondary: #71767b;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --border: #3e4144;
  --success: #00ba7c;
  --danger: #f4212e;
  --pink: #f91880;
  --primary: #1d9bf0;
  --primary-hover: #1a8cd8;
  --hover: rgba(29, 155, 240, 0.1);
  --font-size: 15px;
  --header-bg: rgba(0, 0, 0, 0.85);
}

/* ==================== THEMES ==================== */

/* تم روشن (دارک مود خاموش) */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-secondary: #f7f9f9;
  --bg-hover: #eff3f4;
  --text: #0f1419;
  --text-secondary: #536471;
  --border: #cfd9de;
  --primary: #1d9bf0;
  --primary-hover: #1a8cd8;
  --hover: rgba(29, 155, 240, 0.1);
  --header-bg: rgba(255, 255, 255, 0.85);
}

/* تم Dim - آبی تیره (Navy) */
[data-theme="dim"] {
  --bg: #15202b;
  --bg-secondary: #192734;
  --bg-hover: #22303c;
  --text: #ffffff;
  --text-secondary: #8899a6;
  --border: #425364;
  --primary: #1d9bf0;
  --primary-hover: #1a8cd8;
  --hover: rgba(29, 155, 240, 0.1);
  --header-bg: rgba(21, 32, 43, 0.85);
}

/* تم Lights Out - سیاه خالص (AMOLED) - پیش‌فرض */
/* این تم در :root تعریف شده */

/* ==================== BASE ==================== */

body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: var(--font-size);
  transition: background 0.3s, color 0.3s;
  overscroll-behavior-y: contain;
}
html {
  overscroll-behavior-y: contain;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: transparent; }
input, textarea { font-family: inherit; outline: none; border: none; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ==================== AUTH SCREENS ==================== */

.auth-container {
  min-height: 100vh;
  display: none; /* مخفی به صورت پیش‌فرض - جلوگیری از flash */
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #000 0%, #0a1628 100%);
}
.auth-container.show {
  display: flex;
}

/* صفحه خالی اولیه - جلوگیری از flash */
.initial-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 9999;
}
.initial-loader.hide {
  display: none;
}

.auth-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
}

.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo svg { width: 48px; height: 48px; fill: var(--text); }
.auth-title { font-size: 28px; font-weight: 800; text-align: center; margin-bottom: 8px; }
.auth-subtitle { color: var(--text-secondary); text-align: center; margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 16px;
  transition: all 0.2s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-secondary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }

.auth-switch { text-align: center; margin-top: 24px; color: var(--text-secondary); }
.auth-switch a { color: var(--accent); }
.auth-switch a:hover { text-decoration: underline; }

.error-msg {
  background: rgba(244, 33, 46, 0.1);
  color: var(--danger);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* ==================== MAIN APP ==================== */

.app { display: none; }
.app.show { display: flex; max-width: 1300px; margin: 0 auto; }

/* ==================== SIDEBAR ==================== */

.sidebar {
  width: 275px;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 12px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.logo {
  padding: 12px;
  width: fit-content;
  border-radius: 50%;
  transition: all 0.2s;
}
.logo:hover { background: rgba(255,255,255,0.1); }
.logo svg { width: 32px; height: 32px; fill: var(--text); }

.nav { margin-top: 8px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px;
  border-radius: 50px;
  transition: all 0.2s;
  font-size: 20px;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.1); }
.nav-item.active { font-weight: 700; }
.nav-item svg { width: 26px; height: 26px; }
.nav-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.post-btn-large {
  width: 90%;
  margin: 16px auto;
  padding: 10px;
  background: var(--accent);
  color: white;
  border-radius: 50px;
  font-size: 17px;
  font-weight: 700;
  transition: all 0.2s;
}
.post-btn-large:hover { background: var(--accent-hover); }

/* انتخاب تم در سایدبار */
.sidebar-theme-selector {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  margin: 4px 12px;
}
.theme-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: all 0.2s;
}
.theme-dot:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-hover);
}
.theme-dot.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.user-menu {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 50px;
  transition: all 0.2s;
  cursor: pointer;
}
.user-menu:hover { background: rgba(255,255,255,0.1); }

/* ==================== AVATAR ==================== */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar.large { width: 48px; height: 48px; font-size: 22px; }
.avatar.xl { width: 120px; height: 120px; font-size: 50px; border: 4px solid var(--bg); }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.user-info { flex: 1; min-width: 0; }
.user-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-handle {
  color: var(--text-secondary);
  font-size: 14px;
  direction: ltr;
  display: inline-block;
}

/* ==================== MAIN CONTENT ==================== */

.main {
  flex: 1;
  max-width: 600px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100vh;
}

.header {
  position: sticky;
  top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  z-index: 10;
  border-bottom: 1px solid var(--border);
}
.header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  height: 53px;
}
.header-title { font-size: 20px; font-weight: 700; color: var(--text); }
.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text);
}
.back-btn:hover { background: var(--bg-hover); }
.back-btn svg { width: 20px; height: 20px; stroke: currentColor; }

.header-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}
.header-icon-btn:hover { background: var(--bg-hover); }

/* ==================== TABS ==================== */

.tabs { display: flex; }
.tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-size: 15px;
  color: var(--text-secondary);
  transition: all 0.2s;
  position: relative;
}
.tab:hover { background: rgba(255,255,255,0.1); }
.tab.active { font-weight: 700; color: var(--text); }
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 4px;
  background: var(--accent);
  border-radius: 4px;
}

/* ==================== COMPOSE ==================== */

.compose { padding: 16px; border-bottom: 1px solid var(--border); }
.compose-inner { display: flex; gap: 12px; }
.compose-input { flex: 1; }
.compose-textarea {
  width: 100%;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  resize: none;
  min-height: 52px;
  max-height: 300px;
}
.compose-textarea::placeholder { color: var(--text-secondary); }

.image-preview { margin-top: 12px; position: relative; display: none; }
.image-preview.show { display: block; }
.image-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--border);
}
.image-preview .remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-preview .remove:hover { background: rgba(0,0,0,0.9); }

.compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.compose-tools { display: flex; gap: 4px; }
.tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.tool-btn:hover { background: rgba(29,155,240,0.1); }
.tool-btn svg { width: 20px; height: 20px; }
.tool-btn input { display: none; }

/* دکمه آپلود عکس */
.image-upload-btn {
  width: auto;
  height: auto;
  border-radius: 20px;
  padding: 8px 14px;
  gap: 6px;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: transparent;
}
.image-upload-btn:hover { background: rgba(29,155,240,0.15); }
.image-upload-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.upload-text { font-size: 14px; font-weight: 500; }

.char-counter { display: none; }
.char-counter.show { display: block; }

.submit-btn {
  padding: 8px 18px;
  background: var(--accent);
  color: white;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s;
}
.submit-btn:hover:not(:disabled) { background: var(--accent-hover); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== TWEET ==================== */

.tweet {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.tweet:hover { background: rgba(255,255,255,0.03); }
.tweet-inner { display: flex; gap: 12px; }
.tweet-content { flex: 1; min-width: 0; }
.tweet-header { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tweet-name { font-weight: 700; font-size: 15px; }
.tweet-name:hover { text-decoration: underline; }
.verified { width: 18px; height: 18px; }
.verified.blue { fill: #1d9bf0; }
.verified.gold { fill: #e4a72f; }
.verified.gray { fill: #829aab; }
.verified.black { fill: #000000; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.tweet-handle { color: var(--text-secondary); font-size: 15px; direction: ltr; }
.tweet-time { color: var(--text-secondary); font-size: 13px; }

/* منوی سه نقطه توییت */
.tweet-more-wrapper {
  position: relative;
  margin-right: auto;
  margin-left: 0;
}
.tweet-more-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.tweet-more-btn:hover {
  background: rgba(29,155,240,0.1);
  color: var(--accent);
}
.tweet-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
  min-width: 260px;
  z-index: 100;
  overflow: hidden;
}
.tweet-menu.show {
  display: block;
}
.tweet-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text);
  text-align: right;
  transition: background 0.15s;
}
.tweet-menu button:hover {
  background: var(--bg-secondary);
}
.tweet-menu button svg {
  flex-shrink: 0;
}
.tweet-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.tweet-text {
  margin-top: 4px;
  font-size: 16px;
  line-height: 20px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.tweet-text .hashtag, .tweet-text .mention { color: var(--accent); cursor: pointer; }
.tweet-text .hashtag:hover, .tweet-text .mention:hover { text-decoration: underline; }
.show-more-btn {
  display: block;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0 0;
  font-weight: 500;
}
.show-more-btn:hover { text-decoration: underline; }

.tweet-image { margin-top: 12px; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; }
.tweet-image img { width: 100%; max-height: 510px; object-fit: cover; }
.tweet-image:hover { opacity: 0.9; }

.tweet-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; max-width: 400px; flex-wrap: nowrap; }
.action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  outline: none;
  position: relative;
}
.action-btn .icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.action-btn svg { width: 18px; height: 18px; }

.action-btn.reply:hover { color: var(--accent); }
.action-btn.reply:hover .icon { background: rgba(29,155,240,0.1); }
.action-btn.retweet:hover, .action-btn.retweet.active { color: var(--success); }
.action-btn.retweet:hover .icon, .action-btn.retweet.active .icon { background: rgba(0,186,124,0.1); }
.action-btn.like:hover, .action-btn.like.active { color: var(--pink); }
.action-btn.like:hover .icon, .action-btn.like.active .icon { background: rgba(249,24,128,0.1); }
.action-btn.like.active svg { fill: var(--pink); }

/* انیمیشن لایک شبیه X */
@keyframes likeHeartPop {
  0% { transform: scale(1); }
  15% { transform: scale(1.35); }
  30% { transform: scale(0.9); }
  45% { transform: scale(1.15); }
  60% { transform: scale(0.95); }
  75% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.action-btn.like.animating .icon {
  animation: likeHeartPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.action-btn.bookmark:hover, .action-btn.bookmark.active { color: var(--accent); }
.action-btn.bookmark:hover .icon, .action-btn.bookmark.active .icon { background: rgba(29,155,240,0.1); }
.action-btn.bookmark.active svg { fill: var(--accent); }

/* دکمه پین نظر */
.action-btn.pin:hover, .action-btn.pin.active { color: var(--accent); }
.action-btn.pin:hover .icon, .action-btn.pin.active .icon { background: rgba(29,155,240,0.1); }
.action-btn.pin.active svg { fill: var(--accent); }

/* نشان پین شده */
.pinned-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 8px 16px 0 16px;
  margin-right: 52px;
}
.pinned-badge svg {
  color: var(--accent);
}

/* استایل نظر پین شده */
.tweet.pinned-reply {
  border-right: 3px solid var(--accent);
  background: rgba(29, 155, 240, 0.05);
}

.action-group { display: flex; align-items: center; gap: 4px; }

/* پیام محدودیت بحث امروز */
.discussion-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
}
.discussion-notice svg {
  flex-shrink: 0;
}

/* ==================== RIGHT SIDEBAR ==================== */

.sidebar-right {
  width: 350px;
  padding: 12px 24px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}

.search-box { position: relative; margin-bottom: 16px; }
.search-box input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: 50px;
  padding: 12px 44px 12px 16px;
  color: var(--text);
  font-size: 15px;
  transition: all 0.2s;
  text-align: right;
}
.search-box input:focus { background: transparent; border-color: var(--accent); }
.search-box svg {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  pointer-events: none;
}

.card { background: var(--bg-secondary); border-radius: 16px; margin-bottom: 16px; overflow: hidden; }
.card-title { font-size: 20px; font-weight: 800; padding: 12px 16px; }

.trend-item { padding: 12px 16px; transition: all 0.2s; cursor: pointer; }
.trend-item:hover { background: rgba(255,255,255,0.03); }
.trend-category { font-size: 13px; color: var(--text-secondary); }
.trend-name { font-weight: 700; font-size: 15px; margin: 4px 0; }
.trend-count { font-size: 13px; color: var(--text-secondary); }

.follow-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; transition: all 0.2s; }
.follow-item:hover { background: rgba(255,255,255,0.03); }
.follow-info { flex: 1; min-width: 0; }
.follow-btn {
  padding: 4px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s;
}
.follow-btn:hover { opacity: 0.9; }
.follow-btn.following { background: transparent; color: var(--text); border: 1px solid var(--border); }
.follow-btn.following:hover { border-color: var(--danger); color: var(--danger); }

/* صفحه لیست فالوورها/فالووینگ */
.follow-list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
}
.follow-list-item:hover { background: rgba(255,255,255,0.03); }
.follow-list-info { flex: 1; min-width: 0; }
.follow-list-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 4px; }
.follow-list-handle { color: var(--text-secondary); font-size: 14px; }
.follow-list-bio { color: var(--text-secondary); font-size: 14px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.follow-btn-small {
  padding: 6px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.follow-btn-small:hover { opacity: 0.9; }
.follow-btn-small.following {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.follow-btn-small.following:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* هدر با اطلاعات کاربر */
.header-user-info {
  display: flex;
  flex-direction: column;
  margin-right: 8px;
}
.header-user-info .header-title {
  font-size: 18px;
  margin: 0;
}
.header-user-info .header-handle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.show-more { padding: 16px; color: var(--accent); font-size: 15px; display: block; transition: all 0.2s; }
.show-more:hover { background: rgba(255,255,255,0.03); }

/* ==================== PROFILE ==================== */

.profile-header {
  background: linear-gradient(135deg, var(--accent), #7c4dff);
  height: 200px;
  position: relative;
  overflow: hidden;
}
.profile-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-info { padding: 12px 16px; position: relative; }

/* ویرایش کاور در مودال */
.edit-cover-container {
  height: 150px;
  background: linear-gradient(135deg, var(--accent), #7c4dff);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.edit-cover-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.edit-cover-container img.show {
  display: block;
}
.edit-cover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s;
}
.edit-cover-container:hover .edit-cover-overlay {
  opacity: 1;
}
.profile-avatar { position: absolute; top: -60px; }
.profile-actions { display: flex; justify-content: flex-end; margin-bottom: 40px; }
.edit-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-weight: 700;
  color: var(--text);
  transition: all 0.2s;
}
.edit-btn:hover { background: rgba(255,255,255,0.1); }

/* دکمه خروج از حساب */
.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--danger);
  border-radius: 50px;
  font-weight: 700;
  color: var(--danger);
  transition: all 0.2s;
}
.logout-btn:hover {
  background: rgba(244, 33, 46, 0.1);
}

/* دکمه و منوی more در پروفایل */
.profile-actions { position: relative; gap: 8px; }
.more-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.more-btn:hover { background: rgba(255,255,255,0.1); }
.profile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(255,255,255,0.1);
  overflow: hidden;
  z-index: 100;
  min-width: 180px;
}
.profile-menu.show { display: block; }
.profile-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  text-align: right;
}
.profile-menu button:hover { background: var(--bg-hover); }
.profile-menu button.danger { color: var(--danger); }
.profile-menu button.active { color: var(--accent); }

/* Retweet Menu */
.retweet-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 50%;
  transform: translateX(50%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(255,255,255,0.1);
  z-index: 100;
  min-width: 140px;
  margin-bottom: 8px;
}
.retweet-menu.show { display: block; }
.retweet-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: right;
  white-space: nowrap;
}
.retweet-menu button:hover { background: var(--bg-hover); }
.retweet-menu button.active { color: var(--success); }
.retweet-menu button svg { flex-shrink: 0; }

/* Retweet Wrapper */
.retweet-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 10;
}
.retweet-wrapper .retweet-menu {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
}

/* Quote Tweet Preview */
.quote-preview {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.quote-tweet {
  padding: 12px;
  background: var(--bg-hover);
}
.quote-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.quote-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.quote-handle {
  font-size: 13px;
  color: var(--text-secondary);
  direction: ltr;
}
.quote-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quoted Tweet in Timeline */
.quoted-tweet {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.quoted-tweet:hover {
  background: var(--bg-hover);
}
.quote-image {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  max-height: 150px;
}
.quote-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
  max-height: 150px;
}

.profile-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 4px; }
.profile-handle { color: var(--text-secondary); font-size: 15px; direction: ltr; display: inline-block; }
.profile-bio { margin: 12px 0; font-size: 15px; line-height: 1.5; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }
.meta-item { display: flex; align-items: center; gap: 4px; }
.meta-item svg { color: var(--text-secondary); flex-shrink: 0; }
.meta-item a { color: var(--accent); text-decoration: none; }
.meta-item a:hover { text-decoration: underline; }
.profile-stats { display: flex; gap: 20px; font-size: 15px; }
.profile-stats span { color: var(--text-secondary); }
.profile-stats strong { color: var(--text); }

/* ==================== NOTIFICATIONS ==================== */

.notification-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
}
.notification-item:hover { background: rgba(255,255,255,0.03); }
.notification-item.unread { background: rgba(29,155,240,0.05); }
.notification-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notification-icon.like { background: rgba(249,24,128,0.1); color: var(--pink); }
.notification-icon.retweet { background: rgba(0,186,124,0.1); color: var(--success); }
.notification-icon.follow { background: rgba(29,155,240,0.1); color: var(--accent); }
.notification-icon.mention { background: rgba(124,77,255,0.1); color: #7c4dff; }
.notification-icon svg { width: 20px; height: 20px; }
.notification-text { font-size: 15px; }
.notification-preview {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.4;
}
.notification-time { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ==================== LOADING & EMPTY ==================== */

.loading { display: flex; justify-content: center; padding: 32px; }
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 48px 24px; color: var(--text-secondary); }
.empty svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }

/* ==================== TOAST ==================== */

.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ==================== MODAL ==================== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(91,112,131,0.4);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  overflow-y: auto;
}
.modal.show { display: flex; }
.modal-content {
  background: var(--bg);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  height: 53px;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  background: rgba(255,255,255,0.1);
  color: var(--text);
}
.modal-close:hover { background: rgba(255,255,255,0.2); }
.modal-close svg { stroke: var(--text); }
.modal-title { font-size: 20px; font-weight: 700; }
.modal-body { padding: 16px; max-height: 70vh; overflow-y: auto; }

/* ==================== IMAGE MODAL ==================== */

.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 2000;
  display: none;
  flex-direction: column;
}
.image-modal.show { display: flex; }
.image-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.5);
}
.image-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s;
  cursor: pointer;
}
.image-modal-close:hover { background: rgba(255,255,255,0.2); }
.image-modal-download {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s;
  cursor: pointer;
}
.image-modal-download:hover { background: var(--accent-hover); }
.image-modal-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}
.image-modal-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

/* ==================== NESTED REPLIES ==================== */

.nested-replies { position: relative; }

.reply-level-1, .reply-level-2, .reply-level-3,
.reply-level-4, .reply-level-5, .reply-level-6 {
  position: relative;
}
.reply-level-1::before, .reply-level-2::before, .reply-level-3::before,
.reply-level-4::before, .reply-level-5::before, .reply-level-6::before {
  content: '';
  position: absolute;
  right: -20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.reply-level-1::after, .reply-level-2::after, .reply-level-3::after,
.reply-level-4::after, .reply-level-5::after, .reply-level-6::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 36px;
  width: 20px;
  height: 2px;
  background: var(--border);
}

.reply-level-1 { margin-right: 24px; }
.reply-level-2 { margin-right: 24px; }
.reply-level-3 { margin-right: 24px; }
.reply-level-4 { margin-right: 24px; }
.reply-level-5 { margin-right: 24px; }
.reply-level-6 { margin-right: 24px; }

#tweetReplies .avatar { position: relative; z-index: 2; }

/* ==================== TWEET DETAIL PAGE (مثل X) ==================== */

/* کارت اصلی توییت */
.tweet-detail-card {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

/* هدر نویسنده */
.tweet-detail-author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tweet-detail-author .avatar {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
}

.tweet-detail-author .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tweet-detail-author-info {
  flex: 1;
  min-width: 0;
}

.tweet-detail-author-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  width: fit-content;
}

.tweet-detail-author-handle {
  font-size: 14px;
  color: var(--text-secondary);
  direction: ltr;
  text-align: right;
  cursor: pointer;
  width: fit-content;
}

.tweet-detail-follow-btn {
  padding: 2px 12px;
  border-radius: 20px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.tweet-detail-follow-btn:hover {
  opacity: 0.9;
}

.tweet-detail-follow-btn.following {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.tweet-detail-more {
  padding: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.tweet-detail-more:hover {
  background: var(--bg-hover);
}

/* محتوای توییت */
.tweet-detail-content {
  font-size: 16px;
  line-height: 20px;
  color: var(--text);
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.tweet-detail-content a {
  color: var(--primary);
  text-decoration: none;
}

.tweet-detail-content a:hover {
  text-decoration: underline;
}

/* تصویر توییت */
.tweet-detail-image {
  margin-bottom: 12px;
  border-radius: 16px;
  overflow: hidden;
}

.tweet-detail-image img {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
}

/* نقل قول در دیتیل */
.tweet-detail-quote {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.tweet-detail-quote:hover {
  background: var(--bg-hover);
}

/* لینک ترجمه */
.tweet-detail-translate {
  color: var(--primary);
  font-size: 14px;
  margin-bottom: 12px;
  cursor: pointer;
}

.tweet-detail-translate:hover {
  text-decoration: underline;
}

/* آمار - زمان و تاریخ و بازدید */
.tweet-detail-time-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 12px 0;
  border-top: 1px solid var(--border);
  direction: ltr;
  justify-content: flex-end;
}

.tweet-detail-time-row .views-count {
  color: var(--text);
  font-weight: 700;
}

/* آمار - ردیف‌های engagement */
.tweet-detail-engagement-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.tweet-detail-stat {
  cursor: pointer;
}

.tweet-detail-stat:hover {
  text-decoration: underline;
}

.tweet-detail-stat .count {
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
}

/* دکمه‌های اکشن */
.tweet-detail-actions {
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.tweet-detail-actions .action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.tweet-detail-actions .action-btn:hover {
  background: var(--bg-hover);
}

.tweet-detail-actions .action-btn.reply:hover {
  color: var(--primary);
  background: rgba(29, 161, 242, 0.1);
}

.tweet-detail-actions .action-btn.retweet:hover,
.tweet-detail-actions .action-btn.retweet.active {
  color: #00ba7c;
  background: rgba(0, 186, 124, 0.1);
}

.tweet-detail-actions .action-btn.like:hover,
.tweet-detail-actions .action-btn.like.active {
  color: #f91880;
  background: rgba(249, 24, 128, 0.1);
}

.tweet-detail-actions .action-btn.bookmark:hover,
.tweet-detail-actions .action-btn.bookmark.active {
  color: var(--primary);
  background: rgba(29, 161, 242, 0.1);
}

.tweet-detail-actions .action-btn.share:hover {
  color: var(--primary);
  background: rgba(29, 161, 242, 0.1);
}

.tweet-detail-actions .action-btn svg {
  width: 22px;
  height: 22px;
}

/* استایل کشویی برای نظرات فرعی */
.nested-replies-container {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease-out;
}
.nested-replies-container.expanded {
  max-height: 5000px;
  transition: max-height 0.5s ease-in;
}
.nested-replies-loading {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
}

.expandable-reply[onclick] { cursor: pointer; }
.expandable-reply[onclick]:hover { background: var(--bg-hover); }
.nested-replies-container .action-btn.reply span:last-child { display: none; }

/* ==================== REPORT DIALOG ==================== */
.report-reason-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  text-align: right;
}
.report-reason-item:last-child { border-bottom: none; }
.report-reason-item:hover { background: var(--bg-hover); }
.report-reason-icon { font-size: 20px; flex-shrink: 0; }

/* ==================== COMPOSE FULLSCREEN ==================== */

.compose-fullscreen {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  flex-direction: column;
}
.compose-fullscreen.show {
  display: flex;
}

.compose-fs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 53px;
}

.compose-fs-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.2s;
}
.compose-fs-close:hover { background: var(--bg-hover); }

.compose-fs-submit {
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 20px;
  border-radius: 9999px;
  transition: background 0.2s;
}
.compose-fs-submit:hover { background: var(--accent-hover); }

.compose-fs-body {
  flex: 1;
  display: flex;
  padding: 16px;
  padding-bottom: 100px;
  gap: 12px;
  align-items: flex-start;
  overflow-y: auto;
}

.compose-fs-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
.compose-fs-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compose-fs-textarea {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  font-family: inherit;
  resize: none;
  min-height: 60vh;
  outline: none;
}
.compose-fs-textarea::placeholder {
  color: var(--text-secondary);
}

.compose-fullscreen .image-preview {
  margin: 0 16px 100px 72px;
}

.compose-fs-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  background: var(--bg);
  z-index: 301;
}

.compose-fs-reply-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.compose-fs-tools {
  display: flex;
  gap: 8px;
}

.compose-fs-tool {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.compose-fs-tool:hover { background: rgba(29, 155, 240, 0.1); }
.compose-fs-tool input { display: none; }

/* Mobile optimization for compose fullscreen (quote tweet) */
@media (max-width: 768px) {
  .compose-fs-body {
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 16px;
  }
  .compose-fs-textarea {
    font-size: 16px;
    min-height: 100px;
  }
  .quote-preview {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}

/* ==================== BOTTOM SHEET (MOBILE RETWEET MENU) ==================== */
.retweet-bottom-sheet-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
}
.retweet-bottom-sheet-overlay.show { display: block; }

.retweet-bottom-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  z-index: 1000;
  padding: 12px 0;
  padding-bottom: env(safe-area-inset-bottom, 12px);
  animation: slideUpSheet 0.3s ease;
}
.retweet-bottom-sheet.show { display: block; }

.retweet-bottom-sheet button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  text-align: right;
}
.retweet-bottom-sheet button:hover { background: var(--bg-hover); }
.retweet-bottom-sheet button svg { flex-shrink: 0; width: 20px; height: 20px; }

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Desktop: hide bottom sheet */
@media (min-width: 769px) {
  .retweet-bottom-sheet, .retweet-bottom-sheet-overlay { display: none !important; }
}
/* Mobile: hide dropdown retweet menu */
@media (max-width: 768px) {
  .retweet-menu { display: none !important; }
  .retweet-menu.show { display: none !important; }
}

/* ==================== SHARE SHEET ==================== */
.share-bottom-sheet-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
}
.share-bottom-sheet-overlay.show { display: block; }

.share-bottom-sheet {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  z-index: 1002;
  padding: 0 0 env(safe-area-inset-bottom, 12px) 0;
  animation: slideUpSheet 0.3s ease;
  max-height: 70vh;
  overflow-y: auto;
}
.share-bottom-sheet.show { display: block; }

.share-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.share-sheet-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.share-sheet-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px 12px;
}
.share-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  cursor: pointer;
  border-radius: 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 12px;
  text-decoration: none;
}
.share-sheet-item:hover {
  background: var(--bg-hover);
}
.share-sheet-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.share-sheet-icon.whatsapp { background: #25D366; color: #fff; }
.share-sheet-icon.telegram { background: #0088cc; color: #fff; }
.share-sheet-icon.twitter { background: #000; color: #fff; }
.share-sheet-icon.email { background: #EA4335; color: #fff; }
.share-sheet-icon.sms { background: #4CAF50; color: #fff; }
.share-sheet-icon.linkedin { background: #0077B5; color: #fff; }
.share-sheet-icon.facebook { background: #1877F2; color: #fff; }
.share-sheet-icon.copy-link { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }

.share-sheet-copy {
  padding: 8px 16px 16px;
  border-top: 1px solid var(--border);
}
.share-sheet-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 4px 4px 4px 12px;
  direction: ltr;
}
.share-sheet-link-box input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.share-sheet-link-box button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.share-sheet-link-box button:hover {
  opacity: 0.9;
}

/* Desktop: share sheet centered modal */
@media (min-width: 769px) {
  .share-bottom-sheet {
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    right: auto;
    width: 400px;
    border-radius: 16px;
    max-height: 80vh;
    animation: fadeInScale 0.2s ease;
  }
  .share-bottom-sheet.show {
    display: block;
  }
}
@keyframes fadeInScale {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ==================== SETTINGS ==================== */

.settings-section { margin-bottom: 24px; }
.settings-title { font-size: 14px; font-weight: 700; color: var(--text-secondary); margin-bottom: 12px; }

/* تاگل دارک مود */
.dark-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.dark-mode-info { display: flex; align-items: center; gap: 12px; }
.dark-mode-icon { font-size: 24px; }
.dark-mode-text h4 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.dark-mode-text p { font-size: 13px; color: var(--text-secondary); }
.dark-mode-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
}
.dark-mode-status span { color: var(--accent); font-weight: 600; }

/* سوئیچ تاگل */
.toggle-switch {
  position: relative;
  width: 50px;
  height: 28px;
  cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 28px;
  transition: all 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  top: 3px;
  right: 3px;
  transition: all 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(-22px); }

/* انتخاب تم دارک */
.dark-theme-options {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  transition: opacity 0.3s, max-height 0.3s;
}
.dark-theme-options.hidden {
  opacity: 0.3;
  pointer-events: none;
}
.dark-theme-option {
  flex: 1;
  cursor: pointer;
  text-align: center;
  padding: 16px 12px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s;
}
.dark-theme-option:hover { border-color: var(--text-secondary); }
.dark-theme-option.active { border-color: var(--accent); background: rgba(29, 155, 240, 0.1); }
.dark-theme-option input { display: none; }
.dark-theme-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dark-theme-icon.dim { background: #15202b; border: 1px solid #38444d; }
.dark-theme-icon.lights-out { background: #000000; border: 1px solid #2f3336; }
.dark-theme-icon svg { width: 24px; height: 24px; }
.dark-theme-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.dark-theme-desc { font-size: 12px; color: var(--text-secondary); }
.dark-theme-check {
  display: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  margin: 8px auto 0;
  align-items: center;
  justify-content: center;
  color: white;
}
.dark-theme-option.active .dark-theme-check { display: flex; }

/* ==================== MOBILE DRAWER ==================== */

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.drawer-overlay.show {
  display: block;
  opacity: 1;
}

.mobile-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg);
  z-index: 201;
  transition: left 0.3s ease;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}
.mobile-drawer.show {
  left: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}
.drawer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  overflow: hidden;
}
.drawer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.drawer-more {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.2s;
}
.drawer-more:hover { background: var(--bg-hover); }

.drawer-user {
  padding: 0 16px;
  cursor: pointer;
}
.drawer-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}
.drawer-handle {
  font-size: 14px;
  color: var(--text-secondary);
  direction: ltr;
  display: inline-block;
}

.drawer-stats {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
}
.drawer-stats a {
  font-size: 14px;
  color: var(--text-secondary);
}
.drawer-stats strong {
  color: var(--text);
  font-weight: 700;
  margin-left: 4px;
}

.drawer-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.drawer-menu {
  padding: 8px 0;
}
.drawer-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  transition: background 0.2s;
}
.drawer-item:hover { background: var(--bg-hover); }
.drawer-item svg { flex-shrink: 0; }

.drawer-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}
.drawer-theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.2s;
}
.drawer-theme-btn:hover { background: var(--bg-hover); }

/* نمایش فقط در موبایل */
@media (max-width: 768px) {
  .mobile-drawer { display: flex; }
}

/* ==================== MOBILE HEADER (مثل X) ==================== */

.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 99;
  background: var(--bg);
  padding: 10px 16px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  direction: ltr; /* برای کنترل دقیق ترتیب آیتم‌ها */
  transition: transform 0.3s ease;
}
.mobile-header.hidden {
  transform: translateY(-100%);
}

.mobile-header-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-secondary);
}
.mobile-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mobile-header-search {
  flex: 1;
  position: relative;
}
.mobile-header-search input {
  width: 100%;
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.mobile-header-search input::placeholder {
  color: var(--text-secondary);
}

.mobile-header-settings {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}
.mobile-header-settings:hover {
  background: var(--bg-hover);
}

/* لوگوی X در هدر موبایل */
.mobile-header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.mobile-header-logo svg {
  fill: var(--text);
}

/* کلاس‌های visibility برای تغییر داینامیک */
.mobile-header-logo.hidden { display: none; }
.mobile-header-search.hidden { display: none; }

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }
  /* مخفی کردن سرچ داخل صفحه explore در موبایل (چون هدر موبایل سرچ داره) */
  .explore-search-wrapper {
    display: none;
  }
}

/* ==================== PULL TO REFRESH (مثل X) ==================== */

.ptr-container {
  position: fixed;
  top: 115px; /* زیر هدر موبایل و تب‌ها */
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ptr-container.pulling {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ptr-container.refreshing {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 768px) {
  .ptr-container {
    top: 60px; /* در دسکتاپ فقط زیر تب‌ها */
  }
}

.ptr-spinner {
  width: 36px;
  height: 36px;
  background: var(--bg);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5) rotate(0deg);
  transition: opacity 0.2s, transform 0.2s;
}

.ptr-spinner svg {
  width: 22px;
  height: 22px;
}

.ptr-container.pulling .ptr-spinner {
  opacity: 1;
  transform: scale(1) rotate(var(--ptr-rotation, 0deg));
}

.ptr-container.refreshing .ptr-spinner {
  opacity: 1;
  transform: scale(1);
  animation: ptr-spin 0.8s linear infinite;
}

.ptr-icon {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

@keyframes ptr-spin {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1) rotate(360deg); }
}

/* ==================== MOBILE NAVIGATION ==================== */

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 0;
  padding-bottom: env(safe-area-inset-bottom, 8px);
  transition: transform 0.3s ease;
}
.mobile-nav.hidden {
  transform: translateY(100%);
}
.mobile-nav-inner { display: flex; justify-content: space-around; align-items: center; }
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  color: var(--text-secondary);
  position: relative;
}
.mobile-nav-item.active { color: var(--text); }
.mobile-nav-item svg { width: 26px; height: 26px; }
.mobile-nav-badge {
  position: absolute;
  top: 2px;
  right: 8px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

.mobile-fab {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(29, 155, 240, 0.4);
  z-index: 99;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.mobile-fab svg { width: 24px; height: 24px; fill: white; }
.mobile-fab.hidden { transform: translateY(100px); opacity: 0; pointer-events: none; }

/* ==================== PAGES ==================== */

.page { display: none; position: relative; }
.page.active { display: block; }

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1280px) {
  .sidebar-right { display: none; }
}

@media (max-width: 1024px) {
  .sidebar { width: 88px; }
  .nav-item span, .user-info, .post-btn-large span { display: none; }
  .sidebar-theme-selector { margin: 4px auto; gap: 4px; }
  .nav-item { justify-content: center; }
  .post-btn-large { width: 50px; height: 50px; padding: 0; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { max-width: 100%; border: none; }
  .mobile-nav { display: block; }
  .mobile-fab { display: flex; }
  .app { padding-bottom: 70px; }

  .header { position: sticky; top: 0; }
  .header-top { padding: 0 12px; }
  .header-title { font-size: 18px; }

  .tweet { padding: 12px; }
  .tweet-actions { max-width: 100%; }

  .compose { padding: 12px; }
  .compose-textarea { font-size: 16px; }

  .profile-header { height: 150px; }
  .avatar.xl { width: 80px; height: 80px; font-size: 32px; }
  .profile-avatar { top: -40px; }
  .profile-actions { margin-bottom: 30px; }
  .profile-name { font-size: 18px; }
  .profile-stats { gap: 16px; font-size: 14px; }

  .modal { padding-top: 0; align-items: flex-end; }
  .modal-content { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 95vh; }

  .tab { padding: 12px 8px; font-size: 14px; }

  .auth-box { margin: 16px; padding: 24px; }
  .auth-title { font-size: 24px; }
}

@media (max-width: 480px) {
  .tweet-text { font-size: 15px; line-height: 20px; }
  .tweet-name { font-size: 15px; }
  .tweet-handle { font-size: 15px; }
  .tweet-time { font-size: 13px; }
  .action-btn { font-size: 13px; }
  .action-btn .icon { width: 30px; height: 30px; }
  .avatar { width: 36px; height: 36px; font-size: 16px; }
  .avatar.large { width: 40px; height: 40px; font-size: 18px; }
}

/* ==================== مقالات ==================== */

/* صفحه لیست مقالات */
.articles-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.articles-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.btn-write-article {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-write-article:hover {
  background: var(--primary-hover);
}

.articles-list {
  padding: 0;
}

/* کارت مقاله */
.article-card {
  display: block;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
}

.article-card:hover {
  background: var(--hover);
}

/* نشانه بازنشر مقاله */
.repost-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.repost-indicator svg {
  color: var(--success);
}

.article-card-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
  background: var(--border);
}

.article-card-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--text);
  line-height: 1.4;
}

.article-card-preview {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.article-card-author {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-card-author .avatar {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.article-card-stats {
  display: flex;
  gap: 16px;
  margin-right: auto;
}

.article-card-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* صفحه جزئیات مقاله */
.article-detail {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

.article-detail-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 24px;
}

.article-detail-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 16px 0;
  line-height: 1.3;
}

.article-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.article-detail-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.article-detail-author-info {
  display: flex;
  flex-direction: column;
}

.article-detail-author-name {
  font-weight: 600;
  color: var(--text);
}

.article-detail-date {
  font-size: 14px;
  color: var(--text-secondary);
}

.article-detail-content {
  line-height: 1.8;
  font-size: 17px;
  text-align: justify;
  word-break: break-word;
}

.article-detail-actions {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

/* ==================== ادیتور مقاله ==================== */

.article-editor-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

/* آپلود کاور */
.article-cover-section {
  margin-bottom: 24px;
}

.article-cover-upload {
  position: relative;
  width: 100%;
  height: 200px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-secondary);
  overflow: hidden;
}

.article-cover-upload:hover {
  border-color: var(--primary);
  background: var(--hover);
}

.article-cover-upload.has-image {
  border-style: solid;
}

.article-cover-upload .cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.article-cover-upload .cover-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.5;
}

.article-cover-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-cover-remove {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* اینپوت عنوان */
.article-title-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 32px;
  font-weight: 700;
  padding: 16px 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
}

.article-title-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* ادیتور بلوکی */
.block-editor {
  min-height: 400px;
  padding: 16px 0;
}

.editor-block {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
  padding: 4px 0;
  border-radius: 4px;
}

.editor-block:hover .block-handle {
  opacity: 1;
}

.editor-block.dragging {
  opacity: 0.5;
}

.editor-block.drag-over {
  border-top: 2px solid var(--primary);
}

.block-handle {
  opacity: 0;
  cursor: grab;
  padding: 4px;
  color: var(--text-secondary);
  transition: opacity 0.2s;
  flex-shrink: 0;
  margin-top: 2px;
}

.block-handle:hover {
  color: var(--text);
}

.block-handle svg {
  width: 18px;
  height: 18px;
}

.block-content {
  flex: 1;
  min-width: 0;
  outline: none;
  word-break: break-word;
}

.block-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  opacity: 0.6;
  pointer-events: none;
}

.block-content:focus:empty::before {
  content: "برای منوی دستورات / را تایپ کنید...";
}

/* انواع بلاک */
.block-heading {
  font-weight: 700;
  line-height: 1.3;
}

.block-h1 .block-content {
  font-size: 28px;
  margin: 20px 0 12px 0;
}

.block-h2 .block-content {
  font-size: 24px;
  margin: 16px 0 10px 0;
}

.block-h3 .block-content {
  font-size: 20px;
  margin: 12px 0 8px 0;
}

.block-paragraph .block-content {
  font-size: 16px;
  line-height: 1.7;
}

/* بلاک تصویر */
.block-image {
  flex-direction: column;
}

.block-image-container {
  width: 100%;
  position: relative;
}

.block-image-upload {
  width: 100%;
  padding: 40px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-secondary);
}

.block-image-upload:hover {
  border-color: var(--primary);
  background: var(--hover);
}

.block-image-upload svg {
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
}

.block-image-preview {
  width: 100%;
  border-radius: 8px;
}

.block-image-caption {
  width: 100%;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 8px;
  border: none;
  outline: none;
  background: transparent;
}

.block-image-caption:empty::before {
  content: "کپشن تصویر...";
  opacity: 0.6;
}

/* بلاک کد */
.block-code .block-content {
  font-family: 'Courier New', monospace;
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* بلاک جداکننده */
.block-divider {
  padding: 16px 0;
}

.block-divider hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 0;
}

/* بلاک لیست */
.block-list .block-content {
  padding-right: 24px;
}

.block-list.bullet .block-content::before {
  content: "•";
  position: absolute;
  right: 28px;
  color: var(--text-secondary);
}

.block-list.numbered .block-content::before {
  content: attr(data-number) ".";
  position: absolute;
  right: 28px;
  color: var(--text-secondary);
}

/* ==================== منوی اسلش ==================== */

.slash-menu {
  position: absolute;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  min-width: 280px;
  max-height: 350px;
  overflow-y: auto;
  z-index: 1000;
}

.slash-menu-header {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.slash-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.slash-menu-item:hover,
.slash-menu-item.selected {
  background: var(--bg-hover);
}

.slash-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.slash-icon svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.slash-menu-item-info {
  flex: 1;
}

.slash-menu-item-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.slash-menu-item-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==================== دکمه‌های ادیتور ==================== */

.article-editor-actions {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
  position: sticky;
  bottom: 0;
  background: var(--bg);
}

.btn-save-draft {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 24px;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-draft:hover {
  background: var(--hover);
}

.btn-publish {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-publish:hover {
  background: var(--primary-hover);
}

/* پیش‌نویس‌های من */
.my-drafts-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.my-drafts-section h3 {
  font-size: 16px;
  margin: 0 0 12px 0;
  color: var(--text-secondary);
}

.draft-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.draft-item:hover {
  background: var(--hover);
}

.draft-item-title {
  font-weight: 500;
}

.draft-item-date {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==================== ریسپانسیو مقالات ==================== */

@media (max-width: 768px) {
  .article-detail {
    padding: 16px;
  }

  .article-detail-title {
    font-size: 24px;
  }

  .article-detail-content {
    font-size: 16px;
  }

  .article-editor-container {
    padding: 16px;
  }

  .article-title-input {
    font-size: 24px;
  }

  .block-h1 .block-content {
    font-size: 22px;
  }

  .block-h2 .block-content {
    font-size: 20px;
  }

  .block-h3 .block-content {
    font-size: 18px;
  }

  .slash-menu {
    min-width: 240px;
    left: 10px !important;
    right: 10px !important;
  }

  .article-card-cover {
    height: 150px;
  }

  .article-card-title {
    font-size: 18px;
  }

  .articles-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .btn-write-article {
    text-align: center;
  }
}

/* استایل بلاک‌های رندر شده در نمایش مقاله */
.block-rendered {
  margin-bottom: 16px;
}

.block-heading-1 {
  font-size: 28px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 16px;
  line-height: 1.3;
}

.block-heading-2 {
  font-size: 24px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.block-heading-3 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.block-paragraph {
  margin: 0;
  line-height: 1.8;
  text-align: justify;
  word-break: break-word;
}

/* دکمه حذف تصویر در ادیتور */
.editor-image-wrapper {
  position: relative;
}
.editor-image-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 20px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 5;
}
.editor-image-wrapper:hover .editor-image-delete {
  display: flex;
}

.block-image-figure {
  margin: 24px 0;
  text-align: center;
}

.block-image-figure img {
  max-width: 100%;
  border-radius: 12px;
}

.block-image-figure figcaption {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.block-code-rendered {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  margin: 16px 0;
}

.block-code-rendered code {
  white-space: pre-wrap;
}

.block-divider-rendered {
  border: none;
  border-top: 2px solid var(--border);
  margin: 32px 0;
}

.block-list-rendered {
  padding-right: 24px;
  margin: 16px 0;
}

.block-list-rendered li {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* ==================== ادیتور Tiptap - استایل Notion ==================== */

/* کانتینر ادیتور */
#tiptapEditor {
  min-height: 400px;
  padding: 0;
}

.tiptap-content {
  outline: none;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
}

/* پلیس‌هولدر */
.tiptap-content p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: right;
  color: var(--text-secondary);
  opacity: 0.5;
  pointer-events: none;
  height: 0;
}

.tiptap-content:focus p.is-editor-empty:first-child::before {
  content: "بنویسید یا / را بزنید برای دستورات...";
}

/* عناوین - استایل Notion */
.tiptap-content h1 {
  font-size: 2.25em;
  font-weight: 700;
  margin: 1.5em 0 0.5em 0;
  line-height: 1.2;
  color: var(--text);
}

.tiptap-content h2 {
  font-size: 1.75em;
  font-weight: 600;
  margin: 1.25em 0 0.4em 0;
  line-height: 1.3;
  color: var(--text);
}

.tiptap-content h3 {
  font-size: 1.375em;
  font-weight: 600;
  margin: 1em 0 0.3em 0;
  line-height: 1.4;
  color: var(--text);
}

/* پاراگراف */
.tiptap-content p {
  margin: 0.5em 0;
}

/* لیست‌ها */
.tiptap-content ul,
.tiptap-content ol {
  padding-right: 1.5em;
  margin: 0.5em 0;
}

.tiptap-content li {
  margin: 0.25em 0;
}

.tiptap-content li p {
  margin: 0;
}

/* چک‌لیست - Task List */
.tiptap-content ul[data-type="taskList"] {
  list-style: none;
  padding-right: 0;
}

.tiptap-content ul[data-type="taskList"] li {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}

.tiptap-content ul[data-type="taskList"] li > label {
  flex-shrink: 0;
  margin-top: 0.25em;
}

.tiptap-content ul[data-type="taskList"] li > label input[type="checkbox"] {
  width: 1.1em;
  height: 1.1em;
  cursor: pointer;
  accent-color: var(--primary);
}

.tiptap-content ul[data-type="taskList"] li[data-checked="true"] > div > p {
  text-decoration: line-through;
  color: var(--text-secondary);
}

/* نقل قول - Blockquote */
.tiptap-content blockquote {
  border-right: 4px solid var(--primary);
  padding: 0.5em 1em;
  margin: 1em 0;
  background: var(--bg-secondary);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.tiptap-content blockquote p {
  margin: 0;
}

/* بلاک کد */
.tiptap-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1em;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.9em;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
  margin: 1em 0;
}

.tiptap-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* کد inline */
.tiptap-content code {
  background: var(--bg-secondary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.9em;
  color: #e06c75;
}

/* خط افقی */
.tiptap-content hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 2em 0;
}

/* تصویر */
.tiptap-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1em 0;
  cursor: pointer;
}

.tiptap-content img.ProseMirror-selectednode {
  outline: 3px solid var(--primary);
}

/* ==================== ادیتور ساده (فالبک) ==================== */

.simple-editor {
  min-height: 400px;
  outline: none;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  text-align: justify;
  word-break: break-word;
}

.simple-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  opacity: 0.5;
}

.simple-editor h1,
.simple-editor h2,
.simple-editor h3 {
  outline: none;
}

.simple-editor h1:empty::before,
.simple-editor h2:empty::before,
.simple-editor h3:empty::before,
.simple-editor p:empty::before,
.simple-editor blockquote:empty::before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  opacity: 0.5;
}

.simple-editor h1 { font-size: 2.25em; font-weight: 700; margin: 1.5em 0 0.5em 0; }
.simple-editor h2 { font-size: 1.75em; font-weight: 600; margin: 1.25em 0 0.4em 0; }
.simple-editor h3 { font-size: 1.375em; font-weight: 600; margin: 1em 0 0.3em 0; }

.simple-editor blockquote {
  border-right: 4px solid var(--primary);
  padding: 0.5em 1em;
  margin: 1em 0;
  background: var(--bg-secondary);
  border-radius: 0 8px 8px 0;
}

.simple-editor pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1em;
  border-radius: 8px;
  direction: ltr;
  text-align: left;
}

.simple-editor pre code {
  display: block;
  outline: none;
}

.simple-editor hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 2em 0;
}

.simple-editor img.editor-image {
  max-width: 100%;
  border-radius: 8px;
  margin: 1em 0;
  cursor: pointer;
}

/* کالاوت */
.simple-editor .callout,
.tiptap-content .callout {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin: 1em 0;
  border-right: 4px solid #f59e0b;
}

.callout-icon {
  font-size: 1.25em;
  flex-shrink: 0;
}

.callout-content {
  flex: 1;
  outline: none;
}

.callout-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  opacity: 0.5;
}

/* Task List ساده */
.task-list {
  margin: 0.5em 0;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  margin: 0.25em 0;
}

.task-item input[type="checkbox"] {
  width: 1.1em;
  height: 1.1em;
  margin-top: 0.25em;
  cursor: pointer;
  accent-color: var(--primary);
}

.task-item span {
  flex: 1;
  outline: none;
}

.task-item span:empty::before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  opacity: 0.5;
}

/* ==================== منوی Slash بهبود یافته ==================== */

.slash-menu {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  padding: 8px;
  min-width: 280px;
  max-height: 350px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.slash-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
}

.slash-menu-item:hover {
  background: var(--bg-hover);
}

.slash-menu-item.active {
  background: rgba(29, 155, 240, 0.15);
}

.slash-menu-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.slash-menu-text {
  flex: 1;
  min-width: 0;
}

.slash-menu-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.slash-menu-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ==================== منوی راست‌کلیک (Context Menu) ==================== */

.context-menu {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  padding: 6px;
  min-width: 180px;
  z-index: 10000;
  display: none;
  user-select: none;
  -webkit-user-select: none;
  animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

.context-menu-item:hover {
  background: var(--bg-hover);
}

.context-menu-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.context-menu-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.context-menu-separator {
  height: 1px;
  background: var(--border);
  margin: 6px 8px;
}

/* استایل برای کد inline */
.simple-editor .inline-code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
  color: var(--accent);
}

/* استایل برای لینک‌ها */
.simple-editor a {
  color: var(--accent);
  text-decoration: underline;
}

.simple-editor a:hover {
  text-decoration: none;
}

/* ==================== تولبار فرمت (Bubble Menu) ==================== */

.format-toolbar {
  position: fixed;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 4px;
  display: none;
  z-index: 9999;
  gap: 2px;
}

.format-toolbar.visible {
  display: flex;
}

.format-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.15s;
}

.format-btn:hover {
  background: var(--hover);
}

.format-btn.active {
  background: var(--primary);
  color: white;
}

.format-btn svg {
  width: 18px;
  height: 18px;
}

.format-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 4px 4px;
}

/* ==================== انیمیشن‌ها ==================== */

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slash-menu {
  animation: slideUp 0.15s ease-out;
}

.format-toolbar {
  animation: slideUp 0.1s ease-out;
}

/* ==================== بخش نظرات مقاله ==================== */

.article-comments-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.comments-header {
  margin-bottom: 16px;
}

.comments-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.comments-list {
  margin-bottom: 16px;
}

.article-comment {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.article-comment:last-child {
  border-bottom: none;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-author {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.comment-time {
  font-size: 13px;
  color: var(--text-secondary);
}

.comment-text {
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.comment-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.comment-input-wrapper textarea {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font-size: 15px;
  resize: none;
  min-height: 60px;
}

.comment-input-wrapper textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.comment-input-wrapper .btn-primary {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
}

/* ==================== دکمه‌های تعامل مقاله ==================== */

.article-actions {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.article-actions .action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ==================== Toast نوتیفیکیشن ==================== */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== هدر مقاله با دکمه ویرایش ===== */
.article-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.article-detail-header .article-detail-title {
  flex: 1;
}

.btn-edit-article {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-edit-article:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-edit-article svg {
  flex-shrink: 0;
}

/* ===== تاریخچه ویرایش مقالات - کشویی ===== */
.article-revisions-dropdown {
  margin: 16px 0;
}

.revisions-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  width: auto;
}

.revisions-toggle-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.revisions-toggle-btn.open {
  border-radius: 10px 10px 0 0;
  border-bottom-color: transparent;
}

.revisions-chevron {
  transition: transform 0.2s;
  margin-right: auto;
}

.revisions-toggle-btn.open .revisions-chevron {
  transform: rotate(180deg);
}

.revisions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
}

.revisions-loading {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 13px;
}

.revision-link {
  display: inline-block;
  padding: 5px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  transition: all 0.2s;
}

.revision-link:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ===== مودال تفاوت‌ها ===== */
.diff-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

.diff-modal.active {
  display: flex;
}

.diff-modal-content {
  background: var(--bg-primary);
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.diff-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.diff-modal .modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
}

.diff-modal .modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.diff-modal .modal-close:hover {
  color: var(--text-primary);
}

.diff-modal .modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.diff-content {
  font-family: 'Vazirmatn', monospace;
  font-size: 13px;
  line-height: 1.8;
  direction: rtl;
}

.diff-title-change {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 16px;
}

.diff-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.diff-arrow {
  color: var(--text-secondary);
}

.diff-line {
  padding: 6px 14px;
  border-radius: 6px;
  margin: 3px 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.7;
}

.diff-line-added {
  background: #0d3520;
  color: #4ade80;
  border-right: 4px solid #22c55e;
}

.diff-line-removed {
  background: #3b1111;
  color: #fca5a5;
  border-right: 4px solid #ef4444;
  text-decoration: line-through;
}

.diff-line-unchanged {
  color: var(--text-primary);
  background: var(--bg-secondary);
  opacity: 0.6;
}

.diff-added {
  background: #0d3520;
  color: #4ade80;
  padding: 2px 8px;
  border-radius: 4px;
}

.diff-removed {
  background: #3b1111;
  color: #fca5a5;
  padding: 2px 8px;
  border-radius: 4px;
  text-decoration: line-through;
}

/* تم روشن */
[data-theme="light"] .diff-line-added {
  background: #dcfce7;
  color: #166534;
}
[data-theme="light"] .diff-line-removed {
  background: #fee2e2;
  color: #991b1b;
}
[data-theme="light"] .diff-added {
  background: #dcfce7;
  color: #166534;
}
[data-theme="light"] .diff-removed {
  background: #fee2e2;
  color: #991b1b;
}

/* ==================== INTEREST CHIPS ==================== */

.interest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.interest-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.interest-chip:hover {
  border-color: var(--accent);
  background: rgba(29, 155, 240, 0.1);
}

.interest-chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.interest-chip.selected:hover {
  background: var(--accent-hover);
}

/* ==================== MESSAGES & CHAT ==================== */

/* اطلاعیه رمزنگاری سرتاسری */
.e2e-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(0, 186, 124, 0.08);
  color: var(--success);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

/* لیست مکالمات */
.conversations-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}

.conversation-item:hover {
  background: var(--bg-hover);
}

.conversation-item:active {
  background: var(--bg-hover);
}

.conversation-item .avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  overflow: hidden;
}

.conversation-item .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conversation-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.conversation-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.conversation-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-time {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.conversation-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 3px;
}

.conversation-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conversation-tick { font-size: 12px; opacity: 0.6; letter-spacing: -2px; }
.conversation-tick.read { color: var(--accent); opacity: 1; }

.conversation-unread {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
}

/* هدر چت */
.chat-header .header-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.back-btn:hover {
  background: var(--bg-hover);
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

.chat-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
  min-width: 0;
}

.chat-header-user .avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  overflow: hidden;
}

.chat-header-user .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.chat-header-status {
  font-size: 12px;
  color: var(--success);
}

.chat-header-lock {
  margin-right: auto;
  color: var(--text-secondary);
  opacity: 0.4;
  transition: opacity 0.3s, color 0.3s;
}

.chat-header-lock.e2e-active {
  color: #4caf50;
  opacity: 1;
}

.chat-header-lock.e2e-inactive {
  color: #ff9800;
  opacity: 0.7;
}

/* بنر وضعیت رمزنگاری */
.chat-e2e-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  text-align: center;
  flex-shrink: 0;
}

.chat-e2e-banner.encrypted {
  background: rgba(76, 175, 80, 0.1);
  color: #4caf50;
}

.chat-e2e-banner.not-encrypted {
  background: rgba(255, 152, 0, 0.1);
  color: #ff9800;
}

/* ناحیه پیام‌ها */
#chatPage.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

#chatPage .header {
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overscroll-behavior-y: contain;
}

.chat-date-separator {
  text-align: center;
  padding: 12px 0 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chat-message {
  max-width: 80%;
  margin-bottom: 2px;
  clear: both;
  position: relative;
}

.chat-message.sent {
  align-self: flex-end;
  margin-left: auto;
  margin-right: 0;
  direction: ltr;
}

.chat-message.sent .chat-bubble {
  direction: rtl;
  text-align: right;
}

.chat-message.received {
  align-self: flex-start;
  margin-right: auto;
  margin-left: 0;
}

.chat-bubble {
  padding: 6px 12px 6px 12px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

/* متن پیام - inline برای قرارگیری زمان در همان خط (سبک واتساپ) */
.chat-text {
  display: inline;
}

.chat-bubble.sent {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 18px;
}

.chat-bubble.received {
  background: var(--bg-secondary);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 18px;
}

/* اطلاعات زمان و وضعیت - float چپ (سبک واتساپ) */
.chat-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  float: right;
  margin: 4px 0 -4px 8px;
  white-space: nowrap;
  direction: ltr;
  font-size: 11px;
  opacity: 0.75;
}

.chat-time {
  font-size: 11px;
  opacity: 0.7;
}

.chat-read {
  font-size: 12px;
  opacity: 0.8;
  letter-spacing: -2px;
  margin-right: 2px;
}

.chat-read.read {
  color: #4fc3f7;
  opacity: 1;
}

/* آیکون سنجاق کنار ساعت در chat-meta */
.chat-pin-icon {
  width: 11px;
  height: 11px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* نوار تایپ */
.chat-typing {
  padding: 4px 16px 2px;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  flex-shrink: 0;
}

/* ناحیه ورودی چت */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-textarea {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.4;
  direction: rtl;
}

.chat-textarea:focus {
  border-color: var(--accent);
}

.chat-textarea::placeholder {
  color: var(--text-secondary);
}

.chat-send-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}

.chat-send-btn:hover {
  background: var(--accent-hover);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

/* نتایج جستجوی پیام جدید */
.new-chat-results {
  margin-top: 8px;
  max-height: 350px;
  overflow-y: auto;
}

.new-chat-results .conversation-item {
  padding: 10px 4px;
}

.new-chat-results .conversation-item:first-child {
  border-top: 1px solid var(--border);
}

/* وضعیت خالی پیام‌ها */
#messagesPage .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-secondary);
  text-align: center;
}

#messagesPage .empty-state .btn {
  margin-top: 8px;
}

/* ارسال با Enter */
.chat-textarea::-webkit-scrollbar {
  width: 4px;
}

.chat-textarea::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ریسپانسیو موبایل */
@media (max-width: 768px) {
  .chat-messages {
    padding: 8px 12px;
  }

  .chat-message {
    max-width: 88%;
  }

  .chat-input-area {
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .chat-textarea {
    padding: 8px 14px;
    font-size: 16px;
  }

  #chatPage.active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: var(--bg);
  }
}

/* ==================== اکشن‌های پیام چت ==================== */

/* باتم شیت موبایل */
.chat-action-bottom-sheet-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 999; }
.chat-action-bottom-sheet-overlay.show { display: block; }
.chat-action-bottom-sheet { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg); border-top: 1px solid var(--border); border-radius: 20px 20px 0 0; z-index: 1000; padding: 12px 0; padding-bottom: env(safe-area-inset-bottom, 12px); animation: slideUpSheet 0.3s ease; }
.chat-action-bottom-sheet.show { display: block; }
.chat-action-bottom-sheet button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 20px; background: transparent; border: none; color: var(--text); font-size: 15px; cursor: pointer; text-align: right; font-family: inherit; }
.chat-action-bottom-sheet button:hover { background: var(--bg-hover); }
.chat-action-bottom-sheet button svg { flex-shrink: 0; width: 20px; height: 20px; }

/* کانتکست منوی دسکتاپ */
.chat-action-menu { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 180px; overflow: hidden; z-index: 1000; }
.chat-action-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; background: transparent; border: none; color: var(--text); font-size: 14px; cursor: pointer; text-align: right; font-family: inherit; }
.chat-action-menu button:hover { background: var(--bg-hover); }
.chat-action-menu button svg { flex-shrink: 0; }

/* نوار ریپلای بالای input */
.chat-reply-preview { padding: 8px 12px; border-top: 1px solid var(--border); background: var(--bg-secondary); flex-shrink: 0; }
.reply-preview-content { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); border-right: 3px solid var(--accent); padding-right: 8px; }
.reply-preview-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview-close { background: none; border: none; font-size: 18px; color: var(--text-secondary); cursor: pointer; padding: 0 4px; }

/* نقل‌قول ریپلای داخل حباب */
.chat-reply-quote { background: rgba(0,0,0,0.08); border-radius: 8px; padding: 6px 10px; margin-bottom: 4px; font-size: 12px; color: inherit; opacity: 0.7; border-right: 2px solid currentColor; cursor: pointer; }
.chat-bubble.sent .chat-reply-quote { background: rgba(255,255,255,0.15); }

/* نوار ویرایش بالای input */
.chat-edit-preview { padding: 8px 12px; border-top: 1px solid var(--border); background: var(--bg-secondary); flex-shrink: 0; }
.edit-preview-content { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent); }
.edit-preview-close { background: none; border: none; font-size: 18px; color: var(--text-secondary); cursor: pointer; padding: 0 4px; margin-right: auto; }

/* برچسب ویرایش شده */
.chat-edited { font-size: 10px; opacity: 0.6; font-style: italic; margin-left: 4px; }

/* بنر پیام سنجاق شده - نمایش یکی یکی carousel */
.chat-pinned-banner { display: none; align-items: center; gap: 8px; padding: 8px 16px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); flex-shrink: 0; cursor: pointer; transition: background 0.2s; }
.chat-pinned-banner.show { display: flex; }
.chat-pinned-banner:hover { background: var(--bg-hover); }
.chat-pinned-banner svg { flex-shrink: 0; }
.chat-pinned-banner span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pinned-banner .pin-counter { font-size: 11px; opacity: 0.7; margin-left: 8px; white-space: nowrap; }

/* دکمه برو پایین */
.scroll-to-bottom-btn { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: white; border: none; box-shadow: 0 2px 8px rgba(0,0,0,0.2); cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 100; transition: opacity 0.3s; }
.scroll-to-bottom-btn.show { display: flex; }
.scroll-to-bottom-btn:hover { opacity: 0.9; }
.scroll-to-bottom-btn svg { width: 20px; height: 20px; }

/* هایلایت پیام هنگام اسکرول - تمام عرض ردیف چت */
@keyframes messageHighlightFlash {
  0%   { background-color: rgba(255, 193, 7, 0.38); box-shadow: 0 0 18px 4px rgba(255, 193, 7, 0.25); }
  15%  { background-color: rgba(255, 193, 7, 0.30); box-shadow: 0 0 10px 2px rgba(255, 193, 7, 0.15); }
  50%  { background-color: rgba(255, 193, 7, 0.15); box-shadow: none; }
  100% { background-color: transparent; box-shadow: none; }
}
.chat-message.highlighted {
  z-index: 1;
}
.chat-message.highlighted::before {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  /* extend to full width of .chat-messages by overshooting with large values; overflow-x:hidden on parent clips it */
  left: -16px;
  right: -1000px;
  border-radius: 8px;
  animation: messageHighlightFlash 2s ease-out forwards;
  pointer-events: none;
  z-index: -1;
}
.chat-message.sent.highlighted::before {
  /* sent messages are on the right side; mirror the extension */
  left: -1000px;
  right: -16px;
}
