/**
 * Badi Beit – layout shell, overflow guards, Alpine cloak, RTL fixes
 */

[x-cloak] {
  display: none !important;
}

html,
html.overflow-x-clip {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body,
body.overflow-x-clip {
  overflow-x: hidden !important;
  max-width: 100%;
  width: 100%;
  min-height: 100dvh;
  min-height: 100vh;
  position: relative;
}

/* Prevent flex/grid children from forcing horizontal scroll */
main,
header,
footer,
section,
.product-card,
#productsRoot,
#heroSlider,
#trusted-slider {
  max-width: 100%;
}

#heroSlider {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  min-height: 280px;
  max-height: 360px;
  contain: layout style paint;
  isolation: isolate;
}

@media (min-width: 640px) {
  #heroSlider {
    aspect-ratio: 16 / 10;
    min-height: 300px;
    max-height: 440px;
  }
}

@media (min-width: 768px) {
  #heroSlider {
    aspect-ratio: 21 / 9;
    min-height: 320px;
    max-height: 480px;
  }
}

@media (min-width: 1024px) {
  #heroSlider {
    max-height: 520px;
  }
}

#heroSlider [data-track] {
  width: 100%;
}

#heroSlider [data-slide] {
  flex: 0 0 100%;
  min-width: 100%;
  max-width: 100%;
}

#heroSlider img,
#heroSlider video {
  width: 100%;
  max-width: 100%;
}

/* ——— Hero slider (homepage) — always LTR layout (same shape in Arabic) ——— */
#heroSlider,
.bb-hero-slider {
  direction: ltr;
}

.bb-hero-slider {
  position: relative;
  background: #001a3d;
  touch-action: pan-y pinch-zoom;
}

.bb-hero-slider [data-track] {
  display: flex;
  height: 100%;
  transition: transform 0.35s ease-out;
  direction: ltr;
}

[dir="rtl"] #heroSlider,
[dir="rtl"] #heroSlider .bb-hero-slide__content,
[dir="rtl"] #heroSlider .bb-hero-slide__copy,
[dir="rtl"] .bb-hero-slide__content,
[dir="rtl"] .bb-hero-slide__copy {
  direction: ltr;
  text-align: left;
}

#trusted-slider {
  direction: ltr;
}

[dir="rtl"] .bb-card-media {
  direction: ltr;
}

.bb-hero-slider.is-animating [data-track] {
  pointer-events: none;
}

.bb-hero-slide {
  position: relative;
  height: 100%;
  overflow: hidden;
}

.bb-hero-slide__media {
  position: absolute;
  inset: 0;
  background: #001a3d;
}

.bb-hero-slide__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  user-select: none;
  pointer-events: none;
  transform: translateZ(0);
}

@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .bb-hero-slide__media img {
    transform: scale(1);
    transition: transform 6s ease-out;
  }

  .bb-hero-slide.is-active .bb-hero-slide__media img {
    transform: scale(1.04);
  }
}

.bb-hero-slide__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(0, 26, 61, 0.88) 0%, rgba(0, 38, 84, 0.55) 42%, rgba(0, 51, 108, 0.15) 68%, transparent 100%),
    linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 45%);
  pointer-events: none;
}

.bb-hero-slide__content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  padding: 1.25rem 1rem 3.25rem;
  pointer-events: none;
}

@media (min-width: 768px) {
  .bb-hero-slide__content {
    align-items: center;
    padding: 2rem 2rem 3.5rem;
  }
}

.bb-hero-slide__inner {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  pointer-events: auto;
}

.bb-hero-slide__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e1c45c;
  margin: 0 0 0.75rem;
}

.bb-hero-slide__eyebrow::before {
  content: "";
  display: block;
  width: 2rem;
  height: 2px;
  background: #e1c45c;
  border-radius: 9999px;
}

.bb-hero-slide__title {
  margin: 0;
  max-width: 36rem;
  font-size: clamp(1.375rem, 4vw, 2.625rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.bb-hero-slide__desc {
  margin: 0.75rem 0 0;
  max-width: 32rem;
  font-size: clamp(0.875rem, 2vw, 1.0625rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bb-hero-slide__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1.375rem;
  border-radius: 0.375rem;
  border: 2px solid #e1c45c;
  background: #e1c45c;
  color: #00336c;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 6;
  transition: background 0.15s ease, color 0.15s ease;
}

.bb-hero-slide__cta:active {
  background: #00336c;
  color: #e1c45c;
}

@media (hover: hover) {
  .bb-hero-slide__cta:hover {
    background: #00336c;
    color: #e1c45c;
  }

  .bb-hero-slide__cta:hover i {
    transform: translateX(3px);
  }
}

.bb-hero-slide__cta i {
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

.bb-hero-slide__copy {
  opacity: 1;
  transform: none;
}

@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .bb-hero-slide__copy {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.35s ease, transform 0.35s ease;
  }

  .bb-hero-slide.is-active .bb-hero-slide__copy {
    opacity: 1;
    transform: translateY(0);
  }
}

.bb-hero-slide.is-active .bb-hero-slide__copy {
  opacity: 1;
  transform: translateY(0);
}

.bb-hero-nav {
  position: absolute;
  top: 50%;
  z-index: 10;
  transform: translateY(-50%);
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 9999px;
  border: 2px solid rgba(225, 196, 92, 0.85);
  background: rgba(0, 51, 108, 0.88);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: background 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.bb-hero-nav:hover {
  background: #e1c45c;
  color: #00336c;
  border-color: #00336c;
  transform: translateY(-50%) scale(1.06);
}

.bb-hero-nav--prev { left: 0.75rem; }
.bb-hero-nav--next { right: 0.75rem; }

@media (min-width: 768px) {
  .bb-hero-nav {
    width: 3rem;
    height: 3rem;
  }
  .bb-hero-nav--prev { left: 1.25rem; }
  .bb-hero-nav--next { right: 1.25rem; }
}

.bb-hero-dots {
  position: absolute;
  bottom: 0.875rem;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.625rem;
  border-radius: 9999px;
  background: rgba(0, 26, 61, 0.65);
}

.bb-hero-dots button {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
}

.bb-hero-dots button[aria-current="true"] {
  width: 1.375rem;
  background: #e1c45c;
}

.bb-hero-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
}

.bb-hero-progress__bar {
  display: block;
  height: 100%;
  width: 0%;
  background: #e1c45c;
}

.bb-hero-progress__bar.is-running {
  animation: bb-hero-progress-fill 8s linear forwards;
}

@keyframes bb-hero-progress-fill {
  from { width: 0%; }
  to { width: 100%; }
}

.bb-hero-counter {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  z-index: 10;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  background: rgba(0, 26, 61, 0.65);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.bb-hero-counter span {
  color: #e1c45c;
}

@media (max-width: 767px) {
  .bb-hero-nav {
    display: flex !important;
    width: 2.75rem;
    height: 2.75rem;
    z-index: 10;
  }

  .bb-hero-nav--prev { left: 0.5rem; }
  .bb-hero-nav--next { right: 0.5rem; }

  .bb-hero-slide__media img {
    transform: none !important;
    transition: none !important;
  }

  .bb-hero-slide__content {
    padding-bottom: 3.25rem;
  }

  .bb-hero-counter {
    top: 0.625rem;
    right: 0.625rem;
    font-size: 0.625rem;
    padding: 0.3rem 0.55rem;
  }

  .bb-hero-dots {
    bottom: 0.625rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .bb-hero-nav {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* Product grids – cards must shrink inside columns */
#grid-premium,
#grid-latest {
  width: 100%;
  min-width: 0;
}

#grid-premium > .product-card,
#grid-latest > .product-card {
  min-width: 0;
}

.bb-card-media img,
.bb-card-media video,
.bb-product-gallery__media.bb-preview-video,
video.bb-preview-video,
video.bb-card-video,
video.bb-show-video,
video.lazy-video {
  pointer-events: none !important;
  -webkit-user-drag: none;
  user-select: none;
  touch-action: none;
}

video.bb-preview-video {
  object-fit: cover;
}

video.bb-product-gallery__media.bb-preview-video {
  object-fit: contain;
}

/* Hide all native video controls / iOS play overlay on previews */
video.bb-preview-video::-webkit-media-controls,
video.bb-preview-video::-webkit-media-controls-enclosure,
video.bb-preview-video::-webkit-media-controls-panel,
video.bb-preview-video::-webkit-media-controls-play-button,
video.bb-preview-video::-webkit-media-controls-start-playback-button,
video.bb-preview-video::-webkit-media-controls-overlay-play-button {
  display: none !important;
  -webkit-appearance: none;
  opacity: 0;
  pointer-events: none;
}

.bb-slide.is-active {
  display: block !important;
}

/* Brand color missing from compiled Tailwind */
.bg-primary-dark {
  background-color: #002654 !important;
}

.hover\:bg-primary-dark:hover {
  background-color: #002654 !important;
}

.overflow-x-hidden {
  overflow-x: hidden;
}

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

/* Site typography — Roboto (OLX-style clean sans-serif) */
.font-brand {
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.font-brand h1,
.font-brand h2,
.font-brand h3,
.font-brand h4,
.font-brand p,
.font-brand span,
.font-brand a,
.font-brand button,
.font-brand label,
.font-brand input,
.font-brand select,
.font-brand textarea,
.font-display {
  font-family: inherit !important;
}

.font-brand i[class*="fa-"],
.font-brand .fa,
.font-brand .fas,
.font-brand .far,
.font-brand .fab,
.font-brand .fal,
.font-brand .fad {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
}

.font-brand .fab {
  font-family: "Font Awesome 6 Brands" !important;
}

/* Home listing cards — slightly larger OLX-like type */
.font-brand .bb-card {
  font-size: 15px;
  line-height: 1.45;
}

.font-brand .bb-card .bb-card-price {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.font-brand .bb-card .bb-card-ref {
  font-size: 0.875rem;
}

.font-brand .bb-card .bb-card-title {
  font-size: 1rem;
  font-weight: 500;
  color: #002f34;
}

.font-brand .bb-card .bb-card-meta {
  font-size: 0.875rem;
}

.font-brand .bb-card .bb-card-actions {
  font-size: 0.875rem;
  font-weight: 500;
}

/* Sidebar drawer — transform off-screen (overflow-x hidden on html prevents scroll blowout) */
#sidebar.bb-sidebar,
.bb-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 16rem;
  z-index: 99999;
  left: 0;
  right: auto;
  transition: transform 0.3s ease-in-out, visibility 0.3s ease-in-out;
  transform: translate3d(-100%, 0, 0);
  visibility: hidden;
  pointer-events: none;
  will-change: transform;
}

#sidebar.bb-sidebar:not(.-translate-x-full),
.bb-sidebar:not(.-translate-x-full) {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  pointer-events: auto;
}

[dir="rtl"] #sidebar.bb-sidebar,
[dir="rtl"] .bb-sidebar {
  left: auto;
  right: 0;
  border-right: 0;
  border-left: 1px solid #e5e7eb;
  transform: translate3d(100%, 0, 0);
}

[dir="rtl"] #sidebar.bb-sidebar:not(.-translate-x-full),
[dir="rtl"] .bb-sidebar:not(.-translate-x-full) {
  transform: translate3d(0, 0, 0);
}

/* RTL page layout */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] main,
[dir="rtl"] header,
[dir="rtl"] footer,
[dir="rtl"] .font-brand {
  width: 100%;
  max-width: 100%;
}

[dir="rtl"] #heroSlider,
[dir="rtl"] .bb-product-gallery,
[dir="rtl"] .bb-card-media,
[dir="rtl"] #trusted-slider {
  direction: ltr;
}

[dir="rtl"] .bb-product-page {
  direction: rtl;
}

[dir="rtl"] .bb-card-ref {
  margin-left: 0;
  margin-inline-start: auto;
}

[dir="rtl"] .bb-sidebar-toggle {
  margin-left: 0;
  margin-inline-start: 0.5rem;
}

@media (min-width: 640px) {
  [dir="rtl"] .bb-sidebar-toggle {
    margin-inline-start: 0.75rem;
  }
}

/* Safe area for notched phones (PWA / mobile browser) */
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .bg-primary.text-white.text-sm.py-1.px-4 {
    padding-top: max(0.25rem, env(safe-area-inset-top));
  }
}

/* Product detail gallery — explicit sizing (Tailwind h-64 not in build) */
.bb-product-gallery {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 240px;
  max-height: 420px;
  background-color: #f3f4f6;
  overflow: hidden;
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.bb-product-gallery__blur {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(24px);
  transform: scale(1.08);
  opacity: 0.45;
}

/* Slides use HTML hidden + Alpine x-bind:hidden (see show.blade.php) */
.bb-product-gallery__slide[hidden] {
  display: none !important;
}

.bb-product-gallery__slide:not([hidden]) {
  display: flex !important;
}

.bb-product-gallery__media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.75rem;
  cursor: pointer;
}

.bb-product-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background-color: #00336c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
}

.bb-product-gallery__nav:hover {
  background-color: #002654;
}

.bb-product-gallery__nav--prev { left: 0.5rem; }
.bb-product-gallery__nav--next { right: 0.5rem; }

@media (min-width: 640px) {
  .bb-product-gallery {
    min-height: 280px;
    max-height: 480px;
  }
}

/* Top bar – social icons always visible on portrait phones */
.bb-top-bar {
  overflow: visible;
  flex-wrap: nowrap;
}

.bb-sidebar-toggle {
  margin-left: 0.5rem;
  padding: 0.25rem 0.35rem;
}

@media (min-width: 640px) {
  .bb-sidebar-toggle {
    margin-left: 0.75rem;
  }
}

.bb-top-bar-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  overflow: visible;
}

.bb-top-bar-social {
  display: flex !important;
  flex-shrink: 0;
  align-items: center;
  overflow: visible;
}

.bb-social-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  flex-shrink: 0;
  color: #fff;
}

.bb-social-btn i {
  font-size: 0.875rem;
  line-height: 1;
}

@media (min-width: 640px) {
  .bb-social-btn {
    width: 2.25rem;
    height: 2.25rem;
    min-width: 2.25rem;
    min-height: 2.25rem;
  }

  .bb-social-btn i {
    font-size: 1rem;
  }
}

/* Touch-friendly compact mobile layout */
@media (max-width: 639px) {
  .bb-mobile-compact-header .bb-post-ad-btn {
    font-size: 0.75rem;
    line-height: 1rem;
    padding: 0.375rem 0.625rem;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bb-mobile-compact-header .bb-brand-sub {
    display: none;
  }

  .bb-lang-select {
    font-size: 0.75rem;
  }
}

/* Skip link (accessibility) */
.bb-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 0.5rem 1rem;
  background: #00336c;
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 0.375rem 0;
}

.bb-skip-link:focus {
  left: 0;
}

/* Back to top */
.bb-back-to-top {
  position: fixed;
  right: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 9998;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  border: 2px solid #e1c45c;
  background: linear-gradient(145deg, #003a79 0%, #00336c 100%);
  color: #e1c45c;
  box-shadow:
    0 4px 16px rgba(0, 51, 108, 0.4),
    0 0 0 1px rgba(225, 196, 92, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 12px, 0) scale(0.92);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform, opacity;
}

.bb-back-to-top:hover,
.bb-back-to-top:focus-visible {
  background: linear-gradient(145deg, #e1c45c 0%, #c9a84a 100%);
  color: #00336c;
  border-color: #003a79;
  box-shadow:
    0 6px 20px rgba(225, 196, 92, 0.45),
    0 0 0 3px rgba(0, 58, 121, 0.25);
  outline: none;
}

.bb-back-to-top--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.bb-back-to-top i {
  font-size: 0.9375rem;
  pointer-events: none;
}
