:root {
  --bg-start: #f4f6f9;
  --bg-end: #e6ebf2;
  --card-bg: #ffffff;
  --text-main: #1b2432;
  --text-muted: #5b6779;
  --accent: #1d4ed8;
  --accent-soft: #eff6ff;
  --border-subtle: #e2e8f0;
  --shadow-card: 0 22px 50px -15px rgba(15, 23, 42, 0.16), 0 4px 14px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text-main);
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  -webkit-font-smoothing: antialiased;
}

.page-wrapper {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.cards-grid {
  width: 100%;
  max-width: 1380px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 430px));
  justify-content: center;
  gap: 24px;
}

.property-card {
  width: 100%;
  background: var(--card-bg);
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-card);
}

/* قسم السلايدر */
.carousel-section {
  position: relative;
  background: #0f172a;
}

.carousel-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  direction: ltr;
  user-select: none;
  touch-action: pan-y;
  cursor: grab;
  background: #111827;
}

.carousel-viewport.is-dragging {
  cursor: grabbing;
}

.carousel-track {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.carousel-track.no-transition {
  transition: none;
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.carousel-slide img,
.carousel-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

.carousel-slide {
  position: relative;
}

.carousel-slide.is-playing-inline video {
  pointer-events: auto;
  object-fit: contain;
  background: #000000;
}

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.video-play-btn:hover {
  background: rgba(29, 78, 216, 0.9);
  transform: translate(-50%, -50%) scale(1.08);
}

.video-play-btn svg {
  width: 28px;
  height: 28px;
  margin-left: 3px;
}

.carousel-slide.is-playing-inline .video-play-btn {
  opacity: 0;
  pointer-events: none;
}

.video-badge {
  position: absolute;
  bottom: 46px;
  left: 14px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.carousel-slide.is-playing-inline .video-badge {
  display: none;
}

/* عداد الصور */
.slide-counter {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

/* زر التكبير أعلى اليمين */
.zoom-hint-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.zoom-hint-btn:hover {
  background: rgba(15, 23, 42, 0.9);
  transform: scale(1.06);
}

.zoom-hint-btn svg {
  width: 18px;
  height: 18px;
}

/* أسهم التنقل شمال ويمين */
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.62);
  color: #ffffff;
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.nav-arrow:hover {
  background: rgba(15, 23, 42, 0.88);
  transform: translateY(-50%) scale(1.07);
}

.nav-arrow:active {
  transform: translateY(-50%) scale(0.96);
}

.nav-arrow--left {
  left: 12px;
}

.nav-arrow--right {
  right: 12px;
}

.nav-arrow svg {
  width: 22px;
  height: 22px;
}

/* نقاط المؤشر */
.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  direction: ltr;
  max-width: calc(100% - 28px);
  overflow-x: auto;
  scrollbar-width: none;
}

.carousel-dots::-webkit-scrollbar {
  display: none;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: width 0.22s ease, background-color 0.22s ease;
}

.carousel-dot.is-active {
  width: 22px;
  background: #ffffff;
}

/* بيانات الكرت أسفل الصور */
.card-details {
  padding: 20px 22px 22px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-subtle);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 10px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(29, 78, 216, 0.12);
  text-align: center;
}

.detail-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.12);
}

.detail-icon svg {
  width: 18px;
  height: 18px;
}

.detail-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

/* نافذة فتح وتكبير الصورة (Lightbox) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 10, 19, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  direction: ltr;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 12px;
  z-index: 5;
}

.lightbox-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-btn {
  height: 40px;
  min-width: 40px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.lb-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lb-btn:active {
  transform: scale(0.96);
}

.lb-btn svg {
  width: 18px;
  height: 18px;
}

.zoom-level {
  color: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 48px;
  text-align: center;
}

.lightbox-counter {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 999px;
}

.lightbox-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}

.lightbox-image,
.lightbox-video {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.12s ease-out;
  will-change: transform;
  border-radius: 8px;
}

.lightbox-image {
  cursor: zoom-in;
}

.lightbox-video {
  background: #000000;
}

.lightbox-image[hidden],
.lightbox-video[hidden] {
  display: none;
}

.lightbox-image.is-zoomed {
  cursor: grab;
}

.lightbox-image.is-panning {
  transition: none;
  cursor: grabbing;
}

.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.lb-arrow:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.06);
}

.lb-arrow--left {
  left: 16px;
}

.lb-arrow--right {
  right: 16px;
}

.lb-arrow svg {
  width: 24px;
  height: 24px;
}

.lightbox-hint {
  text-align: center;
  color: rgba(226, 232, 240, 0.8);
  font-size: 0.85rem;
  padding: 10px 16px 16px;
  direction: rtl;
}

@media (max-width: 520px) {
  .property-card {
    border-radius: 18px;
  }

  .card-details {
    padding: 16px 14px 18px;
  }

  .details-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .detail-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 14px;
    text-align: right;
  }

  .nav-arrow {
    width: 38px;
    height: 38px;
  }

  .lb-arrow {
    width: 40px;
    height: 40px;
  }

  .lightbox-hint {
    font-size: 0.78rem;
  }
}
