/* blog.css - نسخه نهایی 2025 با رنگ‌بندی مدرن و فوتر یکسان */
/* ===== متغیرهای CSS 2025 ===== */
:root {
  --primary-color: #4361ee;
  --primary-dark: #3a56d4;
  --primary-light: #5a75f0;
  --secondary-color: #7209b7;
  --accent-color: #f72585;
  --accent-light: #ff4da6;
  --text-color: #1a1a2e;
  --text-light: #4a4a6a;
  --text-lighter: #6c6c8a;
  --bg-color: #f8f9fa;
  --bg-light: #f1f3f9;
  --bg-lighter: #e9ecf8;
  --card-color: #ffffff;
  --border-color: #e2e8f0;
  --border-radius: 16px;
  --border-radius-lg: 24px;
  --box-shadow: 0 8px 30px rgba(67, 97, 238, 0.08);
  --box-shadow-hover: 0 15px 40px rgba(67, 97, 238, 0.15);
  --transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
  --transition-fast: 0.2s ease;
  --font-family: 'Vazirmatn', 'B Nazanin', 'Segoe UI', Tahoma, Arial, sans-serif;
  
  /* متغیرهای اضافی */
  --header-bg: linear-gradient(135deg, #4361ee 0%, #7209b7 100%);
  --footer-bg: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  --footer-light: #3a3a5e;
  --highlight-link: #f72585;
  --glass-light: rgba(255, 255, 255, 0.25);
  --glass-border-light: rgba(255, 255, 255, 0.3);
  --glass-dark: rgba(0, 0, 0, 0.3);
  --glass-border-dark: rgba(255, 255, 255, 0.15);
  --container-max: 1200px;
}

/* ===== تایپوگرافی بهبود یافته ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  line-height: 1.4;
  color: var(--text-color);
  margin-bottom: 1.2rem;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  margin-bottom: 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), transparent);
  border-radius: 2px;
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.8rem);
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1.5rem;
  color: var(--text-light);
  line-height: 1.8;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: none;
}

a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

a:hover::after {
  width: 100%;
  left: 0;
}

/* ===== دسترسی ===== */
.skip-link {
  position: absolute;
  top: -50px;
  right: 0;
  background: var(--primary-color);
  color: white;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 600;
  z-index: 9999;
  transition: var(--transition);
}

.skip-link:focus {
  top: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.3);
  border-radius: calc(var(--border-radius) - 2px);
}

/* ===== نوار جستجوی مدرن ===== */
.search-bar {
  margin-bottom: 3rem;
  position: relative;
}

.search-form {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  background: var(--card-color);
  border-radius: 50px;
  padding: 5px;
  box-shadow: var(--box-shadow);
  border: 2px solid transparent;
  transition: var(--transition);
}

.search-form:focus-within {
  border-color: var(--primary-light);
  box-shadow: var(--box-shadow-hover);
}

.search-form input {
  flex: 1;
  padding: 16px 28px;
  border: none;
  background: transparent;
  font-size: 1rem;
  outline: none;
  color: var(--text-color);
}

.search-form input::placeholder {
  color: var(--text-lighter);
}

.search-form button {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border: none;
  padding: 16px 36px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(67, 97, 238, 0.3);
}

/* ===== کانتینر اصلی ===== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 max(1.5rem, env(safe-area-inset-left));
  width: 100%;
}

/* ===== شمارنده مقالات ===== */
.posts-counter {
  margin: 2rem 0;
  text-align: center;
}

.counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(67, 97, 238, 0.05));
  color: var(--text-color);
  padding: 14px 28px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 1.1rem;
  border: 2px solid rgba(67, 97, 238, 0.2);
}

.counter-icon {
  font-size: 1.3em;
  color: var(--primary-color);
}

/* ===== فیلتر دسته‌بندی‌های بهبود یافته (اصلاح شده) ===== */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 3rem;
  padding: 24px;
  background: linear-gradient(135deg, var(--bg-light), var(--bg-lighter));
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--card-color);
  border: 2px solid var(--border-color);
  color: var(--text-color);
  padding: 12px 28px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  font-size: 0.95rem;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.filter-btn span {
  position: relative;
  z-index: 2;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.filter-btn:hover {
  border-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: var(--box-shadow);
}

.filter-btn:hover::before {
  opacity: 1;
}

.filter-btn:hover span {
  color: white;
}

.filter-btn.active {
  border-color: var(--primary-color);
  box-shadow: 0 8px 20px rgba(67, 97, 238, 0.3);
}

.filter-btn.active::before {
  opacity: 1;
}

.filter-btn.active span {
  color: white;
  font-weight: 700;
}

.filter-icon {
  font-size: 1.1em;
}

.reset-filter-btn {
  background: linear-gradient(135deg, var(--secondary-color), #9d4edd);
  color: white;
  border: none;
}

.reset-filter-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(114, 9, 183, 0.4);
}

.post-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-right: 4px;
  color: white;
}

/* ===== گرید مقالات مدرن ===== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
  position: relative;
  min-height: 400px;
}

/* ===== کارت مقاله بهبود یافته ===== */
.post-card {
  display: block;
  background: var(--card-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  border: 1px solid var(--border-color);
  position: relative;
  height: 100%;
}

.post-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: var(--box-shadow-hover);
  border-color: var(--primary-light);
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.post-card:hover::before {
  opacity: 1;
}

.post-card-img {
  height: 240px;
  overflow: hidden;
  position: relative;
}

.post-card-img::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.post-card:hover .post-card-img::after {
  opacity: 1;
}

.post-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.post-card:hover .post-card-img img {
  transform: scale(1.08);
}

.post-card-content {
  padding: 1.75rem;
  position: relative;
  z-index: 2;
  background: var(--card-color);
}

.post-card-content h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-color);
  line-height: 1.4;
  position: relative;
  padding-bottom: 0.75rem;
}

.post-card-content h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), transparent);
  border-radius: 2px;
}

.post-card-content .excerpt {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: justify;
}

.post-meta {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.2rem;
}

.post-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.15), rgba(67, 97, 238, 0.08));
  color: var(--text-color);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(67, 97, 238, 0.2);
  transition: var(--transition);
}

.category-badge:hover {
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.25), rgba(67, 97, 238, 0.15));
  transform: translateY(-2px);
  text-decoration: none;
}

.post-date {
  color: var(--text-lighter);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

/* ===== حالت خالی ===== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, var(--bg-light), var(--bg-lighter));
  border-radius: var(--border-radius-lg);
  margin: 3rem 0;
  box-shadow: var(--box-shadow);
}

.empty-state h2 {
  color: var(--text-color);
  margin-bottom: 1rem;
}

.empty-state p {
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.empty-state-content {
  max-width: 500px;
  margin: 0 auto;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.5;
  color: var(--primary-color);
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 16px 32px;
  border-radius: var(--border-radius);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.2);
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(67, 97, 238, 0.3);
  color: white;
}

/* ===== محتوای مقاله بهبود یافته ===== */
.blog-post {
  background: var(--card-color);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem;
  box-shadow: var(--box-shadow);
  line-height: 1.8;
  color: var(--text-color);
  font-size: 1.05rem;
  margin: 2rem auto;
  max-width: 800px;
}

.blog-post h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.blog-post h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-color);
}

.blog-post p {
  margin-bottom: 1.5rem;
  color: var(--text-light);
  text-align: justify;
}

.blog-post img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  background: var(--card-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

th, td {
  padding: 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: linear-gradient(135deg, var(--bg-light), var(--bg-lighter));
  font-weight: 600;
  color: var(--text-color);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 1rem 0 2rem;
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 600;
  transition: var(--transition);
  padding: 10px 20px;
  border: 2px solid var(--primary-color);
  border-radius: var(--border-radius);
}

.back-link:hover {
  background: var(--primary-color);
  color: white;
  transform: translateX(-5px);
}

/* ===== FAQ ===== */
.faq {
  margin-top: 3rem;
}

.faq h3 {
  cursor: pointer;
  background: linear-gradient(135deg, var(--bg-light), var(--bg-lighter));
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
  box-shadow: var(--box-shadow);
  position: relative;
  font-weight: 600;
}

.faq h3:hover {
  background: linear-gradient(135deg, var(--bg-lighter), var(--bg-light));
  transform: translateY(-2px);
}

.faq h3::after {
  content: '▸';
  position: absolute;
  left: 1.5rem;
  font-size: 1.2rem;
  transition: transform 0.3s ease;
  color: var(--primary-color);
}

.faq .faq-item.active h3::after {
  transform: rotate(90deg);
}

.faq div {
  display: none;
  padding: 1.5rem;
  border-right: 4px solid var(--primary-color);
  background: var(--bg-light);
  margin-bottom: 1rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  color: var(--text-light);
  transition: all 0.3s ease;
}

.faq .faq-item.active div {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ===== بخش دیدگاه‌ها ===== */
.comments-section {
  margin-top: 3rem;
  background: var(--card-color);
  padding: 2rem;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
}

.comments-section form input,
.comments-section form textarea {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--border-color);
  background: var(--bg-light);
  color: var(--text-color);
  font-size: 1rem;
  transition: var(--transition);
}

.comments-section form input:focus,
.comments-section form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.comments-section form button {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 12px 28px;
  border-radius: var(--border-radius);
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.comments-section form button:hover {
  transform: translateY(-2px);
  box-shadow: var(--box-shadow);
}

.comment-card {
  background: var(--bg-light);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.comment-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--box-shadow);
}

.comment-admin {
  border: 2px solid var(--primary-color);
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(67, 97, 238, 0.05));
  position: relative;
}

.comment-admin::before {
  content: "👨‍⚕️ پاسخ دکتر";
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.reply-box {
  margin-right: 2rem;
  border-right: 3px solid var(--primary-color);
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.08), rgba(67, 97, 238, 0.04));
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-top: 1rem;
}

.reply-btn {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  padding: 8px 20px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.reply-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

.reply-form textarea {
  width: 100%;
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--border-color);
  background: var(--bg-light);
  margin-top: 1rem;
  resize: vertical;
  min-height: 120px;
}

.reply-form button {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 10px 24px;
  border: none;
  border-radius: var(--border-radius);
  margin-top: 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.reply-form button:hover {
  transform: translateY(-2px);
  box-shadow: var(--box-shadow);
}

/* ===== مودال لاگین ===== */
#loginModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

#loginModalContent {
  background: var(--card-color);
  padding: 2.5rem;
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

#closeLogin {
  position: absolute;
  top: 1rem;
  left: 1rem;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-light);
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

#closeLogin:hover {
  background: var(--bg-light);
  color: var(--text-color);
}

#loginTabs {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--bg-light);
}

#loginTabs button {
  flex: 1;
  border: none;
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  background: transparent;
  color: var(--text-color);
  transition: var(--transition);
}

#loginTabs button.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
}

#loginModalContent input {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--border-color);
  background: var(--bg-light);
  color: var(--text-color);
  font-size: 1rem;
}

/* ===== آیکون‌های شناور ===== */
.floating-icons {
  position: fixed;
  bottom: 30px;
  left: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 1000;
}

.icon-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.icon-btn:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: var(--box-shadow-hover);
}

.icon-btn img {
  width: 28px;
  height: 28px;
}

.insta-btn {
  background: linear-gradient(45deg, #405DE6, #5851DB, #833AB4, #C13584, #E1306C, #FD1D1D);
}

.whatsapp-btn {
  background: #25D366;
}

.telegram-btn {
  background: #0088cc;
}

/* ===== دکمه‌های شیشه‌ای ===== */
.glass-admin-btn,
.dark-toggle-btn {
  position: fixed;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: var(--box-shadow);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glass-admin-btn {
  bottom: 30px;
  right: 30px;
}

.dark-toggle-btn {
  bottom: 30px;
  right: 100px;
}

.glass-admin-btn:hover,
.dark-toggle-btn:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: var(--box-shadow-hover);
  background: white;
}

/* ===== نوار پیشرفت خواندن ===== */
#reading-progress-wrap {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: transparent;
  z-index: 9999;
}

#reading-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  width: 0%;
  transition: width 0.3s ease;
}

/* ===== نوتفیکیشن فیلتر ===== */
.filter-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 15px 25px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow-hover);
  font-weight: 600;
  z-index: 1000;
  transform: translateY(-20px);
  opacity: 0;
  transition: var(--transition);
  max-width: 300px;
}

.filter-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* ===== انیمیشن‌ها ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card {
  animation: fadeIn 0.4s ease forwards;
}

/* ===== حالت تاریک بهبود یافته ===== */
body.dark-mode {
  --bg-color: #0f0f23;
  --bg-light: #1a1a2e;
  --bg-lighter: #252547;
  --card-color: #1a1a2e;
  --text-color: #e2e8f0;
  --text-light: #cbd5e0;
  --text-lighter: #a0aec0;
  --border-color: #2d3748;
  --secondary-color: #9d4edd;
  --box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  --box-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.6);
  --primary-color: #5a75f0;
  --primary-dark: #4361ee;
  --primary-light: #6f87f2;
  --accent-color: #f72585;
  --accent-light: #ff4da6;
  --header-bg: linear-gradient(135deg, #1a1a2e 0%, #252547 100%);
  --footer-bg: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
}

body.dark-mode .glass-admin-btn {
  background: rgba(26, 26, 46, 0.9);
  border-color: rgba(90, 117, 240, 0.3);
  color: var(--text-color);
}

body.dark-mode .glass-admin-btn:hover {
  background: rgba(37, 37, 71, 0.9);
}

/* بهبود اسکرول بار در دارک مود */
body.dark-mode ::-webkit-scrollbar-track {
  background: var(--bg-light);
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-color));
}

/* بهبود فیلترهای دسته‌بندی در دارک مود */
body.dark-mode .filter-btn {
  background: var(--bg-lighter);
  color: var(--text-color);
  border-color: var(--border-color);
}

body.dark-mode .filter-btn.active {
  border-color: var(--primary-color);
}

body.dark-mode .filter-btn.active span {
  color: white;
}

body.dark-mode .category-filters {
  background: linear-gradient(135deg, var(--bg-light), var(--bg-lighter));
}

/* بهبود جداول در دارک مود */
body.dark-mode table {
  background: var(--bg-light);
}

body.dark-mode th {
  background: linear-gradient(135deg, var(--bg-lighter), var(--bg-light));
  color: var(--text-color);
}

body.dark-mode td {
  color: var(--text-light);
  border-bottom-color: var(--border-color);
}

/* بهبود کارت‌ها در دارک مود */
body.dark-mode .post-card,
body.dark-mode .blog-post,
body.dark-mode .comments-section {
  background: var(--card-color);
  border-color: var(--border-color);
}

/* بهبود فرم‌ها در دارک مود */
body.dark-mode .search-form {
  background: var(--bg-lighter);
}

body.dark-mode .search-form input {
  color: var(--text-color);
}

body.dark-mode .comments-section form input,
body.dark-mode .comments-section form textarea,
body.dark-mode #loginModalContent input {
  background: var(--bg-lighter);
  color: var(--text-color);
  border-color: var(--border-color);
}

/* ===== ریسپانسیو ===== */
@media (max-width: 1200px) {
  .container {
    padding: 0 2rem;
  }
}

@media (max-width: 992px) {
  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
  }
  
  .blog-post {
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  .category-filters {
    overflow-x: auto;
    padding-bottom: 15px;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }
  
  .category-filters::-webkit-scrollbar {
    height: 4px;
  }
  
  .category-filters::-webkit-scrollbar-thumb {
    background: rgba(67, 97, 238, 0.3);
    border-radius: 2px;
  }
  
  .filter-btn {
    white-space: nowrap;
  }
  
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .floating-icons {
    left: 20px;
    bottom: 20px;
  }
  
  .glass-admin-btn,
  .dark-toggle-btn {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  
  .glass-admin-btn {
    right: 20px;
    bottom: 20px;
  }
  
  .dark-toggle-btn {
    right: 80px;
    bottom: 20px;
  }
  
  .blog-post {
    padding: 1.5rem;
  }
  
  /* بهبود اسکرول‌بار در موبایل */
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  
  ::-webkit-scrollbar-track {
    background: rgba(67, 97, 238, 0.1);
    border-radius: 8px;
  }
  
  ::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 8px;
    border: 2px solid rgba(67, 97, 238, 0.1);
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-color));
  }
  
  /* اطمینان از نمایش اسکرول‌بار در موبایل */
  html {
    -webkit-overflow-scrolling: touch;
  }
  
  body {
    overflow-x: hidden;
  }
  
  .container, .posts-grid, .blog-post {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 576px) {
  .container {
    padding: 0 1rem;
  }
  
  .post-card-content {
    padding: 1.25rem;
  }
  
  .post-card-content h2 {
    font-size: 1.3rem;
  }
  
  .search-form {
    flex-direction: column;
    border-radius: var(--border-radius);
    padding: 10px;
  }
  
  .search-form input,
  .search-form button {
    width: 100%;
    border-radius: var(--border-radius);
  }
  
  .search-form button {
    margin-top: 10px;
  }
  
  .comments-section {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .post-card-img {
    height: 200px;
  }
  
  .floating-icons {
    left: 15px;
    bottom: 15px;
  }
  
  .icon-btn {
    width: 50px;
    height: 50px;
  }
  
  .icon-btn img {
    width: 22px;
    height: 22px;
  }
  
  .glass-admin-btn,
  .dark-toggle-btn {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
  
  .glass-admin-btn {
    right: 15px;
    bottom: 15px;
  }
  
  .dark-toggle-btn {
    right: 70px;
    bottom: 15px;
  }
}

/* ===== کاهش انیمیشن ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* ===== اعداد فارسی ===== */
.farsi-numbers {
  font-variant-numeric: proportional-nums;
  unicode-bidi: bidi-override;
  direction: rtl;
}

/* ===== صفحه جستجو ===== */
.search-results-header {
  text-align: center;
  margin: 2rem 0 3rem;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-light), var(--bg-lighter));
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
}

.search-results-header h2 {
  color: var(--text-color);
  margin-bottom: 1rem;
}

.search-message {
  font-size: 1.1rem;
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.results-counter {
  margin-top: 1.5rem;
}

.results-count {
  background: rgba(67, 97, 238, 0.1);
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95rem;
  display: inline-block;
}

.search-suggestions {
  text-align: right;
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(67, 97, 238, 0.05);
  border-radius: var(--border-radius);
  border-right: 4px solid var(--primary-color);
}

.search-suggestions p {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.search-suggestions ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-suggestions li {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(67, 97, 238, 0.1);
}

.search-suggestions li:last-child {
  border-bottom: none;
}

.search-suggestions a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.search-suggestions a:hover {
  text-decoration: underline;
}

/* جلوگیری از zoom در iOS */
@media screen and (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

/* بهبود اسکرول در موبایل */
@media (max-width: 768px) {
  .container,
  .blog-post,
  .posts-grid {
    -webkit-overflow-scrolling: touch;
  }
}