/* static/css/blog.css */

/* اضافه کردن استایل‌های مورد نیاز که ممکن است در style.css اصلی نباشند */
:root {
  --sidebar-width: 320px;
}

/* Layout اصلی */
.blog-main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px var(--container-pad);
  min-height: 80vh;
}

.blog-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.blog-posts {
  flex: 1;
  min-width: 0; /* جلوگیری از overflow */
}

/* گرید پست‌ها */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* کارت مقاله */
.blog-post-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  transition: all var(--t-base);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.blog-post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--border);
}

.post-thumbnail {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-soft);
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.blog-post-card:hover .post-thumbnail img {
  transform: scale(1.05);
}

.post-category {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(37, 99, 235, 0.9);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--r-full);
  text-decoration: none;
  z-index: 2;
  transition: background 0.2s;
}

.post-category:hover {
  background: var(--primary-600);
}

.post-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.post-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--ink);
  margin: 0;
}

.post-title a {
  color: inherit;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.2s;
}

.post-title a:hover {
  color: var(--primary);
}

.post-date {
  font-size: 11px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-excerpt {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.8;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  margin-top: auto;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border);
}

.read-more {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--r-full);
  transition: all 0.2s;
  background: var(--primary-50);
}

.read-more:hover {
  background: var(--primary);
  color: #fff;
}

/* سایدبار */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-widget {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-50);
  color: var(--ink);
  position: relative;
}

.widget-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 40px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* فرم جستجو */
.search-form {
  margin: 0;
}

.search-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
  transition: all 0.2s;
}

.search-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-field {
  flex: 1;
  border: none;
  padding: 12px 16px;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}

.search-field::placeholder {
  color: var(--ink-faint);
}

.search-submit {
  background: transparent;
  border: none;
  padding: 10px 14px;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.2s;
}

.search-submit:hover {
  color: var(--primary);
}

/* لیست دسته‌بندی‌ها */
.categories-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.categories-list li {
  border-bottom: 1px dashed var(--border-soft);
}

.categories-list li:last-child {
  border-bottom: none;
}

.categories-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: all 0.2s;
}

.categories-list a:hover {
  color: var(--primary);
  padding-right: 4px;
}

.categories-list .count {
  font-size: 11px;
  background: var(--bg-soft);
  padding: 2px 8px;
  border-radius: var(--r-full);
  color: var(--ink-faint);
}

/* لیست املاک */
.properties-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.property-item {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 8px;
  border-radius: var(--r-sm);
  transition: background 0.2s;
}

.property-item:hover {
  background: var(--bg-soft);
}

.property-image {
  width: 65px;
  height: 65px;
  border-radius: var(--r-xs);
  overflow: hidden;
  flex-shrink: 0;
}

.property-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.property-details {
  flex: 1;
  min-width: 0;
}

.property-details h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.property-details .price {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}

.property-details .price small {
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-faint);
}

.property-details .meta {
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: var(--ink-faint);
}

/* برچسب‌ها */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-full);
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: all 0.2s;
  font-weight: 500;
}

.tag:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

/* صفحه‌بندی */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  transition: all 0.2s;
}

.page-numbers:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
}

.page-numbers.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.page-numbers.dots {
  border: none;
  background: transparent;
  cursor: default;
}

.page-numbers.next {
  gap: 4px;
}

/* دکمه فیلتر سایدبار (موبایل) */
.filter-btn {
  display: none;
}

/* overlay برای سایدبار در موبایل */
.sidebar-overlay {
  display: none;
}

/* تنظیمات ریسپانسیو */
@media (max-width: 900px) {
  .blog-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: fixed;
    top: 0;
    right: -100%;
    bottom: 0;
    z-index: 99;
    background: var(--bg);
    overflow-y: auto;
    padding: 20px;
    transition: right 0.3s var(--ease);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.is-open {
    right: 0;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 98;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
  }

  .sidebar-overlay.is-open {
    opacity: 1;
    visibility: visible;
  }

  .filter-btn {
    display: flex;
    margin-right: auto;
  }

  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (max-width: 600px) {
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .blog-post-card {
    flex-direction: column;
  }

  .post-thumbnail {
    aspect-ratio: 16 / 9;
  }

  .post-title {
    font-size: 14px;
  }
}

@media (min-width: 1400px) {
  .posts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: all var(--t-fast);
  position: relative;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}
[data-theme="dark"] .blog-post-card {
  background: #1E293B;
  border-color: #334155;
}

[data-theme="dark"] .blog-post-card:hover {
  border-color: #475569;
}

[data-theme="dark"] .post-thumbnail {
  background: #0F172A;
}

[data-theme="dark"] .post-title a {
  color: #F1F5F9;
}

[data-theme="dark"] .post-title a:hover {
  color: #3B82F6;
}

[data-theme="dark"] .post-excerpt {
  color: #94A3B8;
}

[data-theme="dark"] .post-footer {
  border-top-color: #334155;
}

[data-theme="dark"] .post-author {
  color: #94A3B8;
}

[data-theme="dark"] .author-avatar {
  border-color: #334155;
}

[data-theme="dark"] .read-more {
  background: #1E293B;
  color: #3B82F6;
}

[data-theme="dark"] .read-more:hover {
  background: #3B82F6;
  color: #fff;
}

[data-theme="dark"] .sidebar-widget {
  background: #1E293B;
  border-color: #334155;
}

[data-theme="dark"] .widget-title {
  color: #F1F5F9;
  border-bottom-color: #1E293B;
}

[data-theme="dark"] .search-input-group {
  background: #0F172A;
  border-color: #334155;
}

[data-theme="dark"] .search-input-group:focus-within {
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .search-field {
  color: #F1F5F9;
}

[data-theme="dark"] .search-field::placeholder {
  color: #64748B;
}

[data-theme="dark"] .search-submit {
  color: #64748B;
}

[data-theme="dark"] .search-submit:hover {
  color: #3B82F6;
}

[data-theme="dark"] .categories-list li {
  border-bottom-color: #334155;
}

[data-theme="dark"] .categories-list a {
  color: #F1F5F9;
}

[data-theme="dark"] .categories-list a:hover {
  color: #3B82F6;
}

[data-theme="dark"] .categories-list .count {
  background: #0F172A;
  color: #94A3B8;
}

[data-theme="dark"] .property-item:hover {
  background: #0F172A;
}

[data-theme="dark"] .property-details h4 {
  color: #F1F5F9;
}

[data-theme="dark"] .property-details .price {
  color: #3B82F6;
}

[data-theme="dark"] .property-details .price small {
  color: #94A3B8;
}

[data-theme="dark"] .property-details .meta {
  color: #64748B;
}

[data-theme="dark"] .tag {
  background: #0F172A;
  border-color: #334155;
  color: #94A3B8;
}

[data-theme="dark"] .tag:hover {
  background: #3B82F6;
  border-color: #3B82F6;
  color: #fff;
}

[data-theme="dark"] .page-numbers {
  background: #1E293B;
  border-color: #334155;
  color: #F1F5F9;
}

[data-theme="dark"] .page-numbers:hover {
  border-color: #3B82F6;
  color: #3B82F6;
  background: #1E293B;
}

[data-theme="dark"] .page-numbers.current {
  background: #3B82F6;
  border-color: #3B82F6;
  color: #fff;
}

[data-theme="dark"] .page-numbers.dots {
  background: transparent;
  color: #64748B;
}

[data-theme="dark"] .icon-btn {
  background: #1E293B;
  border-color: #334155;
  color: #94A3B8;
}

[data-theme="dark"] .icon-btn:hover {
  background: #0F172A;
  color: #F1F5F9;
}

[data-theme="dark"] .sidebar {
  background: #0F172A;
}

@media (max-width: 900px) {
  [data-theme="dark"] .sidebar-overlay {
    background: rgba(0, 0, 0, 0.6);
  }
}