/* قاب مشترک صفحه‌های لیست (تصویربردارها، تجهیزات، آگهی‌ها) — ListShell + FilterControls + ActiveFilters */

/* ListShell.module.css (پیشوند ls-) */

/* ==========================================================================
   Public directory shell — dark only.
   The admin panel has a light mode because people work in it for hours; the
   public site does not, and mixing the two would make the site feel like two
   different products.
   ========================================================================== */

.ls-page {
  --bg: #0b0b0d;
  --rail: #121215;
  --tile: #141417;
  --tile-2: #1b1b1f;
  --line: rgba(255, 255, 255, .08);
  --fg: #f4f4f6;
  --fg-2: #a8a8b0;
  --fg-3: #6c6c76;
  --accent: #a855c9;

  position: relative;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  direction: rtl;
  overflow-x: hidden;
}

.ls-glowTop, .ls-glowBottom {
  position: absolute; inset-inline: 0; width: 100%; height: auto;
  pointer-events: none; user-select: none; z-index: 20;
}
.ls-glowTop { top: 0; }
.ls-glowBottom { bottom: 0; }

.ls-header {
  position: relative; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
}
.ls-brand { display: block; width: 38px; color: var(--fg); }
.ls-brand svg { width: 100%; height: auto; display: block; }

.ls-shell {
  position: relative; z-index: 25;
  display: grid;
  grid-template-columns: 244px 1fr;
  gap: 18px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 120px;
  align-items: start;
}

/* ---------- filter rail ---------------------------------------------- */

.ls-rail {
  background: var(--rail);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 18px;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}
.ls-filterForm { display: flex; flex-direction: column; gap: 18px; }

.ls-railHead { display: flex; align-items: center; justify-content: space-between; }
.ls-railTitle { font-size: 14px; font-weight: 700; }
.ls-railClose {
  display: none; background: none; border: none; color: var(--fg-2);
  font-size: 17px; cursor: pointer; padding: 0 4px;
}

.ls-filterActions { display: flex; gap: 8px; padding-top: 4px; }
.ls-applyBtn {
  flex: 1; padding: 11px; border-radius: 12px; border: none;
  background: var(--fg); color: #0b0b0d;
  font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.ls-clearBtn {
  padding: 11px 16px; border-radius: 12px;
  border: 1px solid var(--line); color: var(--fg-2);
  font-size: 13px; text-decoration: none; white-space: nowrap;
}
.ls-clearBtn:hover { color: var(--fg); }

/* ---------- content --------------------------------------------------- */

.ls-content { min-width: 0; }
.ls-contentHead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 20px; padding-top: 4px;
}
.ls-title { font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; margin: 0; letter-spacing: -.02em; }
.ls-count { font-size: 13px; color: var(--fg-2); margin: 5px 0 0; }
.ls-headActions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.ls-filterToggle {
  display: none; padding: 10px 18px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--tile);
  color: var(--fg); font-size: 13px; font-family: inherit; cursor: pointer;
}

.ls-scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .55);
}

@media (max-width: 900px) {
  .ls-shell { grid-template-columns: 1fr; padding-bottom: 140px; }
  /* Anchored to a physical edge on purpose: `inset-inline-end` flips with
     the writing direction but `translateX` does not, and mixing the two put
     the drawer permanently on screen in this right-to-left layout. */
  .ls-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: min(300px, 88vw);
    z-index: 60;
    border-radius: 0;
    max-height: none;
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .22s ease, visibility 0s linear .22s;
    overflow-y: auto;
    box-shadow: 18px 0 44px rgba(0, 0, 0, .45);
  }
  .ls-railOpen {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    /* Visible immediately on the way in; hidden only after the slide out. */
    transition: transform .22s ease, visibility 0s;
  }
  .ls-railClose { display: block; }
  .ls-filterToggle { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .ls-rail { transition: none; }
}

/* ---------- stat row -----------------------------------------------------
   A short read on the whole list before anyone narrows it. Deliberately flat
   cards with no borders competing with the result cards below. */

.ls-statRow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.ls-statCard {
  background: var(--tile, #141417);
  border: 1px solid var(--line, rgba(255,255,255,.08));
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ls-statValue { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.ls-statLabel { font-size: 11.5px; color: var(--fg-3, #6c6c76); }

/* ---------- sort ---------------------------------------------------------- */

.ls-sortWrap { position: relative; }
.ls-sortSelect {
  appearance: none;
  background: var(--tile, #141417);
  border: 1px solid var(--line, rgba(255,255,255,.08));
  border-radius: 20px;
  padding: 10px 34px 10px 16px;
  color: var(--fg-2, #a8a8b0);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.ls-sortSelect:hover { color: var(--fg, #f4f4f6); }
.ls-sortSelect option { background: #16161a; color: #f4f4f6; }
.ls-sortWrap::after {
  content: '';
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--fg-3, #6c6c76);
  border-bottom: 1.5px solid var(--fg-3, #6c6c76);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* The sort control sits in its own form so changing it submits only the sort
   while carrying the active filters along as hidden fields. */
.sortForm { display: inline-flex; }

/* FilterControls.module.css (پیشوند fc-) */

.fc-group { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.fc-legend { font-size: 11px; color: var(--fg-3, #6c6c76); letter-spacing: .04em; padding: 0; margin-bottom: 2px; }

.fc-input, .fc-select {
  width: 100%;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line, rgba(255,255,255,.08));
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--fg, #f4f4f6);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.fc-input::placeholder { color: var(--fg-3, #6c6c76); }
.fc-input:focus, .fc-select:focus { border-color: rgba(255, 255, 255, .3); }
.fc-select option { background: #16161a; color: #f4f4f6; }

.fc-range { display: flex; align-items: center; gap: 7px; }
.fc-rangeDash { color: var(--fg-3, #6c6c76); font-size: 12px; }

.fc-checks { display: flex; flex-direction: column; gap: 7px; }
.fc-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--fg-2, #a8a8b0); cursor: pointer;
}
.fc-check input { width: 16px; height: 16px; accent-color: #fff; flex-shrink: 0; }

/* ActiveFilters.module.css (پیشوند af-) */

.af-row {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.af-lead { font-size: 11.5px; color: var(--fg-3, #6c6c76); margin-inline-end: 2px; }

.af-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; padding: 6px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent, #a855c9) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #a855c9) 28%, transparent);
  color: var(--fg, #f4f4f6); text-decoration: none;
  transition: background .15s ease;
}
.af-chip:hover { background: color-mix(in srgb, var(--accent, #a855c9) 30%, transparent); }
.af-x { font-size: 10px; opacity: .7; }

.af-clearAll {
  font-size: 11.5px; color: var(--fg-3, #6c6c76);
  text-decoration: underline; text-underline-offset: 3px;
}
.af-clearAll:hover { color: var(--fg, #f4f4f6); }

.af-sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- اضافه‌ی نسخه‌ی PHP -------------------------------------------
   پرده‌ی بلور تیره‌ی بالای صفحه (partials/scroll-veil.php، z 1 داخل .ls-shell) جای
   عکس‌های glow-top/glow-bottom را گرفته (درخواست کاربر). ستون فیلتر چسبان روی دسکتاپ
   بالای پرده می‌ماند تا خودش تیره نشود. */
@media (min-width: 901px) {
  .ls-rail { z-index: 2; }
}

/* کشوی فیلتر موبایل داخل .ls-shell (z 25) است و هدر z 30 دارد؛ در نسخه‌ی قدیم سرِ کشو و دکمه‌ی ✕
   زیر هدر می‌ماند. وقتی کشو باز است، لایه‌ی shell بالای هدر می‌آید. */
.ls-shell.ls-drawerOpen { z-index: 31; }
