/*
 * Qarmasha — Custom CSS for Salla
 * الإصدار: 1.0
 * الاستخدام: انسخ الملف كاملاً إلى خانة CSS المخصص في محرر القالب.
 * ملاحظة: هذا الملف يغيّر المظهر فقط ولا يلمس وظائف السلة أو الدفع.
 */

:root {
  --q-primary: #6e2f1d;
  --q-primary-dark: #000000;
  --q-primary-soft: #f3e5dd;
  --q-accent: #d59a35;
  --q-accent-dark: #a96e16;
  --q-cream: #fffaf4;
  --q-surface: #ffffff;
  --q-surface-soft: #faf6f0;
  --q-text: #939393;
  --q-muted: #786b65;
  --q-border: #eadfd6;
  --q-success: #2d7a4b;
  --q-radius-sm: 10px;
  --q-radius-md: 16px;
  --q-radius-lg: 24px;
  --q-shadow-sm: 0 4px 16px rgba(61, 31, 20, 0.07);
  --q-shadow-md: 0 12px 32px rgba(61, 31, 20, 0.12);
  --q-container: 1240px;
  --q-transition: 220ms ease;
}

/* الأساس العام */
html {
  scroll-behavior: smooth;
 }

body.qarmasha-page-home,
body.salla-1298199463 {
   color: var(--q-text);
  font-family: "Pingarlt", "Tajawal", "Arial", sans-serif;
  line-height: 1.7;
  overflow-x: hidden;
}

body * {
  box-sizing: border-box;
}

::selection {
  background: var(--q-primary);
  color: #fff;
}

:focus-visible {
  outline: 3px solid rgba(213, 154, 53, 0.9);
  outline-offset: 3px;
}

.container {
  width: min(100% - 32px, var(--q-container));
  margin-inline: auto;
}

/* شريط أعلى الصفحة والرأس */
.store-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 250, 244, 0.96);
  border-bottom: 1px solid rgba(234, 223, 214, 0.85);
  box-shadow: 0 2px 14px rgba(61, 31, 20, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.store-header .inner,
.store-header > div {
  min-height: 76px;
}

.store-header a {
  color: var(--q-text);
  text-decoration: none;
  transition: color var(--q-transition), opacity var(--q-transition);
}

.store-header a:hover {
  color: var(--q-primary);
}

.header-search .s-search-input,
.s-search-input {
  min-height: 42px !important;
  border: 1px solid var(--q-border) !important;
  background: var(--q-surface) !important;
  color: var(--q-text) !important;
  box-shadow: none !important;
  transition: border-color var(--q-transition), box-shadow var(--q-transition);
}

.header-search .s-search-input:focus,
.s-search-input:focus {
  border-color: var(--q-accent) !important;
  box-shadow: 0 0 0 4px rgba(213, 154, 53, 0.14) !important;
}

.header-search .s-search-input::placeholder,
.s-search-input::placeholder {
  color: var(--q-muted);
}

.s-cart-summary-wrapper {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  color: var(--q-primary) !important;
}

.s-cart-summary-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 4px;
  border-radius: 999px;
  background: var(--q-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* القائمة */
.main-nav,
.mobile-menu,
#mobile-menu {
  color: var(--q-text);
}

.main-nav a,
#mobile-menu a {
  transition: color var(--q-transition), background var(--q-transition);
}

.main-nav a:hover,
#mobile-menu a:hover {
  color: var(--q-primary);
}

/* صورة البطل */
.s-block--bundle-hero-section {
  width: min(100% - 32px, var(--q-container));
  margin: 24px auto 48px;
  overflow: hidden;
  border-radius: var(--q-radius-lg);
  box-shadow: var(--q-shadow-md);
  background: var(--q-primary-soft);
}

.s-block--bundle-hero-section salla-hero-section-ps96by {
  display: block;
  min-height: clamp(230px, 34vw, 440px);
}

.s-block--bundle-hero-section img,
.s-block--bundle-hero-section picture {
  display: block;
  width: 100%;
}

.s-block--bundle-hero-section salla-button,
.s-block--bundle-hero-section .s-button-element {
  transition: transform var(--q-transition), background var(--q-transition), box-shadow var(--q-transition);
}

.s-block--bundle-hero-section salla-button:hover,
.s-block--bundle-hero-section .s-button-element:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(61, 31, 20, 0.2);
}

/* عناوين الأقسام */
.s-block > .s-block__title,
.s-block h2,
.s-block h1 {
  color: var(--q-primary-dark);
  letter-spacing: -0.02em;
}

.s-block[data-testid="store-home-fixed-products"] {
  margin-bottom: 56px;
}

.s-block[data-testid="store-home-fixed-products"] > .container,
.s-block:has(salla-products-list) > .container {
  width: min(100% - 32px, var(--q-container));
}

.s-block[data-testid="store-home-fixed-products"] .s-block__title,
.s-block:has(salla-products-list) .s-block__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.s-block[data-testid="store-home-fixed-products"] .s-block__title a,
.s-block:has(salla-products-list) .s-block__title a {
  color: var(--q-primary);
  font-weight: 700;
  text-decoration: none;
}

.s-block[data-testid="store-home-fixed-products"] .s-block__title a:hover,
.s-block:has(salla-products-list) .s-block__title a:hover {
  color: var(--q-accent-dark);
}

/* بطاقات المنتجات */
.s-products-list-wrapper,
.s-products-list-vertical-cards {
  gap: 20px !important;
}

.s-product-card-entry {
  position: relative;
  display: flex !important;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--q-border) !important;
  border-radius: var(--q-radius-md) !important;
  background: var(--q-surface) !important;
  box-shadow: var(--q-shadow-sm);
  transition: transform var(--q-transition), box-shadow var(--q-transition), border-color var(--q-transition);
}

.s-product-card-entry:hover {
  border-color: rgba(213, 154, 53, 0.75) !important;
  box-shadow: var(--q-shadow-md);
  transform: translateY(-5px);
}

.s-product-card-image {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 0.76;
  background: linear-gradient(135deg, #f9eee4, #fffdfb);
}

.s-product-card-image-cover {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  padding: 10px;
  transition: transform 360ms ease;
}

.s-product-card-entry:hover .s-product-card-image-cover {
  transform: scale(1.045);
}

.s-product-card-promotion-title {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--q-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.s-product-card-wishlist-btn {
  position: absolute !important;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 3;
  width: 36px !important;
  height: 36px !important;
  border: 1px solid var(--q-border) !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: var(--q-primary) !important;
  box-shadow: 0 3px 10px rgba(61, 31, 20, 0.1);
}

.s-product-card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.s-product-card-content-main {
  flex: 1;
}

.s-product-card-content-title {
  display: -webkit-box;
  min-height: 3.3em;
  overflow: hidden;
  color: var(--q-text) !important;
  font-size: 17px !important;
  font-weight: 800;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.s-product-card-content-title a {
  color: inherit;
  text-decoration: none;
}

.s-product-card-content-subtitle {
  color: var(--q-muted) !important;
  font-size: 14px;
}

.s-product-card-price {
  margin: 0;
  color: var(--q-primary) !important;
  font-size: 19px !important;
  font-weight: 900;
}

.s-product-card-price .sicon-sar {
  margin-inline-start: 3px;
  font-size: 13px;
}

.s-product-card-content-footer {
  margin-top: auto;
}

.s-product-card-content-footer .s-button-element,
.s-product-card-content-footer salla-button,
.s-product-card-content-footer button {
  width: 100%;
  min-height: 44px;
  border-radius: 10px !important;
  font-weight: 800;
  transition: transform var(--q-transition), background var(--q-transition), color var(--q-transition), border-color var(--q-transition);
}

.s-product-card-content-footer .s-button-element:hover,
.s-product-card-content-footer button:hover {
  background: var(--q-primary) !important;
  border-color: var(--q-primary) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

/* الأزرار العامة */
.s-button-primary,
.s-button-primary-outline,
button[type="submit"],
.s-button-btn {
  font-family: inherit;
  font-weight: 800;
}

.s-button-primary,
.s-button-primary-outline:hover,
button[type="submit"] {
  background-color: var(--q-primary) !important;
  border-color: var(--q-primary) !important;
  color: #fff !important;
}

.s-button-primary:hover,
button[type="submit"]:hover {
  background-color: var(--q-primary-dark) !important;
  border-color: var(--q-primary-dark) !important;
  transform: translateY(-1px);
}

/* الأسئلة الشائعة والميزات */
.s-block--bundle-faq-section,
.s-block--bundle-features-list,
.s-block--bundle-why-choose-us {
  margin-block: 48px;
}

.s-block--bundle-faq-section details,
.s-block--bundle-faq-section summary {
  border-color: var(--q-border) !important;
}

.s-block--bundle-faq-section details {
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--q-border);
  border-radius: var(--q-radius-sm);
  background: var(--q-surface);
  transition: box-shadow var(--q-transition), border-color var(--q-transition);
}

.s-block--bundle-faq-section details[open] {
  border-color: rgba(213, 154, 53, 0.75);
  box-shadow: var(--q-shadow-sm);
}

.s-block--bundle-faq-section summary {
  padding: 16px 18px;
  color: var(--q-primary-dark);
  cursor: pointer;
  font-weight: 800;
  list-style-position: inside;
}

.s-block--bundle-faq-section details > :not(summary) {
  padding: 0 18px 16px;
  color: var(--q-muted);
}

/* آراء العملاء */
.s-block--bundle-testimonials,
.s-block:has(salla-testimonials-list) {
  margin-block: 56px;
  padding-block: 42px;
  background: var(--q-primary-soft);
}

.s-block--bundle-testimonials .s-block__title,
.s-block:has(salla-testimonials-list) .s-block__title {
  text-align: center;
}

/* صفحة المنتج */
.product-page,
.s-product-page {
  color: var(--q-text);
}

.s-product-page .product-title,
.s-product-page h1 {
  color: var(--q-primary-dark);
  font-weight: 900;
  line-height: 1.45;
}

.s-product-page .product-price,
.s-product-page .price {
  color: var(--q-primary) !important;
  font-size: 24px;
  font-weight: 900;
}

.s-product-page .product-gallery,
.s-product-page .product-image {
  overflow: hidden;
  border: 1px solid var(--q-border);
  border-radius: var(--q-radius-lg);
  background: var(--q-surface);
}

.s-product-page .product-gallery img,
.s-product-page .product-image img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.s-product-page salla-add-product-button .s-button-element,
.s-product-page salla-add-product-button button,
.s-product-page salla-mini-checkout-widget button {
  min-height: 50px;
  border-radius: 12px !important;
  font-size: 16px;
  font-weight: 900;
}

/* التذييل */
footer,
.store-footer {
  margin-top: 56px;
  background: var(--q-primary-dark) !important;
  color: rgba(255, 255, 255, 0.86);
}

footer a,
.store-footer a {
  color: #fff !important;
  text-decoration: none;
  transition: color var(--q-transition), opacity var(--q-transition);
}

footer a:hover,
.store-footer a:hover {
  color: #f5c978 !important;
}

footer h3,
.store-footer h3 {
  color: #fff;
  font-weight: 800;
}

/* زر واتساب العائم */
[aria-label*="WhatsApp"],
[href*="wa.me"]:has(.sicon-whatsapp),
.salla-fixed-whatsapp {
  transition: transform var(--q-transition), box-shadow var(--q-transition);
}

[aria-label*="WhatsApp"]:hover,
[href*="wa.me"]:has(.sicon-whatsapp):hover,
.salla-fixed-whatsapp:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 22px rgba(37, 160, 78, 0.3);
}

/* تحسين الصور المحمّلة أدناه من دون إخفاء الصور */
.s-block:not(.s-block--bundle-hero-section) img {
  max-width: 100%;
}

/* الجوال */
@media (max-width: 767px) {
  .container,
  .s-block--bundle-hero-section,
  .s-block[data-testid="store-home-fixed-products"] > .container,
  .s-block:has(salla-products-list) > .container {
    width: min(100% - 20px, var(--q-container));
  }

  .store-header {
    position: relative;
  }

  .store-header .inner,
  .store-header > div {
    min-height: 62px;
  }

  .s-block--bundle-hero-section {
    margin: 12px auto 30px;
    border-radius: 16px;
  }

  .s-block--bundle-hero-section salla-hero-section-ps96by {
    min-height: 190px;
  }

  .s-block[data-testid="store-home-fixed-products"] .s-block__title,
  .s-block:has(salla-products-list) .s-block__title {
    align-items: flex-end;
    margin-bottom: 14px;
  }

  .s-block[data-testid="store-home-fixed-products"] .s-block__title h2,
  .s-block:has(salla-products-list) .s-block__title h2 {
    font-size: 21px;
  }

  .s-products-list-wrapper,
  .s-products-list-vertical-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .s-product-card-image {
    aspect-ratio: 0.72;
  }

  .s-product-card-content {
    gap: 7px;
    padding: 10px;
  }

  .s-product-card-content-title {
    min-height: 3.05em;
    font-size: 14px !important;
    line-height: 1.55;
  }

  .s-product-card-content-subtitle {
    font-size: 12px;
  }

  .s-product-card-price {
    font-size: 16px !important;
  }

  .s-product-card-promotion-title {
    top: 7px;
    inset-inline-start: 7px;
    padding: 2px 7px;
    font-size: 10px;
  }

  .s-product-card-wishlist-btn {
    top: 7px;
    inset-inline-end: 7px;
    width: 30px !important;
    height: 30px !important;
  }

  .s-product-card-content-footer .s-button-element,
  .s-product-card-content-footer salla-button,
  .s-product-card-content-footer button {
    min-height: 40px;
    padding-inline: 6px !important;
    font-size: 12px;
  }

  .s-block--bundle-faq-section,
  .s-block--bundle-features-list,
  .s-block--bundle-why-choose-us,
  .s-block--bundle-testimonials,
  .s-block:has(salla-testimonials-list) {
    margin-block: 30px;
    padding-block: 26px;
  }

  footer,
  .store-footer {
    margin-top: 32px;
  }
}

/* الشاشات الكبيرة */
@media (min-width: 1200px) {
  .s-products-list-vertical-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* تقليل الحركة لمن يفضّل ذلك */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Qarmasha — إصلاح خروج الفوتر عن الشاشة في الجوال */
@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  .store-footer,
  .store-footer__inner,
  .store-footer > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .store-footer__inner > .container,
  .store-footer__inner .container,
  .store-footer .grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
    padding-inline: 16px !important;
    gap: 24px !important;
  }

  .store-footer__inner > .container > *,
  .store-footer__inner .container > *,
  .store-footer .grid > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
  }

  .store-footer [class*="col-span"],
  .store-footer [class*="lg:col-span"] {
    grid-column: auto !important;
  }

  .store-footer .s-contacts-list,
  .store-footer .s-contacts-list-vertical,
  .store-footer .s-menu-footer-list {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .store-footer .s-contacts-item,
  .store-footer .s-menu-footer-item {
    display: flex !important;
    align-items: center;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .store-footer .s-contacts-item .unicode {
    direction: ltr;
    max-width: calc(100% - 44px);
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .store-footer .contact-social,
  .store-footer .s-social-list,
  .store-footer .s-payments-list {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 10px;
  }

  .store-footer .s-payments-list-item {
    flex: 0 0 auto !important;
    max-width: 58px;
  }

  .store-footer > .md\:flex,
  .store-footer .copyright-text {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-inline: 16px !important;
    text-align: center;
  }

  .store-footer p,
  .store-footer h3,
  .store-footer a,
  .store-footer span,
  .store-footer b {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

/* Qarmasha Pro hardening — يوضع في نهاية الملف لضمان أولوية الإصلاحات */
*,
*::before,
*::after {
  min-width: 0;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

@media (max-width: 767px) {
  .store-footer,
  .store-footer__inner,
  .store-footer__inner > .container,
  .store-footer__inner .container,
  .store-footer .grid,
  .store-footer .s-contacts,
  .store-footer salla-menu,
  .store-footer salla-contacts,
  .store-footer salla-social,
  .store-footer salla-payments,
  .store-footer salla-apps-icons {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: clip !important;
  }

  .store-footer__inner > .container {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .store-footer .s-contacts-list,
  .store-footer .s-social-list,
  .store-footer .s-payments-list {
    max-width: 100% !important;
    flex-wrap: wrap !important;
  }

  .store-footer .s-contacts-item,
  .store-footer a,
  .store-footer p,
  .store-footer span,
  .store-footer b {
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
    word-break: normal;
  }

  .store-footer .s-payments-list-item {
    max-width: 58px !important;
  }
}

/* Qarmasha Final — طبقة قائمة الجوال النهائية */
@media (max-width: 1024px) {
  custom-main-menu {
    display: block !important;
  }

  a[data-testid="store-header-mobile-toggle"] {
    position: relative !important;
    z-index: 10002 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    touch-action: manipulation;
  }

  a[data-testid="store-header-mobile-toggle"] i {
    display: block !important;
    width: auto !important;
    height: auto !important;
    pointer-events: none !important;
  }

  custom-main-menu #mobile-menu {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    z-index: 10000 !important;
    display: block !important;
    width: min(86vw, 360px) !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 76px 0 24px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: #fffaf4 !important;
    box-shadow: -12px 0 32px rgba(61, 31, 20, 0.18) !important;
    transform: translateX(110%) !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 240ms ease, opacity 180ms ease, visibility 240ms ease !important;
  }

  body.menu-opened custom-main-menu #mobile-menu,
  custom-main-menu #mobile-menu.mm-spn--opened,
  custom-main-menu #mobile-menu.q-menu-is-open {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  custom-main-menu #mobile-menu .main-menu {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 12px 18px 28px !important;
    background: transparent !important;
  }

  custom-main-menu #mobile-menu .main-menu li,
  custom-main-menu #mobile-menu .main-menu a {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  custom-main-menu #mobile-menu .main-menu a {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 12px 14px !important;
    border-bottom: 1px solid var(--q-border) !important;
    color: var(--q-primary-dark) !important;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none !important;
  }

  custom-main-menu #mobile-menu .main-menu a:hover,
  custom-main-menu #mobile-menu .main-menu a:focus-visible {
    background: var(--q-primary-soft) !important;
    color: var(--q-primary) !important;
  }

  custom-main-menu #mobile-menu .close-mobile-menu,
  custom-main-menu .btn--close-sm {
    position: fixed !important;
    top: 16px !important;
    right: 16px !important;
    z-index: 10003 !important;
    display: none !important;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    border: 1px solid var(--q-border) !important;
    border-radius: 50% !important;
    background: #fff !important;
    color: var(--q-primary) !important;
    cursor: pointer !important;
    pointer-events: auto !important;
  }

  body.menu-opened custom-main-menu #mobile-menu .close-mobile-menu,
  body.menu-opened custom-main-menu .btn--close-sm,
  custom-main-menu #mobile-menu.q-menu-is-open .close-mobile-menu {
    display: inline-flex !important;
  }

  body.menu-opened::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(38, 25, 21, 0.38);
    pointer-events: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  custom-main-menu #mobile-menu {
    transition: none !important;
  }
}
/* Qarmasha — التعديل النهائي لزر العودة إلى أعلى الصفحة في سلة */
[data-qarmasha-scroll-top] {
  position: fixed !important;
  left: max(12px, env(safe-area-inset-left, 0px)) !important;
  right: auto !important;
  bottom: max(18px, env(safe-area-inset-bottom, 0px)) !important;
  z-index: 9990 !important;
}

@media screen and (max-width: 767px) {
  [data-qarmasha-scroll-top] {
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: auto !important;
    bottom: max(14px, env(safe-area-inset-bottom, 0px)) !important;
    width: 42px !important;
    height: 42px !important;
  }
}