:root {
  --primary: #2563EB;
  --primary-600: #1D4ED8;
  --primary-50: #EFF4FF;
  --accent: #FF9900;
  --success: #16A34A;
  --danger: #EF4444;
  --purple: #7C3AED;
  --bg: #FFFFFF;
  --bg-soft: #F6F7F9;
  --bg-card: #FFFFFF;
  --ink: #0F172A;
  --ink-soft: #475569;
  --ink-faint: #94A3B8;
  --border: #E7E9ED;
  --border-soft: #EEF0F3;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, .10);
  --shadow-lg: 0 20px 48px -12px rgba(15, 23, 42, .16);
  --shadow-xl: 0 32px 64px -16px rgba(15, 23, 42, .2);
  --shadow-primary: 0 12px 28px -8px rgba(37, 99, 235, .35);
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 22px;
  --r-xl: 24px;
  --r-full: 999px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 160ms;
  --t-base: 280ms;
  --t-slow: 520ms;
  --nav-h: 72px;
  --container-pad: 16px;
  --max-width: 1200px;
  --font: 'Vazirmatn', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #0B1220;
  --bg-soft: #0E1626;
  --bg-card: #141B2D;
  --ink: #F1F5F9;
  --ink-soft: #AEB9CC;
  --ink-faint: #5E6B85;
  --border: #232E45;
  --border-soft: #1C2640;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 20px 48px -12px rgba(0, 0, 0, .6);
  --primary-50: #16213A;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font); background: var(--bg-soft); color: var(--ink);
  direction: rtl; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background var(--t-base), color var(--t-base); line-height: 1.6; min-height: 100vh;
}
img { max-width: 100%; display: block; object-fit: cover; }
button { font-family: inherit; cursor: pointer; border: none; -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; color: inherit; }
input, textarea { font-family: inherit; }

.skip-link { position: absolute; right: -9999px; background: var(--primary); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); z-index: 999; }
.skip-link:focus { right: 12px; top: 12px; }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm); }

.app-header { position: sticky; top: 0; z-index: 9999; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--border-soft); backdrop-filter: blur(12px); }
[data-theme="dark"] .app-header { background: rgba(11,18,32,.92); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px var(--container-pad); }
.page-title { font-size: 18px; font-weight: 800; white-space: nowrap; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--bg); display: grid; place-items: center; color: var(--ink-soft); transition: all var(--t-fast); flex-shrink: 0; }
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }

.detail-header-inner { justify-content: space-between; }
.back-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-soft); border: 1px solid var(--border-soft); display: grid; place-items: center; color: var(--ink); flex-shrink: 0; }
.filter-btn { margin-right: auto; }

main { max-width: var(--max-width); margin: 0 auto; padding: 12px var(--container-pad) 0; }
.section { padding: 16px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.section-header-left { display: flex; flex-direction: column; gap: 2px; }
.section-title { font-size: 16px; font-weight: 700; }
.section-subtitle { font-size: 11px; color: var(--ink-faint); }

.detail-banner { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-md); margin-bottom: 8px; }
.detail-banner img { width: 100%; height: 200px; object-fit: cover; display: block; }
@media (min-width: 600px) { .detail-banner img { height: 280px; } }
@media (min-width: 900px) { .detail-banner img { height: 240px; } }

.property-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.divar-item {
  display: flex;
  flex-direction: row-reverse;
  align-items: stretch;
  gap: 12px;
  padding: 14px var(--container-pad);
  cursor: pointer;
  transition: background var(--t-fast);
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  background: var(--bg-card);
  min-height: 130px;
}
.divar-item:last-child { border-bottom: none; }
.divar-item:active { background: var(--bg-soft); }
@media (hover: hover) { .divar-item:hover { background: var(--bg-soft); } }

.divar-thumb {
  width: 130px;
  height: 100%;
  min-height: 130px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-soft);
  position: relative;
  align-self: stretch;
}
.divar-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; top: 0; left: 0; }
.divar-thumb-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; color: var(--ink-faint);
}
.divar-thumb-placeholder svg { width: 36px; height: 36px; }
.divar-badge {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(15, 23, 42, 0.75); backdrop-filter: blur(6px);
  color: #fff; font-size: 10px; font-weight: 600; padding: 3px 8px;
  border-radius: var(--r-full); display: flex; align-items: center; gap: 3px; line-height: 1.4;
  z-index: 2;
}
.divar-badge svg { width: 12px; height: 12px; }

.divar-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
  position: relative;
}

.divar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  flex-shrink: 0;
}

.divar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  
}

.divar-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.divar-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 500;
}
.divar-meta span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.divar-meta .divar-status { color: var(--success); font-weight: 600; background: #DCFCE7; padding: 2px 8px; border-radius: var(--r-full); font-size: 10px; flex-shrink: 0; }
[data-theme="dark"] .divar-meta .divar-status { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
.divar-time { font-size: 10px; color: var(--ink-faint); display: flex; align-items: center; gap: 4px; margin-top: 2px; }

.faq-container { display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: all var(--t-base); }
.faq-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 14px 16px; background: transparent; font-size: 13px;
  font-weight: 600; color: var(--ink); text-align: right; cursor: pointer;
}
.faq-header svg { flex-shrink: 0; transition: transform var(--t-base); color: var(--ink-faint); }
.faq-item.is-open .faq-header svg { transform: rotate(180deg); color: var(--primary); }
.faq-body { max-height: 0; overflow: hidden; transition: max-height 0.35s ease, padding 0.35s ease; }
.faq-body-inner { padding: 0 16px 14px; font-size: 12px; color: var(--ink-soft); line-height: 1.8; }
.faq-item.is-open .faq-body { max-height: 400px; }

.toast {
  position: fixed; bottom: calc(var(--nav-h) + 20px); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; padding: 10px 20px;
  border-radius: var(--r-full); box-shadow: var(--shadow-md); opacity: 0; pointer-events: none;
  transition: all var(--t-base); z-index: 100; white-space: nowrap;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.bottom-spacer { height: calc(var(--nav-h) + 32px); }
.bottom-nav { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 60; width: calc(100% - 32px); max-width: 500px; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav-inner { background: rgba(255,255,255,0.72); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.3); border-radius: 28px; display: flex; align-items: center; justify-content: space-around; padding: 8px 4px; box-shadow: 0 8px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.6); }
[data-theme="dark"] .bottom-nav-inner { background: rgba(20,27,45,0.8); border: 1px solid rgba(255,255,255,0.08); box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; color: var(--ink-faint); font-size: 10px; font-weight: 500; padding: 6px 12px; min-width: 56px; cursor: pointer; transition: all 0.2s; position: relative; }
.nav-item.active { color: var(--primary); }
.nav-item-center { margin-top: -24px; }
.nav-add-btn { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(37,99,235,0.35); }
@media (min-width: 900px) { .bottom-nav, .bottom-spacer { display: none; } }

.skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.skeleton-item {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 12px;
  padding: 14px var(--container-pad);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-card);
}
.skeleton-item:last-child { border-bottom: none; }
.skeleton-thumb {
  width: 130px;
  height: 130px;
  border-radius: 12px;
  background: var(--border-soft);
  flex-shrink: 0;
  overflow: hidden;
}
.skeleton-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}
.skeleton-line {
  height: 14px;
  border-radius: 8px;
  background: var(--border-soft);
  overflow: hidden;
}
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.w-90 { width: 90%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-85 { width: 85%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-55 { width: 55%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-45 { width: 45%; }
.skeleton-line.w-30 { width: 30%; }
.skeleton-line.w-35 { width: 35%; }
.skeleton-line.w-25 { width: 25%; }

.shimmer {
  position: relative;
  overflow: hidden;
}
.shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: shimmer 1.8s infinite;
}
[data-theme="dark"] .shimmer::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

@keyframes shimmer {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

.category-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.category-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.category-modal {
  background: var(--bg-card);
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 850px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.3s var(--ease-spring);
  overflow: hidden;
}
.category-modal-overlay.is-open .category-modal {
  transform: scale(1) translateY(0);
}
.category-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.category-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}
.category-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
}
.category-modal-close:hover {
  background: var(--border);
  color: var(--ink);
}
.category-search-wrapper {
  position: relative;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.category-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.category-search-input {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-soft);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: all 0.2s;
}
.category-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.category-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  padding-left: 4px;
}
.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
}
.category-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.category-card.is-expanded {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.category-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
  user-select: none;
}
.category-card-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.category-card-info {
  flex: 1;
  min-width: 0;
}
.category-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.category-card-desc {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}
.category-card-chevron {
  flex-shrink: 0;
  color: var(--ink-faint);
  transition: transform 0.25s ease;
}
.category-card.is-expanded .category-card-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}
.category-sub-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  padding: 0 16px 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.category-card.is-expanded .category-sub-list {
  max-height: 300px;
}
.subcategory-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.subcategory-chip:hover {
  background: var(--primary-50);
  border-color: var(--primary);
  color: var(--primary);
}
.subcategory-chip.is-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.3);
  transform: scale(0);
  animation: ripple-anim 0.6s ease-out;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

.floating-consult-btn {
  position: fixed;
  bottom: 100px;
  left: 16px;
  z-index: 85;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
  padding: 6px;
}
.floating-consult-btn:hover {
  background: var(--primary-600);
  transform: scale(1.06);
  box-shadow: 0 16px 36px -8px rgba(37, 99, 235, 0.55);
}
.floating-consult-btn:active {
  transform: scale(0.94);
}
.consult-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: #fff;
}
.consult-text {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  max-width: 60px;
}
@media (min-width: 600px) {
  .floating-consult-btn {
    width: 80px;
    height: 80px;
    bottom: 110px;
    left: 24px;
    gap: 2px;
  }
  .consult-icon { width: 28px; height: 28px; }
  .consult-text { font-size: 11px; }
  .skeleton-thumb { width: 140px; height: 140px; }
  .skeleton-item { padding: 18px var(--container-pad); gap: 16px; }
}
@media (min-width: 900px) {
  .floating-consult-btn { bottom: 30px; left: 30px; }
}

@media (max-width: 360px) {
  .divar-thumb { width: 110px; min-height: 110px; }
  .divar-title { font-size: 13px; }
  .divar-price { font-size: 14px; }
  .skeleton-thumb { width: 110px; height: 110px; }
}
@media (min-width: 390px) and (max-width: 429px) {
  .divar-thumb { width: 125px; min-height: 125px; }
  .skeleton-thumb { width: 125px; height: 125px; }
}
@media (min-width: 430px) {
  .divar-thumb { width: 135px; min-height: 135px; }
  .divar-content { gap: 8px; }
  .skeleton-thumb { width: 135px; height: 135px; }
}
@media (min-width: 600px) {
  .divar-item { padding: 18px var(--container-pad); gap: 16px; min-height: 140px; }
  .divar-thumb { width: 140px; min-height: 140px; }
  .divar-title { font-size: 15px; }
  .divar-price { font-size: 16px; }
  .divar-meta { font-size: 12px; }
}
@media (min-width: 768px) {
  :root { --container-pad: 24px; }
  .divar-thumb { width: 140px; min-height: 140px; }
  .property-list { border-radius: var(--r-md); }
  .skeleton-thumb { width: 140px; height: 140px; }
}
@media (min-width: 900px) {
  :root { --container-pad: 32px; }
  .page-title { font-size: 20px; }
  .section { padding: 24px 0; }
  .section-title { font-size: 18px; }
  .divar-item { padding: 20px 24px; min-height: 150px; }
  .skeleton-item { padding: 20px 24px; }
}
@media (min-width: 1024px) {
  .divar-thumb { width: 140px; min-height: 140px; }
  .divar-title { font-size: 16px; }
}
@media (min-width: 1440px) {
  .divar-item { padding: 22px 32px; min-height: 160px; }
  .skeleton-item { padding: 22px 32px; }
}