/*
 * هون MOTORX - Vehicle Details Page Mobile Optimizations
 * css/vehicle-details.css - الـ ستايل تبع الصفحة
 * هون Shared containment و mobile-specific safeguards لـ الـ details page.
 */

.details-page,
#details-container,
.details-layout,
.details-main,
.sidebar,
.details-section,
.sidebar-card,
.gallery {
  max-width: 100%;
  min-width: 0;
}

.details-page {
  overflow-x: clip;
}

.details-page img,
.details-page video,
.details-page iframe,
.details-page canvas,
.details-page object,
.details-page embed {
  max-width: 100%;
}

.details-page iframe,
.details-page ins,
.details-page .adsbygoogle,
.details-page .ad-slot,
.details-page .ad-container,
.details-page .advertisement,
.details-page [data-ad-slot] {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden;
}

.details-section,
.sidebar-card,
.spec-value,
.feature-badge {
  overflow-wrap: anywhere;
}

.gallery-arrow,
#lb-prev,
#lb-next {
  direction: ltr;
  unicode-bidi: isolate;
}

.gallery-chevron {
  display: block;
  width: 14px;
  height: 14px;
  border-color: currentColor;
  border-style: solid;
  border-width: 0 3px 3px 0;
  pointer-events: none;
}

.gallery-chevron-left {
  transform: rotate(135deg);
  margin-left: 4px;
}

.gallery-chevron-right {
  transform: rotate(-45deg);
  margin-right: 4px;
}

/*
 * هون GALLERY - aspect-ratio based sizing
 * هون Prevents الـ main image from having a fixed pixel height that
 * هون clips on phones or stretches on landscape.
 */
.vd-gallery-main,
.gallery-main-img,
.vehicle-main-image {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
}

/* هون GALLERY ARROWS - 48px touch targets */
.gallery-arrow,
.gallery-prev,
.gallery-next,
.vd-arrow {
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* هون GALLERY THUMBNAILS - scroll-snap + fixed size */
.gallery-thumbs,
.vd-thumbs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.gallery-thumbs::-webkit-scrollbar,
.vd-thumbs::-webkit-scrollbar {
  display: none;
}

.gallery-thumb,
.vd-thumb {
  flex-shrink: 0;
  scroll-snap-align: start;
  width: 72px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.gallery-thumb.active,
.vd-thumb.active {
  border-color: var(--clr-brand);
}

/* هون LIGHTBOX - 100dvh + swipe-to-close hint */
.lightbox,
.vd-lightbox,
#lightbox {
  height: 100dvh;
  height: 100vh; /* لو ما زبط */
  touch-action: pan-y;
  overscroll-behavior: contain;
}

@supports (height: 100dvh) {
  .lightbox,
  .vd-lightbox,
  #lightbox {
    height: 100dvh;
  }
}

/* هون Swipe-down hint bar */
.lightbox-drag-handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  margin: 12px auto 0;
  display: none;
}

@media (max-width: 480px) {
  .lightbox-drag-handle {
    display: block;
  }
}

/* هون SIDEBAR - order:-1 on mobile (shows above specs) */
@media (max-width: 768px) {
  .vd-sidebar,
  .vehicle-details-sidebar,
  .seller-card-section {
    order: -1;
  }

  .vd-layout,
  .vehicle-details-layout {
    display: flex;
    flex-direction: column;
  }
}

/* هون SPECS - 2-column grid */
@media (max-width: 768px) {
  .vd-specs,
  .specs-grid,
  .vehicle-specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
}

/* هون FEATURE BADGES - 2-col wrap on phones */
@media (max-width: 480px) {
  .vd-features,
  .vehicle-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* هون SELLER BUTTONS - full width on phones */
@media (max-width: 480px) {
  .vd-seller-actions,
  .seller-actions {
    flex-direction: column;
  }

  .vd-seller-actions .btn,
  .seller-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 52px;
  }
}

/* هون BREADCRUMB - truncate long model names */
@media (max-width: 480px) {
  .breadcrumb,
  .vd-breadcrumb {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .breadcrumb-item:not(:last-child) {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }
}

/* هون INSPECTION CERT BUTTON - full width on phones */
@media (max-width: 480px) {
  .vd-cert-btn,
  .inspection-cert-btn,
  #view-cert-btn {
    width: 100%;
    justify-content: center;
  }
}

/* هون AI RATING BAR - fixed height */
@media (max-width: 480px) {
  .ai-rating-bar,
  .vd-ai-bar {
    height: 8px;
  }
}


