/* متغیرهای CSS */
:root {
  --namshi-primary: #262C49; /* آبی تیره سازمانی */
  --namshi-secondary: #CFAA56; /* طلایی سازمانی */
  --namshi-text: #333333;
  --namshi-light-text: #666666;
  --namshi-bg: #ffffff;
  --namshi-border: #e0e0e0;
  --namshi-light-bg: #f8f8f8;
  --namshi-radius: 8px;
  --namshi-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  --namshi-hover-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
  --namshi-transition: all 0.3s ease;
}

/* ریست استایل برای جلوگیری از تداخل با تم */
.namshi-archive-wrapper *,
.namshi-archive-wrapper *::before,
.namshi-archive-wrapper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* کانتینر اصلی */
.namshi-archive-wrapper {
  width: 100%;
  direction: rtl;
  padding: 20px 0;
}

.namshi-archive-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 15px;
}

/* گرید محصولات */
.namshi-products-wrapper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

/* کارت محصول */
.namshi-product-card {
  position: relative;
  width: 100%;
  transition: var(--namshi-transition);
}

.namshi-product-card-inner {
  background: var(--namshi-bg);
  border-radius: var(--namshi-radius);
  box-shadow: var(--namshi-shadow);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: var(--namshi-transition);
}

.namshi-product-card-inner:hover {
  box-shadow: var(--namshi-hover-shadow);
  transform: translateY(-3px);
}

/* کانتینر تصویر */
.namshi-product-img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4; /* یا هر نسبت دیگر مثل 3/4 یا 16/9 */
    background-color: var(--namshi-light-bg);
    overflow: hidden;
}

.namshi-product-img-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.namshi-product-img {
    width: 100%;
    height: auto; /* مهم برای حفظ تناسب */
    display: block; /* برای حذف فاصله پایین تصویر */
    object-fit: contain; /* یا cover بسته به نوع نمایش */
}

.namshi-product-card-inner:hover .namshi-product-img {
  transform: scale(1.05);
}

.namshi-no-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* تگ تخفیف */
.namshi-discount-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--namshi-secondary); /* رنگ طلایی سازمانی */
  color: var(--namshi-primary); /* متن آبی تیره برای تضاد بهتر با زمینه طلایی */
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.85rem;
  z-index: 1;
}

/* اطلاعات محصول */
.namshi-product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.namshi-brand-name {
  color: var(--namshi-secondary); /* رنگ طلایی سازمانی */
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.namshi-product-title-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.namshi-product-title {
  font-size: 0.95rem !important;
  font-weight: 500;
  line-height: 1.4;
  color: var(--namshi-text);
  margin-bottom: 10px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 2.8em; /* 2 خط * 1.4 line-height */
}

/* قیمت */
.namshi-price-box {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.namshi-current-price {
  font-weight: 700;
  font-size: 1rem;
  color: var(--namshi-text);
}

.namshi-old-price {
  font-size: 0.85rem;
  color: var(--namshi-light-text);
  text-decoration: line-through;
}

/* پگینیشن */
.namshi-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.namshi-page-list {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.namshi-page-number,
.namshi-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--namshi-radius);
  background-color: var(--namshi-bg);
  border: 1px solid var(--namshi-border);
  color: var(--namshi-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--namshi-transition);
}

.namshi-page-number:hover,
.namshi-nav-button:hover {
  background-color: var(--namshi-light-bg);
  border-color: var(--namshi-secondary);
  color: var(--namshi-primary);
}

.namshi-page-number.current {
  background-color: var(--namshi-primary); /* رنگ آبی تیره سازمانی */
  color: white;
  border-color: var(--namshi-primary);
}

.namshi-nav-button {
  font-weight: 600;
  padding: 0 12px;
}

.namshi-page-dots {
  margin: 0 2px;
  color: var(--namshi-light-text);
}

/* در حالت نبود محصول */
.namshi-no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  background-color: var(--namshi-light-bg);
  border-radius: var(--namshi-radius);
}

/* ریسپانسیو برای تبلت بزرگ */
@media (max-width: 1200px) {
  .namshi-products-wrapper {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ریسپانسیو برای تبلت */
@media (max-width: 992px) {
  .namshi-products-wrapper {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
  
  .namshi-product-info {
    padding: 10px;
  }
}

/* ریسپانسیو برای موبایل بزرگ */
@media (max-width: 768px) {
  .namshi-products-wrapper {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .namshi-archive-container {
    padding: 0 10px;
  }
  
  .namshi-discount-tag {
    font-size: 0.75rem;
    padding: 3px 6px;
  }
  
  .namshi-brand-name {
    font-size: 0.8rem;
  }
  
  .namshi-product-title {
    font-size: 0.85rem;
  }
  
  .namshi-current-price {
    font-size: 0.9rem;
  }
  
  .namshi-old-price {
    font-size: 0.8rem;
  }
  
  .namshi-page-number,
  .namshi-nav-button {
    min-width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
}

/* ریسپانسیو برای موبایل کوچک */
@media (max-width: 480px) {
  .namshi-products-wrapper {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .namshi-archive-wrapper {
    padding: 10px 0;
  }
  
  .namshi-product-info {
    padding: 8px;
  }
  
  .namshi-product-title {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
    max-height: 2.6em;
    margin-bottom: 8px;
  }
  
  .namshi-brand-name {
    font-size: 0.75rem;
    margin-bottom: 3px;
  }
  
  .namshi-discount-tag {
    top: 5px;
    right: 5px;
    padding: 2px 5px;
    font-size: 0.7rem;
  }
  
  .namshi-nav-button {
    padding: 0 8px;
  }
  
  .namshi-pagination {
    gap: 10px;
    margin: 20px 0;
  }
}

/* استایل خاص برای موبایل‌های خیلی کوچک */
@media (max-width: 360px) {
  .namshi-products-wrapper {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  .namshi-page-number {
    min-width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }
}
