/* =========================================================
   Yooz — Loans archive (/loans/)
   سایدبار فیلتر (راست) + کارت‌های وام (چپ) + نوار مرتب‌سازی (بالا)
   رنگ‌ها و شعاع‌ها هم‌خانواده‌ی صفحه‌ی وام و کارت «پنل آبی».
   ========================================================= */

.yz-la {
  --yz-color-primary-soft: #e8f1fd;
  --yz-color-primary-deep: #0b3d86;
  --yz-la-radius: 28px;
  --yz-la-radius-md: 14px;
  --yz-la-radius-sm: 12px;
  --yz-la-sidebar: 300px;
  --yz-la-sticky-top: calc(var(--yz-header-height, 80px) + 24px);
  --yz-la-ease: cubic-bezier(.22, .8, .24, 1);

  padding: 32px 24px 96px;
  font-family: var(--yz-font, "Vazirmatn", Tahoma, sans-serif);
  color: var(--yz-color-text, #1c1c1e);
  line-height: 1.7;
}
.yz-la *, .yz-la *::before, .yz-la *::after { box-sizing: border-box; }
.yz-la h1, .yz-la h2, .yz-la p { margin: 0; }
.yz-la :focus-visible { outline: 3px solid var(--yz-color-primary, #1a73e8); outline-offset: 2px; border-radius: 8px; }

.yz-la__container {
  max-width: var(--yz-hf-container-width, 1280px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- Head ---------- */
.yz-la__head { display: flex; flex-direction: column; gap: 8px; }
.yz-la__crumbs { display: flex; flex-wrap: wrap; gap: 10px; font-size: 14px; color: var(--yz-color-text-muted, #6b7280); }
.yz-la__crumbs a { color: var(--yz-color-text-muted, #6b7280); text-decoration: none; }
.yz-la__crumbs a:hover { color: var(--yz-color-primary, #1a73e8); }
.yz-la__crumbs [aria-current] { color: var(--yz-color-heading, #101828); font-weight: 600; }
.yz-la__title { font-size: clamp(28px, 3.2vw, 42px); font-weight: 900; line-height: 1.4; color: var(--yz-color-heading, #101828); }
.yz-la__lead { font-size: clamp(15px, 1.2vw, 17px); color: var(--yz-color-gray-600, #4b5563); max-width: 720px; }

/* ---------- Toolbar ---------- */
.yz-la__toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px 10px 20px;
  border: 1px solid var(--yz-color-border, #e5e7eb);
  border-radius: 20px;
  background: var(--yz-color-bg, #fff);
}
.yz-la__sort { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.yz-la__sort-label { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--yz-color-gray-700, #374151); }
.yz-la__sort-label svg { width: 18px; height: 18px; color: var(--yz-color-gray-400, #9ca3af); }
.yz-la__sort-list { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.yz-la__sort-list::-webkit-scrollbar { display: none; }
.yz-la__sort-link {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  height: 38px; padding: 0 14px; border-radius: 9999px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  color: var(--yz-color-gray-600, #4b5563); text-decoration: none;
  transition: background-color .2s, color .2s;
}
.yz-la__sort-link:hover { background: var(--yz-color-bg-soft, #f5f6f8); color: var(--yz-color-heading, #101828); }
.yz-la__sort-link[aria-current] { background: var(--yz-color-primary-soft); color: var(--yz-color-primary, #1a73e8); font-weight: 800; }
.yz-la__count { flex-shrink: 0; margin-inline-start: auto; font-size: 14px; color: var(--yz-color-text-muted, #6b7280); white-space: nowrap; }
.yz-la__count strong { font-size: 16px; font-weight: 900; color: var(--yz-color-heading, #101828); }

.yz-la__filter-btn {
  display: none;
  flex-shrink: 0;
  align-items: center; gap: 8px;
  height: 42px; padding: 0 14px; border-radius: var(--yz-la-radius-sm);
  border: 1px solid var(--yz-color-border, #e5e7eb); background: var(--yz-color-bg, #fff);
  font: inherit; font-size: 14px; font-weight: 800; color: var(--yz-color-heading, #101828);
  cursor: pointer;
}
.yz-la__filter-btn svg { width: 18px; height: 18px; }
.yz-la__badge {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 9999px;
  display: inline-grid; place-items: center;
  background: var(--yz-color-primary, #1a73e8); color: #fff; font-size: 12px; font-weight: 800;
}

/* ---------- Layout ---------- */
.yz-la__layout {
  display: grid;
  grid-template-columns: var(--yz-la-sidebar) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* ---------- Sidebar / form ---------- */
.yz-la__sidebar {
  position: sticky;
  top: var(--yz-la-sticky-top);
  max-height: calc(100vh - var(--yz-la-sticky-top) - 24px);
  display: flex;
}
.yz-la__form {
  width: 100%;
  display: flex; flex-direction: column;
  border: 1px solid var(--yz-color-border, #e5e7eb);
  border-radius: var(--yz-la-radius);
  background: var(--yz-color-bg, #fff);
  overflow: hidden;
}
.yz-la__form-head {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--yz-color-border-soft, #f3f4f6);
}
.yz-la__form-title { font-size: 17px; font-weight: 900; color: var(--yz-color-heading, #101828); }
.yz-la__form-head [data-yz-la-swap="reset"] { margin-inline-start: auto; }
.yz-la__reset { font-size: 13px; font-weight: 700; color: var(--yz-color-danger, #e53935); text-decoration: none; }
.yz-la__reset:hover { color: #b3261e; }
.yz-la__close {
  display: none;
  width: 38px; height: 38px; padding: 0; border: 0; border-radius: var(--yz-la-radius-sm);
  background: var(--yz-color-bg-soft, #f5f6f8); color: var(--yz-color-gray-600, #4b5563);
  place-items: center; cursor: pointer;
}
.yz-la__close svg { width: 18px; height: 18px; }

.yz-la__form-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 20px 8px; overscroll-behavior: contain; }
.yz-la__form-foot { flex-shrink: 0; padding: 14px 20px 18px; border-top: 1px solid var(--yz-color-border-soft, #f3f4f6); }
.yz-la.is-js .yz-la__form-foot { display: none; } /* با JS فیلترها خودکار اعمال می‌شوند */

.yz-la__apply {
  width: 100%; height: 50px; border: 0; border-radius: var(--yz-la-radius-sm);
  background: var(--yz-color-primary, #1a73e8); color: #fff;
  font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(26, 115, 232, .6);
  transition: background-color .2s;
}
.yz-la__apply:hover { background: var(--yz-color-primary-dark, #0f4fa8); }

/* جستجو و فیلدهای عددی */
.yz-la__search,
.yz-la__field {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--yz-la-radius-md);
  background: var(--yz-color-bg-soft, #f5f6f8);
  transition: border-color .2s, background-color .2s;
}
.yz-la__search:focus-within,
.yz-la__field:focus-within { border-color: var(--yz-color-primary, #1a73e8); background: var(--yz-color-bg, #fff); }
.yz-la__search svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--yz-color-gray-400, #9ca3af); }
.yz-la__search input,
.yz-la__field input {
  flex: 1 1 auto; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent; padding: 0;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--yz-color-heading, #101828);
}
.yz-la__search input:focus-visible,
.yz-la__field input:focus-visible { outline: none; }
.yz-la__search input::placeholder,
.yz-la__field input::placeholder { color: var(--yz-color-gray-400, #9ca3af); font-weight: 400; }
.yz-la__field-label { flex-shrink: 0; font-size: 12.5px; color: var(--yz-color-text-muted, #6b7280); }
.yz-la__field-unit { flex-shrink: 0; font-size: 12px; color: var(--yz-color-gray-400, #9ca3af); }
.yz-la__range { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.yz-la__sublabel { display: block; margin: 4px 0 8px; font-size: 13px; color: var(--yz-color-text-muted, #6b7280); }
.yz-la__sublabel:not(:first-child) { margin-top: 14px; }

/* سوییچ‌ها */
.yz-la__toggles { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--yz-color-border-soft, #f3f4f6); }
.yz-la__toggle {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--yz-color-gray-700, #374151);
}
.yz-la__toggle input { position: absolute; opacity: 0; pointer-events: none; }
.yz-la__switch {
  flex-shrink: 0; position: relative;
  width: 42px; height: 24px; border-radius: 9999px;
  background: var(--yz-color-gray-300, #d1d5db);
  transition: background-color .2s;
}
.yz-la__switch::after {
  content: ""; position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .2);
  transition: transform .25s var(--yz-la-ease);
}
.yz-la__toggle input:checked + .yz-la__switch { background: var(--yz-color-primary, #1a73e8); }
.yz-la__toggle input:checked + .yz-la__switch::after { transform: translateX(-18px); }
.yz-la__toggle input:focus-visible + .yz-la__switch { outline: 3px solid var(--yz-color-primary, #1a73e8); outline-offset: 2px; }

/* گروه‌های تاشو */
.yz-la__group { border-bottom: 1px solid var(--yz-color-border-soft, #f3f4f6); }
.yz-la__group:last-child { border-bottom: 0; }
.yz-la__group summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 800; color: var(--yz-color-heading, #101828);
}
.yz-la__group summary::-webkit-details-marker { display: none; }
.yz-la__chevron { width: 18px; height: 18px; color: var(--yz-color-gray-400, #9ca3af); transition: transform .25s var(--yz-la-ease); }
.yz-la__group[open] .yz-la__chevron { transform: rotate(180deg); }
.yz-la__group-body { padding-bottom: 16px; }

.yz-la__group-search {
  width: 100%; height: 38px; margin-bottom: 8px; padding: 0 12px;
  border: 1px solid var(--yz-color-border, #e5e7eb); border-radius: var(--yz-la-radius-sm);
  background: var(--yz-color-bg, #fff);
  font: inherit; font-size: 13px;
}
.yz-la__group-search:focus { outline: 0; border-color: var(--yz-color-primary, #1a73e8); }

/* چک‌باکس‌ها */
.yz-la__checks { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.yz-la__checks.is-scroll { max-height: 250px; overflow-y: auto; margin-inline-end: -8px; padding-inline-end: 4px; }
.yz-la__checks li[hidden] { display: none; }
.yz-la__check {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; margin-inline: -8px; border-radius: var(--yz-la-radius-sm);
  cursor: pointer; font-size: 14px; color: var(--yz-color-gray-700, #374151);
  transition: background-color .15s;
}
.yz-la__check:hover { background: var(--yz-color-bg-soft, #f5f6f8); }
.yz-la__check input { position: absolute; opacity: 0; pointer-events: none; }
.yz-la__box {
  flex-shrink: 0; position: relative;
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--yz-color-gray-300, #d1d5db); background: var(--yz-color-bg, #fff);
  transition: background-color .15s, border-color .15s;
}
.yz-la__box::after {
  content: ""; position: absolute; top: 3px; right: 6px;
  width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform .15s var(--yz-la-ease);
}
.yz-la__check input:checked + .yz-la__box { background: var(--yz-color-primary, #1a73e8); border-color: var(--yz-color-primary, #1a73e8); }
.yz-la__check input:checked + .yz-la__box::after { transform: rotate(45deg) scale(1); }
.yz-la__check input:checked ~ .yz-la__check-text { color: var(--yz-color-heading, #101828); font-weight: 700; }
.yz-la__check input:focus-visible + .yz-la__box { outline: 3px solid var(--yz-color-primary, #1a73e8); outline-offset: 2px; }
.yz-la__check-logo {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; overflow: hidden;
  display: grid; place-items: center;
  background: var(--yz-color-bg-soft, #f5f6f8); border: 1px solid var(--yz-color-border, #e5e7eb);
  font-size: 12px; font-weight: 900; color: var(--yz-color-primary-dark, #0f4fa8);
}
.yz-la__check-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; display: block; }

/* سوییچ سه‌حالته (ضمانت بر عهده‌ی) */
.yz-la__segment {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  padding: 4px; border-radius: var(--yz-la-radius-md); background: var(--yz-color-bg-soft, #f5f6f8);
}
.yz-la__segment label { position: relative; cursor: pointer; }
.yz-la__segment input { position: absolute; opacity: 0; pointer-events: none; }
.yz-la__segment span {
  display: block; padding: 8px 4px; border-radius: 10px; text-align: center;
  font-size: 13.5px; font-weight: 700; color: var(--yz-color-gray-600, #4b5563);
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.yz-la__segment input:checked + span { background: var(--yz-color-bg, #fff); color: var(--yz-color-primary, #1a73e8); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.yz-la__segment input:focus-visible + span { outline: 3px solid var(--yz-color-primary, #1a73e8); outline-offset: 1px; }

/* ---------- Results ---------- */
.yz-la__results { min-width: 0; transition: opacity .2s; }
.yz-la.is-loading .yz-la__results { opacity: .5; pointer-events: none; }

.yz-la__chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.yz-la__chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px 0 10px; border-radius: 9999px;
  background: var(--yz-color-primary-soft); color: var(--yz-color-primary-dark, #0f4fa8);
  font-size: 13px; font-weight: 700; text-decoration: none;
  transition: background-color .2s;
}
.yz-la__chip svg { width: 14px; height: 14px; opacity: .7; }
.yz-la__chip:hover { background: #d6e6fb; color: var(--yz-color-primary-dark, #0f4fa8); }
.yz-la__chip-reset { font-size: 13px; font-weight: 700; color: var(--yz-color-text-muted, #6b7280); text-decoration: none; padding: 0 6px; }
.yz-la__chip-reset:hover { color: var(--yz-color-danger, #e53935); }

.yz-la__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 24px; }

/* صفحه‌بندی */
.yz-la__pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 40px; }
.yz-la__page {
  min-width: 44px; height: 44px; padding: 0 10px; border-radius: var(--yz-la-radius-sm);
  display: inline-grid; place-items: center;
  border: 1px solid var(--yz-color-border, #e5e7eb); background: var(--yz-color-bg, #fff);
  font-size: 15px; font-weight: 700; color: var(--yz-color-gray-700, #374151); text-decoration: none;
  transition: border-color .2s, color .2s;
}
a.yz-la__page:hover { border-color: var(--yz-color-primary, #1a73e8); color: var(--yz-color-primary, #1a73e8); }
.yz-la__page[aria-current] { background: var(--yz-color-primary, #1a73e8); border-color: var(--yz-color-primary, #1a73e8); color: #fff; }
.yz-la__page--dots { border-color: transparent; background: transparent; }
.yz-la__page--arrow svg { width: 18px; height: 18px; }

/* بدون نتیجه */
.yz-la__empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 56px 24px; border-radius: var(--yz-la-radius);
  background: var(--yz-color-bg-soft, #f5f6f8); text-align: center;
}
.yz-la__empty-icon {
  width: 64px; height: 64px; border-radius: 50%; margin-bottom: 6px;
  display: grid; place-items: center;
  background: var(--yz-color-bg, #fff); color: var(--yz-color-primary, #1a73e8);
}
.yz-la__empty-icon svg { width: 28px; height: 28px; }
.yz-la__empty h2 { font-size: 20px; font-weight: 900; color: var(--yz-color-heading, #101828); }
.yz-la__empty p { font-size: 15px; color: var(--yz-color-text-muted, #6b7280); }
.yz-la__empty-btn {
  margin-top: 8px; display: inline-flex; align-items: center; height: 46px; padding: 0 20px;
  border-radius: var(--yz-la-radius-sm); background: var(--yz-color-primary, #1a73e8); color: #fff;
  font-size: 15px; font-weight: 800; text-decoration: none;
}
.yz-la__empty-btn:hover { background: var(--yz-color-primary-dark, #0f4fa8); color: #fff; }

.yz-la__backdrop { display: none; }

/* =========================================================
   Responsive — زیر ۱۰۲۴: سایدبار به کشوی پایین صفحه تبدیل می‌شود
   ========================================================= */
@media (max-width: 1200px) {
  .yz-la { --yz-la-sidebar: 270px; }
  .yz-la__layout { gap: 24px; }
}

@media (max-width: 1023px) {
  .yz-la__layout { grid-template-columns: minmax(0, 1fr); }

  .yz-la__toolbar {
    display: grid;
    grid-template-columns: auto 1fr;
    padding: 10px;
    gap: 10px;
  }
  .yz-la__filter-btn { display: inline-flex; }
  .yz-la__count { grid-column: 2; grid-row: 1; align-self: center; }
  .yz-la__sort { grid-column: 1 / -1; }
  .yz-la__sort-label { display: none; }

  .yz-la__sidebar {
    position: fixed; z-index: 1001;
    top: auto; right: 0; bottom: 0; left: 0;
    max-height: 88dvh;
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .4s var(--yz-la-ease), visibility 0s linear .4s;
  }
  .yz-la__sidebar.is-open { transform: none; visibility: visible; transition: transform .4s var(--yz-la-ease), visibility 0s; }
  .yz-la__form { border-radius: var(--yz-la-radius) var(--yz-la-radius) 0 0; border-bottom: 0; box-shadow: 0 -20px 50px -20px rgba(11, 61, 134, .35); }
  .yz-la__close { display: grid; }
  .yz-la.is-js .yz-la__form-foot { display: block; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }

  .yz-la__backdrop {
    display: block; position: fixed; inset: 0; z-index: 1000;
    background: rgba(16, 24, 40, .5);
    opacity: 0; transition: opacity .3s;
  }
  .yz-la__backdrop.is-on { opacity: 1; }
  .yz-la__backdrop[hidden] { display: none; }
  html.yz-la-lock { overflow: hidden; }
}

@media (max-width: 640px) {
  .yz-la { padding: 20px 16px 72px; }
  .yz-la__grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .yz-la__range { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .yz-la *, .yz-la__sidebar { transition: none !important; }
}
