/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  direction: rtl;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; background: none; border: none; }
input, select { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Layout */
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.container-md { max-width: 896px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 30;
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.site-header .logo { display: flex; align-items: center; gap: 12px; }
.site-header .logo-icon { font-size: 1.5rem; }
.site-header .logo-title { font-weight: 700; color: #1e293b; font-size: 1.1rem; line-height: 1; }
.site-header .logo-sub { font-size: .75rem; color: #94a3b8; margin-top: 2px; }
.site-header .total-count { font-size: .75rem; color: #94a3b8; }

/* Stats Bar */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  padding: 16px;
}
.stat-card .stat-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.stat-card .stat-icon { font-size: 1.1rem; }
.stat-card .stat-label { font-size: .75rem; color: #94a3b8; }
.stat-card .stat-value { font-weight: 700; color: #1e293b; font-size: .875rem; }

/* Main Layout */
.main-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* Sidebar */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  display: none;
}
@media (min-width: 1024px) { .sidebar { display: block; } }

.sidebar-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  padding: 20px;
  position: sticky;
  top: 72px;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.sidebar-title { font-weight: 600; color: #334155; font-size: .95rem; }
.clear-link { font-size: .75rem; color: #0284c7; }
.clear-link:hover { color: #075985; }

.filter-group { margin-bottom: 16px; }
.filter-label { display: block; font-size: .75rem; color: #94a3b8; margin-bottom: 6px; }

.input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .875rem;
  background: #fff;
  outline: none;
  color: #1e293b;
  transition: box-shadow .15s, border-color .15s;
}
.input:focus { box-shadow: 0 0 0 2px #38bdf8; border-color: transparent; }

.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }

.rooms-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.room-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .75rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  color: #475569;
  transition: all .15s;
  background: #fff;
}
.room-btn:hover { border-color: #7dd3fc; }
.room-btn.active { background: #0284c7; color: #fff; border-color: #0284c7; }

.amenity-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.amenity-btn {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .75rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  color: #475569;
  text-align: right;
  transition: all .15s;
  background: #fff;
}
.amenity-btn:hover { border-color: #cbd5e1; }
.amenity-btn.active { background: #ecfdf5; color: #047857; border-color: #6ee7b7; }

.btn-primary {
  display: inline-block;
  background: #0284c7;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s;
  text-align: center;
  border: none;
  width: 100%;
}
.btn-primary:hover { background: #0369a1; }

.btn-outline {
  display: inline-block;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  transition: all .15s;
  text-align: center;
  width: 100%;
}
.btn-outline:hover { border-color: #38bdf8; color: #0284c7; }

/* Cards Grid */
.cards-area { flex: 1; min-width: 0; }

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 640px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }

/* Rental Card */
.rental-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, border-color .2s;
}
.rental-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); border-color: #bae6fd; }

.card-img {
  position: relative;
  height: 192px;
  background: #f1f5f9;
  overflow: hidden;
}
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.rental-card:hover .card-img img { transform: scale(1.05); }
.card-img .no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: .875rem;
}
.badge-promoted {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #fbbf24;
  color: #78350f;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}
.badge-img-count {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 9999px;
}

.card-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.card-title {
  font-weight: 600;
  color: #1e293b;
  font-size: .875rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-address {
  font-size: .75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-specs {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .75rem;
  color: #475569;
}
.card-specs .spec-label { color: #94a3b8; }
.card-specs .spec-val { font-weight: 500; }

.card-amenities { display: flex; flex-wrap: wrap; gap: 4px; }
.amenity-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: .7rem;
  font-weight: 500;
}
.amenity-tag.yes { background: #d1fae5; color: #065f46; }
.amenity-tag.no  { background: #fee2e2; color: #dc2626; }

.card-price {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.price-label { font-size: .75rem; color: #94a3b8; }
.price-val { font-weight: 600; color: #1e293b; font-size: .875rem; }
.price-val.highlight { color: #0284c7; font-weight: 700; }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: .7rem;
  font-weight: 500;
  background: #f1f5f9;
  color: #64748b;
}
.card-date { font-size: .7rem; color: #cbd5e1; }

/* Empty State */
.empty-state {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  padding: 64px 16px;
  text-align: center;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { color: #475569; font-weight: 500; }
.empty-state .empty-sub { color: #94a3b8; font-size: .875rem; margin-top: 4px; }

/* Pagination */
.pagination { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 32px; }
.pagination-info { font-size: .75rem; color: #94a3b8; }
.pagination-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  background: #fff;
}
.page-btn:hover { border-color: #38bdf8; color: #0284c7; }
.page-btn.active { background: #0284c7; color: #fff; border-color: #0284c7; }
.page-btn.disabled { opacity: .4; pointer-events: none; }
.page-dots { color: #94a3b8; padding: 0 4px; }

/* Detail Page */
.detail-header-back { font-size: .875rem; color: #94a3b8; display: flex; align-items: center; gap: 4px; }
.detail-header-back:hover { color: #0284c7; }
.detail-header-sep { color: #e2e8f0; }
.detail-header-title { font-weight: 600; color: #334155; font-size: .875rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.gallery-main {
  position: relative;
  height: 288px;
  background: #0f172a;
  cursor: zoom-in;
}
@media (min-width: 640px) { .gallery-main { height: 384px; } }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.5);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background .15s;
  border: none;
  cursor: pointer;
}
.gallery-nav:hover { background: rgba(0,0,0,.7); }
.gallery-nav.prev { right: 12px; }
.gallery-nav.next { left: 12px; }
.gallery-counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: .75rem;
  padding: 3px 12px;
  border-radius: 9999px;
}
.gallery-thumbs { display: flex; gap: 8px; padding: 12px; overflow-x: auto; }
.gallery-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color .15s;
  cursor: pointer;
  background: none;
  padding: 0;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb.active { border-color: #0ea5e9; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,.9);
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 16px; }
.lightbox-close {
  position: absolute;
  top: 16px;
  left: 16px;
  color: #fff;
  font-size: 1.25rem;
  background: rgba(0,0,0,.5);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 768px) { .detail-grid { grid-template-columns: 1fr 1fr 1fr; } }

.detail-main { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 768px) { .detail-main { grid-column: span 2; } }

.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

/* Cards */
.card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  overflow: hidden;
}
.card-pad { padding: 20px; }
.card-section-title { font-weight: 600; color: #334155; margin-bottom: 16px; }

.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.detail-title { font-weight: 700; color: #1e293b; font-size: 1.2rem; line-height: 1.6; }
.badge-special { background: #fef3c7; color: #b45309; font-size: .7rem; font-weight: 700; padding: 3px 10px; border-radius: 9999px; flex-shrink: 0; }

.detail-address { font-size: .875rem; color: #94a3b8; display: flex; align-items: center; gap: 6px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.detail-date { font-size: .75rem; color: #cbd5e1; margin-top: 12px; }

/* Specs Table */
.specs-table { }
.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f8fafc;
}
.spec-row:last-child { border-bottom: none; }
.spec-key { font-size: .875rem; color: #94a3b8; }
.spec-val { font-size: .875rem; font-weight: 500; color: #1e293b; }

/* Amenities Grid */
.amenities-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.amenity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: .875rem;
}
.amenity-item.yes { background: #ecfdf5; color: #047857; }
.amenity-item.no  { background: #fef2f2; color: #ef4444; }
.amenity-item .amenity-check { margin-right: auto; font-weight: 700; }

/* Description */
.description { font-size: .875rem; color: #475569; line-height: 2; white-space: pre-line; }

/* Price Card */
.price-card { padding: 20px; }
@media (min-width: 768px) { .price-card { position: sticky; top: 72px; } }

.price-box { border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.price-box.full-rent { background: #f0f9ff; text-align: center; }
.price-box.deposit { background: #f8fafc; }
.price-box.rent { background: #f0f9ff; }
.price-box-label { font-size: .75rem; margin-bottom: 4px; }
.price-box.full-rent .price-box-label { color: #0284c7; }
.price-box.deposit .price-box-label { color: #94a3b8; }
.price-box.rent .price-box-label { color: #0284c7; }
.price-box-val { font-weight: 700; font-size: 1rem; }
.price-box.full-rent .price-box-val { color: #075985; }
.price-box.deposit .price-box-val { color: #1e293b; }
.price-box.rent .price-box-val { color: #075985; }

.non-convertible { font-size: .75rem; color: #94a3b8; text-align: center; margin-bottom: 8px; }

.btn-call {
  display: block;
  background: #0284c7;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
  transition: background .15s;
}
.btn-call:hover { background: #0369a1; }

.btn-divar {
  display: block;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  text-align: center;
  transition: all .15s;
}
.btn-divar:hover { border-color: #38bdf8; color: #0284c7; }

.agent-name { font-size: .75rem; color: #94a3b8; text-align: center; margin-top: 12px; }

/* Map */
#map { height: 224px; border-radius: 12px; overflow: hidden; }

/* Mobile filter toggle */
.mobile-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e2e8f0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  color: #475569;
  background: #fff;
  transition: all .15s;
}
.mobile-filter-btn:hover { border-color: #38bdf8; color: #0284c7; }
@media (min-width: 1024px) { .mobile-filter-btn { display: none; } }

/* Mobile sidebar overlay */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
}
.mobile-sidebar-overlay.open { display: block; }
.mobile-sidebar-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
}
.mobile-sidebar-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  background: #fff;
  overflow-y: auto;
  padding: 16px;
  z-index: 50;
}
.mobile-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.mobile-sidebar-close {
  color: #94a3b8;
  font-size: 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
}
.mobile-sidebar-close:hover { color: #475569; }

/* Utility */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
