/* ==========================================================================
   ads.css — فهرست آگهی‌ها
   ========================================================================== */

/* ---------- هیرو صفحه ---------- */
.sp-hero {
  padding: 14px 14px 16px;
  border-radius: var(--r-card-lg);
  background: linear-gradient(165deg, #fffdf8, #f6ecdb);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.sp-hero h1 {
  font-size: 19px;
  text-align: start;
  margin-bottom: 5px;
}

.sp-hero-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--ref-hero-sub-color);
  margin-bottom: 11px;
  line-height: 1.8;
}

.sp-hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.sp-fact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: #fff;
  border: 1px solid var(--sadaf-line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--sadaf-muted);
}

.sp-fact b {
  color: var(--sadaf-gold);
  font-weight: 800;
}

.sp-fact svg {
  width: 15px;
  height: 15px;
  color: var(--sadaf-gold);
}

/* نوار فیلتر کمی فشرده‌تر از کارت پیش‌فرض */
.sp-card.ads-filter-v2 {
  padding: 13px 11px 12px;
  margin-bottom: 2px;
}

.sp-card.ads-filter-v2 h2 { margin-bottom: 9px; }

/* ---------- چیپ‌های فیلتر فعال ---------- */
.ads-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--sadaf-line);
}

.ads-active-chips[hidden] { display: none; }

.ads-active-chips .ads-chip-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sadaf-muted);
  align-self: center;
  padding-inline-end: 2px;
}

/* ---------- بدنه کارت ردیفی ---------- */
.row-body { min-width: 0; }

.ads-empty-note {
  margin: 8px 2px;
  padding: 14px;
  border-radius: 14px;
  background: #fbf6ec;
  border: 1px dashed rgba(184, 137, 59, .45);
  font-size: 12.5px;
  font-weight: 600;
  color: #6b5730;
  text-align: center;
}

.ads-empty-note[hidden] { display: none; }

/* ردیف‌هایی که با JS پنهان می‌شوند */
.sadaf-ads-row-wrap-v2[hidden] { display: none; }

/* ---------- صفحه‌بندی ---------- */
.ads-page-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 2px 4px;
}

.ads-page-navigation .page-link,
.ads-page-navigation .page-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--sadaf-line);
  background: #fff;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sadaf-text);
  transition: background var(--t-fast), border-color var(--t-fast);
}

.ads-page-navigation .page-link:hover {
  background: #fdf6e8;
  border-color: rgba(184, 137, 59, .45);
}

.ads-page-navigation .page-current {
  background: var(--sadaf-gold);
  border-color: var(--sadaf-gold);
  color: #fffdf8;
}

.ads-page-navigation .page-dots {
  color: var(--sadaf-muted);
  font-size: 14px;
  padding: 0 2px;
}

.ads-page-navigation .page-link i {
  font-style: normal;
  margin-inline-start: 4px;
}

/* ---------- متن سئو ---------- */
.ads-route-seo-intro {
  margin: 18px 2px 0;
  padding: 14px 12px;
  border-radius: var(--r-card-lg);
  background: var(--sadaf-card);
  box-shadow: var(--shadow);
}

.ads-route-seo-intro h2 {
  font-size: 14.5px;
  margin-bottom: 8px;
}

.ads-route-seo-intro p {
  font-size: 12px;
  line-height: 2;
  margin-bottom: 9px;
}

.ads-route-seo-intro p:last-child { margin-bottom: 0; }

.ads-route-seo-intro a {
  color: var(--sadaf-gold);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 380px) {
  .sp-hero { padding: 12px 11px 13px; }
  .sp-hero h1 { font-size: 17.5px; }
  .sp-fact { height: 28px; padding: 0 9px; font-size: 11px; }
  .ads-page-navigation .page-link,
  .ads-page-navigation .page-current { min-width: 36px; height: 36px; }
}

@media (max-width: 340px) {
  .sp-hero-facts { gap: 5px; }
  .sp-fact:nth-child(2) { display: none; }
}

/* ==========================================================================
   فیلترهای سمت سرور (نسخه‌ی PHP) — بدون جاوااسکریپت هم کار می‌کند
   ========================================================================== */
.ads-ssr-form { display: grid; gap: 10px; }

.ads-ssr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ads-ssr-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--sadaf-muted);
}

.ads-ssr-field > span { padding-inline-start: 4px; }

.ads-ssr-field select,
.ads-ssr-field input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--sadaf-line);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--sadaf-text);
  font: inherit;
  font-size: 13px;
}

.ads-ssr-field select:focus-visible,
.ads-ssr-field input:focus-visible {
  outline: 2px solid var(--sadaf-gold);
  outline-offset: 1px;
}

.ads-ssr-field input:disabled { opacity: .65; }

.ads-ssr-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ads-active-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.ads-chip-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--sadaf-line);
  border-radius: 999px;
  background: #fbf6ec;
  color: var(--sadaf-text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.ads-chip-tag span { color: var(--sadaf-muted); font-size: 14px; }

@media (min-width: 640px) {
  .ads-ssr-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==========================================================================
   چیدمان تخت فهرست آگهی‌ها — هم‌راستا با سایت مرجع
   هدر و فیلترها کارت گرادیانی ندارند و آگهی‌ها ردیف‌هایی با خط جداکننده‌اند.
   ========================================================================== */

/* هدر: فقط عنوان و یک خط توضیح، جدا شده با یک خط نازک */
.sp-hero {
  padding: 2px 2px 12px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border-bottom: 1px solid var(--sadaf-line);
  margin-bottom: 12px;
}

.sp-hero h1 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.sp-hero-sub { margin-bottom: 0; }

/* فیلتر: بدون کارت؛ جست‌وجو در خط اول و پنل پیشرفته تا باز شدن پنهان است */
.ads-filter-lux { padding: 0 2px 4px; }

.ads-filter-lux .ads-ssr-form { gap: 9px; }

/* دکمه‌ی «جستجوی پیشرفته» در سمت چپ خط، مثل سایت مرجع */
.ads-advanced { text-align: left; }

.ads-advanced > .ads-ssr-grid,
.ads-advanced > .ads-ssr-actions { text-align: right; }

.ads-advanced[open] > summary { margin-bottom: 10px; }

/* باز/بسته شدن مطمئن در همه‌ی مرورگرها؛ برخی موتورها display محتوای
   details بسته را با استایل نویسنده بازنویسی می‌کنند. */
.ads-advanced:not([open]) > .ads-ssr-grid,
.ads-advanced:not([open]) > .ads-ssr-actions { display: none; }

.ads-advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(184, 137, 59, .45);
  background: transparent;
  color: var(--sadaf-gold);
  font-size: 11.5px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.ads-advanced-toggle::-webkit-details-marker { display: none; }

.ads-advanced-toggle:hover { background: #fdf6e8; }

.ads-advanced[open] .ads-advanced-toggle {
  background: #fff7e9;
  border-color: var(--sadaf-gold);
}

.ads-advanced-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

/* ردیف آگهی: بدون کارت، بدون سایه، فقط خط جداکننده */
.sadaf-ads-list-v2 { gap: 0; margin-top: 6px; }

.sadaf-ads-row-wrap-v2 { border-bottom: 1px solid var(--sadaf-line); }

.sadaf-ads-row-wrap-v2:last-child { border-bottom: 0; }

.sadaf-ads-row-v2 {
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 2px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sadaf-ads-row-v2:hover {
  transform: none;
  box-shadow: none;
}

.sadaf-ads-photo-v2 { border-radius: 12px; }

.sadaf-ads-row-v2 strong {
  font-size: 13.5px;
  font-weight: 800;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 7px;
}

.sadaf-ads-row-v2 .row-price {
  color: var(--sadaf-text);
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.sadaf-ads-row-v2 .row-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.sadaf-ads-row-v2 .row-meta::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sadaf-gold);
  opacity: .65;
}

@media (max-width: 380px) {
  .sadaf-ads-row-v2 { grid-template-columns: 112px minmax(0, 1fr); gap: 10px; }
  .sp-hero h1 { font-size: 17px; }
}
