/* ============================================
   PREOWNED PROPERTIES — OFF-PLAN PAGE (UAE)
   ============================================ */

body.offplan-page {
  background: var(--surface);
}

body.offplan-page .site-main {
  min-height: 100vh;
  padding-top: var(--nav-height);
}

body.offplan-page .glass-nav .nav-link.active {
  color: var(--accent) !important;
}

body.offplan-page .glass-nav .nav-link.active::after {
  width: calc(100% - 32px);
}

@media (max-width: 991.98px) {
  body.offplan-page {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  }

  body.offplan-page .site-footer {
    padding-bottom: calc(24px + var(--mobile-nav-height) + env(safe-area-inset-bottom));
  }

  body.offplan-page .back-to-top {
    bottom: calc(var(--mobile-nav-height) + 16px + env(safe-area-inset-bottom));
  }
}

body.offplan-page.offplan-drawer-open {
  overflow: hidden;
}

/* Hero */
.offplan-hero {
  position: relative;
  padding: 48px 0 56px;
  overflow: hidden;
  background: var(--primary);
}

.offplan-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(9, 0, 89, 0.32) 0%, rgba(9, 0, 89, 0.72) 100%), url('https://images.unsplash.com/photo-1512453979798-5ea266f8880c?w=1600&q=80') center/cover no-repeat;
  z-index: 0;
}

.offplan-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 820px;
}

.offplan-hero .section-tag {
  margin-bottom: 16px;
}

.offplan-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  color: #fff;
  margin-bottom: 16px;
}

.offplan-hero p {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.08rem;
  line-height: 1.75;
  margin-bottom: 32px;
}

.offplan-hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 32px;
}

.offplan-hero-stats div {
  text-align: center;
}

.offplan-hero-stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--accent);
  line-height: 1.1;
}

.offplan-hero-stats span {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
}

/* Toolbar */
.offplan-bar-section {
  position: relative;
  z-index: 1030;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 16px 0;
}

.offplan-toolbar-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.offplan-toolbar-field {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  min-height: 46px;
}

.offplan-toolbar-field label {
  color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}

.offplan-toolbar-field select {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.offplan-toolbar-field:focus-within,
.offplan-toolbar-field:has(.select2-container--open),
.offplan-toolbar-field:has(.select2-container--focus) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.offplan-toolbar-field .select2-container {
  flex: 1;
  min-width: 0;
}

.offplan-toolbar-field .select2-container--default .select2-selection--single {
  background: transparent;
  border: none;
  height: auto;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.offplan-toolbar-field .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 11px 24px 11px 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.offplan-toolbar-field .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--muted);
}

.offplan-toolbar-field .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 0;
}

.offplan-toolbar-field .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--muted) transparent transparent transparent;
}

.offplan-toolbar-field .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--muted) transparent;
}

.offplan-toolbar-submit,
.offplan-filters-btn {
  flex-shrink: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.offplan-filters-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 50px;
  background: var(--accent);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 4px;
}

/* Results bar */
.offplan-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 0 8px;
  max-width: 1320px;
  margin: 0 auto;
  padding-left: 12px;
  padding-right: 12px;
}

.offplan-results-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.offplan-results-count strong {
  color: var(--text);
}

.offplan-results-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.offplan-clear-filters {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  transition: color var(--transition);
  display: none;
}

.offplan-clear-filters.is-visible {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.offplan-clear-filters:hover {
  color: var(--primary);
}

.offplan-sort-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
}

.offplan-sort-select {
  min-width: 180px;
  padding: 8px 36px 8px 14px;
  font-size: 0.88rem;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b7280'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  transition: border-color var(--transition);
}

.offplan-sort-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Results grid */
.offplan-results-section {
  padding-bottom: 48px;
}

.offplan-results-grid.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Project card */
.offplan-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}

.offplan-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(var(--accent-rgb), 0.4);
  transform: translateY(-4px);
}

.offplan-card-gallery {
  position: relative;
}

.offplan-card-gallery .property-gallery {
  aspect-ratio: 1 / 1;
  height: 100%;
}

.offplan-card-gallery .property-gallery-slide img {
  object-fit: cover;
  object-position: center;
}

.offplan-card-badges,
.offplan-card-dev-logo {
  z-index: 4;
  pointer-events: none;
}

.offplan-card-gallery .gallery-nav,
.offplan-card-gallery .gallery-dots,
.offplan-card-gallery .gallery-counter {
  z-index: 5;
}

.offplan-card:hover .gallery-nav,
.offplan-card .gallery-nav:focus-visible {
  opacity: 1;
}

.offplan-card-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.offplan-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.offplan-badge--featured {
  background: var(--accent);
  color: var(--primary);
}

.offplan-badge--handover {
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
}

.offplan-card-dev-logo {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  max-width: 100px;
}

.offplan-card-dev-logo img {
  max-height: 28px;
  width: auto;
  object-fit: contain;
  display: block;
}

.offplan-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.offplan-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.offplan-card-location {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.offplan-card-location i {
  color: var(--accent);
  margin-right: 4px;
}

.offplan-card-price {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.offplan-card-price span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--font-body);
}

.offplan-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 18px;
  font-size: 0.82rem;
  color: var(--text);
}

.offplan-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--surface);
  border-radius: 50px;
  border: 1px solid var(--border);
}

.offplan-card-meta i {
  color: var(--accent);
}

.offplan-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.offplan-card-footer .btn-view-details {
  font-size: 0.82rem;
  padding: 8px 14px;
}

/* No results */
.offplan-no-results {
  text-align: center;
  padding: 64px 24px;
}

.offplan-no-results-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--accent);
}

/* Benefits */
.offplan-benefits {
  background: var(--background);
  border-top: 1px solid var(--border);
}

.offplan-benefit-card {
  height: 100%;
  padding: 28px 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.offplan-benefit-card:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.offplan-benefit-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), rgba(var(--accent-rgb), 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: var(--primary);
  margin-bottom: 16px;
}

.offplan-benefit-card h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  color: var(--text);
}

.offplan-benefit-card p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.65;
}

/* Developers */
.offplan-developers {
  background: var(--surface);
  overflow: hidden;
}

.offplan-developers .partners-marquee {
  margin-top: 8px;
}

/* FAQ */
.offplan-faq {
  background: var(--background);
}

.offplan-faq-intro {
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 0;
}

.offplan-accordion .accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md) !important;
  margin-bottom: 12px;
  overflow: hidden;
}

.offplan-accordion .accordion-button {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  background: var(--surface);
  box-shadow: none;
}

.offplan-accordion .accordion-button:not(.collapsed) {
  background: var(--surface);
  color: var(--primary);
}

.offplan-accordion .accordion-body {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* Filter drawer */
.offplan-filter-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.offplan-filter-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.offplan-filter-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 400px);
  height: 100%;
  background: var(--background);
  z-index: 1050;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
}

.offplan-filter-drawer.is-open {
  transform: translateX(0);
}

.offplan-filter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.offplan-filter-drawer-header h2 {
  font-size: 1.25rem;
  margin: 0;
  color: var(--text);
}

.offplan-filter-drawer-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.offplan-filter-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.offplan-filter-field {
  margin-bottom: 20px;
}

.offplan-filter-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.offplan-filter-field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
}

.offplan-filter-field .select2-container {
  width: 100% !important;
}

.offplan-filter-field .select2-container--default .select2-selection--single {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: auto;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.offplan-filter-field .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 10px 28px 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.offplan-filter-field .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--muted);
}

.offplan-filter-field .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 10px;
}

.offplan-filter-field .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--muted) transparent transparent transparent;
}

.offplan-filter-field .select2-container--default.select2-container--open .select2-selection--single,
.offplan-filter-field .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.offplan-filter-field .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--muted) transparent;
}

.select2-dropdown.offplan-select2-dropdown {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1060;
  padding: 6px 0;
  font-family: var(--font-body);
  box-sizing: border-box;
}

.offplan-select2-dropdown .select2-results__option {
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9rem;
}

.offplan-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--primary);
}

.offplan-select2-dropdown .select2-results__option--selected {
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--primary);
}

.offplan-select2-dropdown .select2-search--dropdown {
  padding: 8px 12px 4px;
}

.offplan-select2-dropdown .select2-search--dropdown .select2-search__field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
}

.offplan-select2-dropdown .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.offplan-select2-dropdown .select2-search--dropdown .select2-search__field::placeholder {
  color: var(--muted);
}

.offplan-filter-drawer-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

.offplan-filter-drawer-actions .btn {
  flex: 1;
}

@media (max-width: 767.98px) {
  .offplan-hero {
    padding: 32px 0 40px;
  }

  .offplan-toolbar-field {
    min-width: 100%;
  }

  .offplan-toolbar-submit,
  .offplan-filters-btn {
    width: 100%;
    justify-content: center;
  }

  .offplan-results-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
