/* ============================================
   صفحة النتائج / Results Page
   ============================================ */

.results-page {
  padding-top: 76px;
  min-height: 100vh;
  background: var(--color-bg-alt);
}

.results-header {
  background: white;
  padding: var(--space-5) var(--container-padding);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 76px;
  z-index: 50;
}

.results-header-inner {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
}

.results-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.results-count {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.results-count strong {
  color: var(--color-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.results-edit {
  font-size: 0.8125rem;
  color: var(--color-accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--color-primary-light);
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.results-edit:hover {
  background: var(--color-primary);
  color: white;
}

.results-filters {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 6px 12px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.filter-chip strong {
  color: var(--color-text);
  font-weight: 600;
}

.results-content {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding: var(--space-5) var(--container-padding) var(--space-8);
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.results-empty {
  text-align: center;
  padding: var(--space-9) var(--space-4);
  background: white;
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border-strong);
}

.results-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  color: var(--color-text-muted);
  opacity: 0.4;
}

.results-empty h3 {
  font-size: 1.125rem;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.results-empty p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-5);
}

/* Wide property card for results */
.property-card-wide {
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: all var(--transition);
  cursor: pointer;
  text-align: start;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
  font: inherit;
  color: inherit;
  /* إلغاء قيد الارتفاع من .property-card العامة */
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
}

.property-card-wide:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.property-card-wide .property-image {
  width: 100%;
  aspect-ratio: 16/10;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: var(--color-bg-alt);
}

.property-card-wide .property-info {
  flex: 1 1 auto;
  display: block;
  padding: var(--space-4);
  text-align: start;
}

/* ============================================
   صفحة تفاصيل العقار / Property Details
   ============================================ */

.property-page {
  padding-top: 76px;
  background: var(--color-bg-alt);
  min-height: 100vh;
}

.property-gallery {
  position: relative;
  background: var(--color-bg-alt);
  aspect-ratio: 4/3;
  overflow: hidden;
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
}

/* ===== معرض السحب الاحترافي ===== */
.gallery-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y; /* يسمح بالتمرير العمودي، يلتقط الأفقي */
  user-select: none;
  -webkit-user-select: none;
}

.gallery-viewport.grabbing {
  cursor: grabbing;
}

.gallery-track {
  display: flex;
  height: 100%;
  width: max-content;
  will-change: transform;
}

.gallery-slide {
  flex: 0 0 var(--gallery-slide-width, 100vw);
  width: var(--gallery-slide-width, 100vw);
  max-width: 100vw;
  height: 100%;
  position: relative;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* أسهم التنقل */
.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: oklch(20% 0.03 240 / 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background 0.2s, opacity 0.3s, transform 0.15s;
}

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

.gallery-arrow:hover {
  background: oklch(20% 0.03 240 / 0.8);
}

.gallery-arrow:active {
  transform: translateY(-50%) scale(0.9);
}

/* RTL: السهم "السابق" يمين، "التالي" يسار */
.gallery-arrow-prev {
  inset-inline-start: 12px;
}

.gallery-arrow-next {
  inset-inline-end: 12px;
}

[dir="rtl"] .gallery-arrow-prev { right: 12px; left: auto; }
[dir="rtl"] .gallery-arrow-next { left: 12px; right: auto; }
[dir="ltr"] .gallery-arrow-prev { left: 12px; right: auto; }
[dir="ltr"] .gallery-arrow-next { right: 12px; left: auto; }

/* عدّاد الصور */
.gallery-counter {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  padding: 5px 12px;
  background: oklch(20% 0.03 240 / 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  z-index: 3;
  letter-spacing: 0.02em;
}

.gallery-dots {
  position: absolute;
  bottom: var(--space-4);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 3;
  padding: 0 16px;
  flex-wrap: wrap;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: oklch(100% 0 0 / 0.5);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.gallery-dot:hover {
  background: oklch(100% 0 0 / 0.75);
}

.gallery-dot.active {
  background: white;
  width: 24px;
  border-radius: 4px;
}

/* زر التكبير في المعرض */
.gallery-zoom-hint {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: oklch(20% 0.03 240 / 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background 0.2s, transform 0.15s;
}

.gallery-zoom-hint svg {
  width: 20px;
  height: 20px;
}

.gallery-zoom-hint:hover {
  background: oklch(20% 0.03 240 / 0.8);
}

.gallery-zoom-hint:active {
  transform: scale(0.9);
}

.gallery-viewport {
  cursor: zoom-in;
}

/* ===== Lightbox - تكبير ملء الشاشة ===== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: oklch(8% 0.02 240 / 0.96);
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox-overlay.active {
  display: block;
  opacity: 1;
}

.lightbox-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-track {
  display: flex;
  width: 100%;
  height: 100%;
  will-change: transform;
}

.lightbox-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.lightbox-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: oklch(100% 0 0 / 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  transition: background 0.2s;
}

.lightbox-close svg {
  width: 24px;
  height: 24px;
}

.lightbox-close:hover {
  background: oklch(100% 0 0 / 0.25);
}

.lightbox-counter {
  position: absolute;
  top: 24px;
  inset-inline-start: 20px;
  padding: 6px 14px;
  background: oklch(100% 0 0 / 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  z-index: 10001;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: oklch(100% 0 0 / 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  transition: background 0.2s, opacity 0.3s, transform 0.15s;
}

.lightbox-arrow svg {
  width: 26px;
  height: 26px;
}

.lightbox-arrow:hover {
  background: oklch(100% 0 0 / 0.25);
}

.lightbox-arrow:active {
  transform: translateY(-50%) scale(0.9);
}

[dir="rtl"] .lightbox-arrow-prev { right: 16px; left: auto; }
[dir="rtl"] .lightbox-arrow-next { left: 16px; right: auto; }
[dir="ltr"] .lightbox-arrow-prev { left: 16px; right: auto; }
[dir="ltr"] .lightbox-arrow-next { right: 16px; left: auto; }

.property-detail-card {
  background: white;
  margin-top: -16px;
  border-radius: 20px 20px 0 0;
  padding: var(--space-6) var(--container-padding);
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
}

.property-detail-header {
  margin-bottom: var(--space-5);
}

.property-detail-badges {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.detail-badge {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.detail-badge-verified {
  background: var(--color-verified);
  color: white;
}

.detail-badge-type {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.detail-badge-deal {
  background: var(--color-accent);
  color: white;
}

.property-detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: var(--space-3);
}

.property-detail-location {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.property-detail-price {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-primary-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
}

.property-detail-price-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.property-detail-price-currency {
  font-size: 1rem;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.property-detail-section {
  margin-bottom: var(--space-6);
}

.property-detail-section h3 {
  font-size: 1.0625rem;
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.property-features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.property-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
}

.property-feature-icon {
  width: 40px;
  height: 40px;
  background: white;
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.property-feature-icon svg {
  width: 20px;
  height: 20px;
}

.property-feature-info {
  min-width: 0;
}

.property-feature-label {
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
  letter-spacing: 0.03em;
}

.property-feature-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.property-description {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--color-text);
}

.amenities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3) var(--space-4);
}

.amenity-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.875rem;
  color: var(--color-text);
}

.amenity-item svg {
  width: 18px;
  height: 18px;
  color: var(--color-verified);
  flex-shrink: 0;
}

.property-map {
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  border: 0;
  margin-bottom: var(--space-4);
}

.map-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-accent);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Sticky contact bar */
.contact-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--container-padding);
  box-shadow: 0 -4px 16px oklch(20% 0.03 240 / 0.06);
  z-index: 90;
}

.contact-bar-inner {
  display: flex;
  gap: var(--space-2);
  max-width: var(--container-max);
  margin: 0 auto;
}

.contact-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition);
  text-align: center;
}

.contact-btn svg {
  width: 22px;
  height: 22px;
}

.contact-btn-whatsapp {
  background: #25D366;
  color: white;
}

.contact-btn-whatsapp:hover {
  background: #20BA5A;
}

.contact-btn-call {
  background: var(--color-primary);
  color: white;
}

.contact-btn-call:hover {
  background: var(--color-primary-hover);
}

.contact-btn-email {
  background: var(--color-bg-alt);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.contact-btn-email:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

/* Padding for content to not be hidden by contact bar */
.property-page-content {
  padding-bottom: 100px;
}

/* ============================================
   صفحة اعرض عقارك / Submit Property
   ============================================ */

.submit-page {
  padding-top: 76px;
  background: var(--color-bg-alt);
  min-height: 100vh;
}

.submit-container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding: var(--space-6) var(--container-padding) var(--space-8);
}

.submit-hero {
  text-align: center;
  margin-bottom: var(--space-7);
}

.submit-hero-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-5);
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-hero-icon svg {
  width: 40px;
  height: 40px;
}

.submit-hero h1 {
  font-size: 1.75rem;
  margin-bottom: var(--space-3);
}

.submit-hero p {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.assurance-card {
  background: white;
  border: 2px solid var(--color-verified);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  display: flex;
  gap: var(--space-4);
}

.assurance-icon {
  width: 44px;
  height: 44px;
  background: var(--color-verified);
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.assurance-icon svg {
  width: 22px;
  height: 22px;
}

.assurance-content h4 {
  font-size: 0.9375rem;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.assurance-content p {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.submit-form {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-5);
  border: 1px solid var(--color-border);
}

.form-section {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: var(--space-5);
}

.form-section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.05em;
  margin-bottom: var(--space-4);
  text-transform: uppercase;
}

.form-group {
  margin-bottom: var(--space-4);
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: oklch(60% 0.18 25);
  margin-inline-start: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.875rem var(--space-4);
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--color-text);
  font-family: inherit;
  transition: all var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  padding-inline-start: 2.5rem;
}

body.lang-ar .form-select {
  background-position: left 1rem center;
}

body.lang-en .form-select {
  background-position: right 1rem center;
  padding-inline-end: 2.5rem;
  padding-inline-start: var(--space-4);
}

.submit-success {
  text-align: center;
  padding: var(--space-7) var(--space-5);
  background: white;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-verified);
}

.submit-success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-5);
  background: var(--color-verified);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-success h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-3);
}

.submit-success p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-5);
  line-height: 1.7;
}

/* Hidden honeypot for spam protection */
.honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   SHARE BUTTON & TOAST
   زر المشاركة والإشعار
   ============================================ */

/* زر المشاركة في الـ header (يطفو فوق صورة العقار) */
.share-fab {
  position: absolute;
  top: var(--space-4);
  inset-inline-end: var(--space-4);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: oklch(100% 0 0 / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid oklch(100% 0 0 / 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 2px 8px oklch(20% 0.03 240 / 0.15);
  transition: all var(--transition);
  color: var(--color-primary);
}

.share-fab:hover {
  background: white;
  transform: scale(1.05);
  box-shadow: 0 4px 12px oklch(20% 0.03 240 / 0.2);
}

.share-fab:active {
  transform: scale(0.95);
}

.share-fab svg {
  width: 20px;
  height: 20px;
}

/* زر المشاركة في صف لوحة التحكم (admin) */
.btn-icon-share {
  color: var(--color-primary);
}

.btn-icon-share:hover {
  background: var(--color-primary-light);
}

/* التوست الأنيق */
.share-toast {
  position: fixed;
  bottom: 88px; /* فوق الـ contact bar */
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: oklch(20% 0.03 240);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-pill, 999px);
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px oklch(20% 0.03 240 / 0.3);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  max-width: calc(100% - 32px);
}

.share-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.share-toast svg {
  width: 18px;
  height: 18px;
  color: oklch(75% 0.18 145); /* أخضر للنجاح */
  flex-shrink: 0;
}

.share-toast-error svg {
  color: oklch(70% 0.2 25); /* أحمر للخطأ */
}

/* للديسكتوب: التوست في الأسفل وسط الشاشة */
@media (min-width: 768px) {
  .share-toast {
    bottom: 32px;
  }
}
