/* Mabkhra Haill — Custom CSS (cleaned 2026-10-14) */
/* CSS only - plain CSS rules, no HTML tags or JavaScript here. */

/* ===== Brand tokens ===== */
:root {
  --mh-brown: #5c3e14;
  --mh-brown-dark: #3d2a0e;
  --mh-gold: #b08d57;
  --mh-sand: #f7f1e6;
  --mh-sand-2: #efe3cf;
  --mh-line: #e6d6bb;
  --mh-radius: 10px;
}

/* ===== Product cards ===== */
/* Preserve product image proportions in the existing image frames. */
#main-content .s-product-card-image > a:has(> img.s-product-card-image-contain) {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#main-content .s-product-card-image > a > img.s-product-card-image-contain {
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Consistent card text: titles max 2 lines (same height), subtitles 1 line,
   so prices and buttons line up across a row. */
.s-product-card-entry .s-product-card-content-title {
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.6;
  min-height: 3.2em;
}

.s-product-card-entry .s-product-card-content-subtitle {
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

/* Small phones: keep the full "أضف إلى السلة" label visible. */
@media (max-width: 480px) {
  .s-product-card-content-footer .s-button-btn {
    padding-inline: 10px !important;
  }

  .s-product-card-content-footer .s-button-text {
    text-overflow: clip !important;
    font-size: 13px;
  }
}

/* Keep the add-to-cart label readable beside its icon. */
#main-content .s-product-card-content-footer .s-button-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#main-content .s-product-card-content-footer .s-button-text > span {
  display: inline !important;
  visibility: visible !important;
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
}

#main-content .s-product-card-content-footer button {
  min-height: 44px;
}

/* ===== Buttons: one height and radius everywhere ===== */
.s-button-element.s-button-btn:not(.s-button-icon):not(.s-product-card-wishlist-btn) {
  border-radius: var(--mh-radius);
  min-height: 44px;
}

/* ===== Payment logos ===== */
.s-payments-list-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.s-payments-list-item > img {
  width: auto !important;
  height: auto !important;
  max-width: 40px;
  max-height: 24px;
  object-fit: contain;
}

/* ===== Homepage spacing ===== */
#main-content > section.s-block[component-id] {
  margin-top: 40px;
}

/* Reserve space for featured products and reviews (less layout shift). */
#main-content > section[component-id="885899339"] {
  min-height: 527px;
}

#main-content > section[component-id="782959003"] salla-reviews {
  display: block;
  min-height: 250px;
}

/* ===== Hero (first text block) ===== */
#main-content > section[component-id="15766846"] {
  background:
    linear-gradient(180deg, var(--mh-sand) 0%, var(--mh-sand-2) 100%);
  border: 1px solid var(--mh-line);
  border-radius: 16px;
  max-width: 1280px;
  margin-inline: auto;
  margin-top: 16px;
  padding-block: 8px;
}

@media (max-width: 1311px) {
  #main-content > section[component-id="15766846"] {
    margin-inline: 16px;
  }
}

/* ===== "Shop by category" tiles (Square Photos) ===== */
/* The images are wide banners (2.6:1) that already contain the category
   name, so: full-width tiles at the banner ratio, no grey letterbox,
   and the duplicate overlay title is kept for screen readers only. */
[data-testid="store-home-square-photos"] .square-photos-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 12px !important;
}

[data-testid="store-home-square-photos"] .banner-entry {
  position: relative;
  display: block;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 500 / 193 !important;
  border-radius: var(--mh-radius);
  overflow: hidden;
  background-color: #2b1d0a;
}

[data-testid="store-home-square-photos"] .banner-entry .lazy__bg {
  position: absolute;
  inset: 0;
  background-size: cover !important;
  background-position: center !important;
}

[data-testid="store-home-square-photos"] .banner-entry::before,
[data-testid="store-home-square-photos"] .banner-entry::after {
  display: none !important;
}

[data-testid="store-home-square-photos"] .banner-entry h3 {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (min-width: 640px) {
  [data-testid="store-home-square-photos"] .square-photos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
  }
}

@media (min-width: 1024px) {
  [data-testid="store-home-square-photos"] .square-photos-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 20px !important;
  }

  [data-testid="store-home-square-photos"] .banner-entry {
    grid-column: span 2;
  }

  /* 5 tiles: center the second row. */
  [data-testid="store-home-square-photos"] .banner-entry:nth-child(4):nth-last-child(2) {
    grid-column: 2 / span 2;
  }
}

/* ===== Header ===== */
@media (max-width: 767px) {
  .navbar-brand img {
    height: 40px !important;
    width: auto !important;
    max-width: 150px;
    object-fit: contain;
  }
}

/* ===== Footer: correct direction for the "about" paragraph ===== */
footer .max-w-sm.leading-6 {
  unicode-bidi: plaintext;
}

html[dir="rtl"] footer .max-w-sm.leading-6 {
  text-align: right;
}

/* ===== Floating buttons: no overlaps =====
   Left column (bottom to top): WhatsApp, chat, games.
   Right column: Salla help (?) button (fixed by Salla), Google badge above it. */
#zs-fl-tip {
  display: none !important; /* hide auto chat greeting, keep launcher */
}

.wa-s-n {
  left: 18px !important;
  right: auto !important;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
}

#zsiq_float {
  left: 18px !important;
  right: auto !important;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
}

#mh-games-patch-btn {
  left: 18px !important;
  right: auto !important;
  bottom: calc(140px + env(safe-area-inset-bottom, 0px)) !important;
}

#google-merchantwidget-iframe-wrapper {
  transform: translateY(-90px);
}

/* ===== Mobile ===== */
@media (max-width: 767px) {
  #main-content > section.s-block[component-id] {
    margin-top: 24px;
  }

  #main-content > section[component-id="885899339"] {
    min-height: 400px;
  }

  #mh-games-patch-btn {
    max-width: 180px;
    font-size: 12px;
  }
}