.row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin: auto;
  max-width: 95%;
  margin-bottom: 30px;
  justify-content: center;
}

.main-container {
    display: flex; 
    flex-direction: row;
    direction: rtl; 
    width: 97%;
    margin: 0 auto; 
    padding: 10px;
    box-sizing: border-box;
}

.left-sidebar{
  margin-top: 10px;
  height: fit-content;
}

.col-lg-4,
.col-md-6,
.col-sm-12 {
  box-sizing: border-box;
  padding: 0;
}

/* دسکتاپ – 3 ستونه */
.col-lg-4 {
  flex: 0 0 calc(25% - 20px);
}

/* تبلت – 2 ستونه */
@media (max-width: 992px) {
  .col-md-6 {
    flex: 0 0 calc(50% - 20px);
  }
}

/* موبایل – تک ستونه */
@media (max-width: 576px) {
  .col-sm-12 {
    flex: 0 0 100%;
  }
}

/* ======== استایل کارت‌های محصول ======== */
.custom-product-card {
  flex-direction: row-reverse;
  align-items: stretch;
  justify-content: space-between;
  gap: 15px;
  height: 120px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.custom-product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-light) 0%, #00d4ff 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}

.custom-product-card:hover::before {
  opacity: 0.06;
}

.custom-product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

/* عکس سمت چپ */
.card-product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
  display: block;
}

.custom-product-card:hover .card-product-image {
  transform: scale(1.05);
}

/* بخش راست (عنوان + دکمه) */
.card-main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex-grow: 1;
  position: relative;
  z-index: 1;
  justify-content: space-between;
  height: 80px;
}

/* عنوان */
.card-product-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #222;
  text-align: center;
}

.card-product-title a {
  color: inherit;
  text-decoration: none;
}

.card-product-title a:hover {
  color: var(--primary);
}

/* دکمه مشاهده قیمت */
.card-product-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(90deg, var(--primary-light) 0%, #00d4ff 100%);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(0, 153, 247, 0.3);
  transition: all 0.3s ease;
  margin-top: auto;
}

.card-product-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0, 153, 247, 0.45);
  background: linear-gradient(90deg, #00d4ff 0%, var(--primary-light) 100%);
}

/* ======= ریسپانسیو ======= */
@media (max-width: 992px) { /* تبلت: دو ستونه */
  .col-md-6 {
    flex: 0 0 50%;
    max-width: 48%;
  }
  .custom-product-card {
    padding: 5px;
  }
}

@media (max-width: 768px) { /* موبایل: تک ستونه */
  .custom-product-card {
    flex-direction: column-reverse;
    text-align: center;
    align-items: center;
  }

  .card-main-content {
    align-items: center;
  }

  .card-product-image {
    width: 100%;
  }

  .card-product-btn {
    width: 100%;
    justify-content: center;
  }
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 10px;
    flex-grow: 1;
}

.article-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform .3s ease, box-shadow .3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: fit-content;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.12);
}

.article-image img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    display: block;
}

.article-contentt {
    padding: 15px;
    display: flex;
    flex-direction: column;
}

/* عنوان دو خطی */
.article-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* توضیح دو خطی */
.article-desc {
    font-size: 0.92rem;
    color: #666;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* پایین کارت */
.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.article-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #666;
}

/* لینک بیشتر بخوانید */
.article-readmore {
    font-size: 0.9rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color .3s ease;
}

.article-readmore svg{
  transform: scaleX(-1);
}

.article-readmore:hover {
    color: var(--primary-light);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
    direction: rtl;
}

.page-btn {
    padding: 8px 14px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s ease, color .2s ease, transform .2s ease;
}

.page-btn:hover {
    background: #f0f6ff;
}

.page-btn.active {
    background: var(--primary-light);
    color: #fff;
    font-weight: 700;
}

.page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.page-dots {
    padding: 8px;
    color: #777;
}

/* blog_single */
.blog-container {
  max-width: 95%;
  margin: 0 auto;
  padding: 20px;
}

.blog-row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 auto; 
  gap: 20px;
}

[class*="col-"] {
  padding: 0 ; 
  box-sizing: border-box;
}

/* برای طرح‌بندی ریپانسیو (مثلا استفاده از Bootstrap Grid System) */
.col-lg-3 { width: 25%; float: right; }
.col-lg-4 { width: 25%; float: right; }
.col-lg-8 { width: 66.66%; float: right; }
.col-lg-9 { width: 75%; float: right; }
.col-md-4 { width: 33.33%; float: right; }
.col-md-8 { width: 66.66%; float: right; }

/* Media Queries برای ریپانسیو بودن */
@media (max-width: 992px) { /* برای تبلت‌ها و صفحه‌های کوچکتر */
  .col-lg-3 { width: 100%; float: none; margin-bottom: 30px; }
  .col-lg-9 { width: 100%; float: none; }
  .blog-sidebar { order: 1; } /* سایدبار بعد از محتوا در موبایل */
  .blog-content { order: 2; }
}

@media (max-width: 768px) { /* برای موبایل */
  .col-md-4 { width: 100%; float: none; }
  .col-md-8 { width: 100%; float: none; }
}

/* --- استایل‌های سایدبار سمت چپ --- */
.blog-sidebar {
  gap: 20px;
  margin-bottom: 30px;
}

.blog-sidebar h4 {
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 15px;
  color: var(--primary); 
}
    
.sidebar-section {
  margin-bottom: 25px;
  direction: rtl;
  max-width: 280px;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

.sidebar-section h4{
  padding-right: 20px;
}
    
.toc-list {
  list-style: none;
  padding: 20px;
  margin: 0;
}
    
.toc-list li {
  margin-bottom: 12px;
}

.toc-list a {
  text-decoration: none;
  color: var(--primary-light); /* رنگ آبی */
  transition: color 0.3s ease;
  gap:10px;
}

.toc-list a:hover, .toc-list a:focus {
  color: var(--primary); /* آبی تیره‌تر */
  text-decoration: underline;
}

/* استایل برای فعال بودن لینک فهرست مطالب (وقتی کاربر به آن بخش اسکرول کرده) */
.toc-list a.active-toc-link {
  font-weight: bold;
  color: #d32f2f; /* قرمز */
}

.toc-icon{
    flex-shrink:0;
    color:#e67e22;
    padding-left: 5px;
}

/* --- استایل‌های محتوای اصلی سمت راست --- */
.blog-content {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  padding: 30px;
}

.post-header {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.post-title {
  font-size: 2.5em; /* سایز بزرگتر برای عنوان */
  margin-bottom: 10px;
  color: #333;
  line-height: 1.3;
}

.post-meta-info {
  font-size: 0.95em;
  color: #6c757d; /* خاکستری */
  margin-top: 20px;
}
    
.post-meta-info span {
  margin-left: 30px; /* فاصله بین آیتم‌های متا */
  display: inline-flex;
  align-items: center;
}

.post-image-container {
  margin: 20px 0;
  text-align: center;
  margin-top: 0;
}

.post-main-image {
  max-width: 100%;
  height: 400px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
    
.post-image-container figcaption {
  font-size: 0.85em;
  color: #6c757d;
  margin-top: 8px;
  font-style: italic;
}

.blog-main-content {
  font-size: 1.1em;
  color: #444;
  margin-top: 30px;
}
    
/* استایل برای تگ‌های h3 داخل محتوا */
.blog-main-content h3 {
  font-size: 1.8em;
  margin-top: 40px;
  margin-bottom: 20px;
  color: #2c3e50; /* آبی/خاکستری تیره */
  scroll-margin-top: 80px; /* فضای بالای H3 برای فهرست مطالب */
}
    
.blog-main-content p {
  margin-bottom: 1.5em;
}
    
.blog-main-content img { /* استایل تصاویر داخل محتوا */
  max-width: 100%;
  height: auto;
  display: block;
  margin: 20px auto;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
    
.blog-main-content ul, .blog-main-content ol {
  margin-bottom: 1.5em;
  padding-right: 20px; /* فضای داخلی لیست‌ها */
}
    
.blog-main-content li {
  margin-bottom: 0.8em;
}
    
.blog-main-content blockquote {
  border-right: 4px solid var(--primary-light);
  padding-right: 15px;
  margin-right: 0;
  margin-left: 0;
  font-style: italic;
  color: #555;
}

/* --- استایل‌های فوتر مقاله (اشتراک‌ گذاری و امتیازدهی) --- */
.post-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--invoice-border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* برای ریپانسیو بودن */
}
    
.sharing-section {
  display: flex;
  align-items: center;
  gap: 40px; /* فاصله بین قسمت اشتراک‌گذاری و امتیازدهی */
  flex-wrap: wrap;
}
    
.share-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}
    
.share-buttons span {
  font-weight: bold;
  color: #555;
}
    
.share-icon {
  color: #6c757d;
  font-size: 1.4em;
  transition: color 0.3s ease;
  text-decoration: none;
}
    
.share-icon:hover {
  color: var(--primary-light);
}
    
.copy-link-icon { /* استایل خاص آیکون کپی لینک */
  cursor: pointer;
}

.gap-4 {
    gap: 16px;
}
.items-center {
    align-items: center;
    cursor: pointer;
}
.flex {
    display: flex;
    margin-top: 5px;
}

.rating-section {
  display: flex;
  align-items: center;
  gap: 10px;
}
    
.rating-section span {
  font-weight: bold;
  color: #555;
}
    
.star-rating {
  color: #ffc107; /* رنگ زرد ستاره */
  font-size: 1.5em;
  cursor: pointer;
}
    
.star-rating .far.fa-star { /* استایل ستاره خالی */
  color: #ccc;
}
    
.star-rating .fas.fa-star ~ .far.fa-star { /* ستاره‌های خالی بعد از ستاره‌های پر */
  color: #ccc;
}

.rating-container {
  display: flex;
  gap: 6px;
  cursor: pointer;
}

.rating-container .star {
  width: 26px;
  height: 26px;
  fill: #ccc;
  transition: fill 0.2s ease;
}

.rating-container .star.active {
  fill: #f7c51d;
}

/* --- استایل‌های مقالات مرتبط --- */
.related-articles-section{
    margin-top:60px;
}

.related-articles-section h2{
    margin-bottom:25px;
    font-size:24px;
    font-weight:700;
}

.related-articles-slider{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:20px;
}

.related-article-item{
    border:1px solid #ececec;
    border-radius:12px;
    overflow:hidden;
    transition:.3s;
    background:#fff;
}

.related-article-item:hover{
    transform:translateY(-5px);
    box-shadow:0 10px 25px rgba(0,0,0,.08);
}

.related-article-item img{
    width:100%;
    height:180px;
    object-fit:cover;
}

.related-content{
    padding:15px;
}

.related-content h3{
    font-size:16px;
    line-height:28px;
    height:56px;
    overflow:hidden;
    margin-bottom:10px;
}

.related-date{
    color:#888;
    font-size:13px;
}

.no-related{
    width:100%;
    text-align:center;
    padding:30px;
}
    

/* ---- Media Queries برای ریپانسیو بودن ---- */
@media (max-width: 767px) {
  .post-title { font-size: 2em; }
  .blog-content { font-size: 1em; }
  .blog-sidebar { padding: 15px; }
  .blog-content { padding: 20px; }
  .post-footer { flex-direction: column; gap: 20px; align-items: center; }
  .sharing-section { flex-direction: column; gap: 15px; width: 100%; }
  .share-buttons, .rating-section { width: 100%; justify-content: center; }
  .related-article-item { flex: 0 0 250px; } /* کمی کوچکتر در موبایل */
}
     
@media (max-width: 480px) {
  .post-title { font-size: 1.8em; }
  .share-icon { font-size: 1.2em; }
  .star-rating { font-size: 1.3em; }
  .related-article-item { flex: 0 0 220px; }
}

#toast{
    position:fixed;
    top:30px;
    left:30px;
    background:#222;
    color:#fff;
    padding:14px 22px;
    border-radius:10px;
    font-size:14px;
    z-index:99999;
    opacity:0;
    transform:translateY(-20px);
    transition:.35s;
    pointer-events:none;
    box-shadow:0 10px 30px rgba(0,0,0,.2);
}

#toast.show{
    opacity:1;
    transform:translateY(0);
}

#toast.success{
    background:#16a34a;
}

#toast.error{
    background:#dc2626;
}

@media (max-width: 768px){

  .blog-container {
    max-width: 90%;
    margin: 0 auto;
    padding: 20px;
  }

  .blog-content{
    padding: 18px;
    border-radius: 12px;
  }

  .post-title{
    font-size: 1.6rem;
  }

  .post-main-image{
    height: 220px;
  }

  .post-footer{
    flex-direction: column;
    align-items: center;
  }

  .related-articles-slider{
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
  }

  .related-article-item{
    flex: 0 0 260px;
    scroll-snap-align: start;
  }

  .related-articles-slider{
    scrollbar-width: none;
  }

  .related-articles-slider::-webkit-scrollbar{
    display: none;
  }

  .left-sidebar{
    width: 90%;
    margin-top: 10px;
    height: fit-content;

  }
}

@media (max-width: 900px){
  .blog-row{
    grid-template-columns: 1fr;
  }

  .blog-sidebar{
    order: 2;
  }

  .blog-content{
    order: 1;
  }
}