/* ==========================================================================
   عقارك — أنماط مخصصة فوق Tailwind
   ========================================================================== */

:root {
  --header-h: 0px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  color-scheme: light;
  overflow-x: clip;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  max-width: 100%;
  overflow-x: clip;
}

/* الأرقام تبقى بخط لاتيني واضح داخل النص العربي */
.nums {
  font-feature-settings: 'lnum' 1;
  font-variant-numeric: lining-nums tabular-nums;
}

/* ------------------------------- شريط التمرير ---------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(43, 65, 98, 0.28);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(43, 65, 98, 0.5);
  background-clip: content-box;
}
.dark ::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 83, 0.35);
  background-clip: content-box;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --------------------------------- خلفيات -------------------------------- */
.bg-grid {
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

.bg-dots {
  background-image: radial-gradient(rgba(16, 30, 51, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
}
.dark .bg-dots {
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
}

.text-gradient {
  background: linear-gradient(120deg, #e3ae49 0%, #f4e0ae 45%, #d4a853 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}
.dark .glass {
  background: rgba(16, 30, 51, 0.7);
}

.glass-dark {
  background: rgba(8, 18, 31, 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* حدود متدرّجة */
.ring-gradient {
  position: relative;
}
.ring-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(212, 168, 83, 0.9), rgba(212, 168, 83, 0));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ------------------------------ ظهور عند التمرير -------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* --------------------------------- بطاقات -------------------------------- */
.card-hover {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}
.card-hover:hover {
  transform: translateY(-6px);
}

.img-zoom {
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.group:hover .img-zoom {
  transform: scale(1.08);
}

/* ------------------------------- هيكل التحميل ----------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(16, 30, 51, 0.07);
}
.dark .skeleton {
  background: rgba(255, 255, 255, 0.07);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: skeleton-sweep 1.4s infinite;
}
.dark .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}
@keyframes skeleton-sweep {
  100% {
    transform: translateX(-100%);
  }
}

/* -------------------------------- المدخلات ------------------------------- */
.field {
  width: 100%;
  border-radius: 0.85rem;
  border: 1px solid rgb(226 232 240);
  background: #fff;
  padding: 0.7rem 0.95rem;
  font-size: 0.95rem;
  color: #101e33;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field:focus {
  outline: none;
  border-color: #d4a853;
  box-shadow: 0 0 0 4px rgba(212, 168, 83, 0.18);
}
.field::placeholder {
  color: #9aa7b8;
}
.dark .field {
  background: rgba(28, 44, 69, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e6ecf3;
}
.dark .field::placeholder {
  color: #7d8ea3;
}

select.field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8ea3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.85rem center;
  padding-left: 2.4rem;
}

.label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2b4162;
}
.dark .label {
  color: #c8d6e6;
}

/* شريط النطاق السعري */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 99px;
  background: rgba(16, 30, 51, 0.12);
  outline: none;
}
.dark input[type='range'] {
  background: rgba(255, 255, 255, 0.12);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d4a853;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(212, 168, 83, 0.6);
  cursor: pointer;
}
input[type='range']::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d4a853;
  border: 3px solid #fff;
  cursor: pointer;
}

/* شريحة اختيار (chip) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 99px;
  border: 1px solid rgb(226 232 240);
  background: #fff;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2b4162;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.chip:hover {
  border-color: #e3ae49;
  color: #9a6929;
}
.chip.is-active {
  background: #101e33;
  border-color: #101e33;
  color: #f4e0ae;
}
.dark .chip {
  background: rgba(28, 44, 69, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  color: #c8d6e6;
}
.dark .chip.is-active {
  background: #d4a853;
  border-color: #d4a853;
  color: #08121f;
}

/* تبويبات (الهيرو / أحدث العقارات) */
.hero-tab,
.latest-tab {
  padding: 0.5rem 1.35rem;
  border-radius: 0.85rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #4a6c96;
  transition: all 0.25s;
}
.dark .hero-tab,
.dark .latest-tab {
  color: #c8d6e6;
}
.hero-tab:hover,
.latest-tab:hover {
  color: #101e33;
}
.dark .hero-tab:hover,
.dark .latest-tab:hover {
  color: #fff;
}
.hero-tab.is-active,
.latest-tab.is-active {
  background: #101e33;
  color: #f4e0ae;
  box-shadow: 0 6px 16px -8px rgba(16, 30, 51, 0.8);
}
.dark .hero-tab.is-active,
.dark .latest-tab.is-active {
  background: #d4a853;
  color: #08121f;
}

/* أزرار الغرض داخل الفلاتر */
.purpose-btn {
  padding: 0.55rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #4a6c96;
  transition: all 0.2s;
}
.dark .purpose-btn {
  color: #c8d6e6;
}
.purpose-btn.is-active {
  background: #fff;
  color: #101e33;
  box-shadow: 0 2px 8px -2px rgba(16, 30, 51, 0.2);
}
.dark .purpose-btn.is-active {
  background: #d4a853;
  color: #08121f;
}

/* تبديل طريقة العرض */
.view-btn {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 0.6rem;
  color: #6a85a8;
  transition: all 0.2s;
}
.view-btn.is-active {
  background: #101e33;
  color: #f4e0ae;
}
.dark .view-btn.is-active {
  background: #d4a853;
  color: #08121f;
}

/* فلاتر صفحة العقارات: درج يُفتح ويُغلق */
.filters-drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 60;
  width: min(88vw, 24rem);
  max-width: 24rem;
  background: #fff;
  box-shadow: 0 25px 50px -12px rgba(16, 30, 51, 0.28);
  transform: translate3d(100%, 0, 0);
  transition: transform 0.3s ease, visibility 0.3s ease;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
html[dir="ltr"] .filters-drawer {
  transform: translate3d(100%, 0, 0);
}
html[dir="rtl"] .filters-drawer {
  transform: translate3d(-100%, 0, 0);
}
.filters-drawer.is-open {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  pointer-events: auto;
}
.filters-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(8, 18, 31, 0.5);
  backdrop-filter: blur(4px);
}
#filters-panel,
#filters-panel .filters-card {
  min-width: 0;
}
#filters-form {
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
#filters-form .chip {
  white-space: normal;
  text-align: center;
  justify-content: center;
  line-height: 1.35;
  min-width: 0;
  height: auto;
  padding-block: 0.4rem;
}
#filters-form label,
#filters-form #f-types,
#filters-form #f-amenities {
  min-width: 0;
}
#filters-form select.field {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filters-actions {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 28%);
}

/* أقسام قابلة للطي في الفلاتر */
[data-collapse].is-closed > div {
  display: none;
}
[data-collapse].is-closed [data-collapse-btn] i {
  transform: rotate(-90deg);
}

/* --------------------------------- أزرار -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.85rem;
  padding: 0.7rem 1.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s;
  cursor: pointer;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.97);
}
.btn-gold {
  background: linear-gradient(135deg, #e3ae49, #d4a853 60%, #bd8730);
  color: #08121f;
  box-shadow: 0 10px 26px -12px rgba(212, 168, 83, 0.9);
}
.btn-gold:hover {
  box-shadow: 0 14px 34px -10px rgba(212, 168, 83, 0.95);
}
.btn-night {
  background: #101e33;
  color: #fff;
}
.btn-night:hover {
  background: #1c2c45;
}
.dark .btn-night {
  background: #fff;
  color: #101e33;
}
.btn-ghost {
  border: 1px solid rgb(226 232 240);
  color: #2b4162;
  background: #fff;
}
.btn-ghost:hover {
  border-color: #d4a853;
  color: #9a6929;
}
.dark .btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.14);
  color: #c8d6e6;
}
.dark .btn-ghost:hover {
  border-color: #d4a853;
  color: #ecc97b;
}

/* -------------------------------- الإشعارات ------------------------------ */
#toast-stack {
  position: fixed;
  z-index: 100;
  top: 6rem;
  inset-inline-end: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 1rem;
  padding: 0.8rem 1.1rem;
  background: #101e33;
  color: #fff;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  font-size: 0.9rem;
  font-weight: 600;
  animation: toast-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: min(90vw, 380px);
}
.toast.is-out {
  animation: toast-out 0.3s ease forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

/* ------------------------------ معرض الصور -------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 15, 0.94);
  backdrop-filter: blur(6px);
}
.lightbox.is-open {
  display: flex;
}

/* --------------------------------- متنوع --------------------------------- */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.marquee-track {
  display: flex;
  gap: 3rem;
  width: max-content;
  animation: marquee 32s linear infinite;
}
@keyframes marquee {
  to {
    transform: translateX(50%);
  }
}

.step-dot.is-done,
.step-dot.is-active {
  background: #d4a853;
  border-color: #d4a853;
  color: #08121f;
}

/* حالة الطباعة لصفحة تفاصيل العقار */
@media print {
  header,
  footer,
  .no-print {
    display: none !important;
  }
}
