/*
Theme Name: متجر أبو ضحى - Aboduha Store
Theme URI: https://aboduha.com
Author: متجر أبو ضحى
Author URI: https://aboduha.com
Description: قالب ووردبريس ووكومرس احترافي متكامل لمتجر أبو ضحى (aboduha.com) مستوحى من أفضل متاجر التجارة الإلكترونية والدفع عند الاستلام (COD) مع دعم كامل للدرهم المغربي (MAD)، نموذج الطلب السريع بنقرة واحدة، وتكامل واتساب، وتصميم Mobile First متجاوب بالكامل.
Version: 1.1.1
Tested up to: 6.7
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: aboduha
Domain Path: /languages
Tags: e-commerce, custom-background, custom-logo, custom-menu, featured-images, rtl-language-support, translation-ready, woocommerce
*/

/* Reset & Base Variables */
:root {
  color-scheme: only light;
  supported-color-schemes: light;
  --aboduha-primary: #059669;
  --aboduha-primary-hover: #047857;
  --aboduha-primary-light: #ecfdf5;
  --aboduha-secondary: #f59e0b;
  --aboduha-secondary-hover: #d97706;
  --aboduha-accent: #e11d48;
  --aboduha-dark: #0f172a;
  --aboduha-gray-dark: #334155;
  --aboduha-gray-light: #f8fafc;
  --aboduha-border: #e2e8f0;
  --aboduha-whatsapp: #25d366;
  --aboduha-font: 'Cairo', system-ui, -apple-system, sans-serif;
  --aboduha-radius: 12px;
  --aboduha-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

body {
  font-family: var(--aboduha-font);
  direction: rtl;
  text-align: right;
  background-color: #ffffff !important;
  color: var(--aboduha-dark);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* منع متصفحات الهاتف من تحويل صفحات المتجر إلى الوضع الداكن تلقائياً. */
html,
body,
#page,
.site-main {
  background-color: #ffffff !important;
}

/* صفحة الدفع تستخدم تخطيطها الخاص بلا غلاف متداخل؛ السلة تحتفظ بإطار الصفحة. */
.aboduha-commerce-page {
  width: 100%;
  min-width: 0;
  background: #ffffff;
}

/* غلاف مستقل للسلة: واسع على الحاسوب وآمن من الخروج على الهاتف. */
.aboduha-cart-page-shell,
.aboduha-cart-page-content,
.aboduha-cart-page-content .wp-block-woocommerce-cart,
.aboduha-cart-page-content .wc-block-cart {
  width: 100%;
  min-width: 0;
}

.aboduha-cart-page-content .wp-block-woocommerce-cart {
  max-width: none !important;
  margin-inline: 0 !important;
}

body.woocommerce-cart .aboduha-cart-page-shell {
  border: 2px solid #6ee7b7 !important;
  box-shadow: 0 12px 34px rgba(5, 150, 105, 0.08);
}

/* لون أيقونة واتساب الرسمية في شريط الهاتف السفلي. */
.aboduha-mobile-whatsapp,
.aboduha-mobile-whatsapp:visited,
.aboduha-mobile-whatsapp:hover {
  color: #16a34a !important;
}

.aboduha-mobile-whatsapp svg,
.aboduha-mobile-whatsapp svg path {
  fill: #16a34a !important;
  color: #16a34a !important;
}

/* البحث في الهاتف يأخذ المساحة المتبقية تلقائياً بجانب الشعار والأزرار. */
@media (max-width: 639px) {
  .site-header .header-main-row {
    width: 100%;
    min-width: 0;
    gap: 6px !important;
  }

  .site-header .site-branding {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 28%;
    overflow: hidden;
  }

  .site-header .aboduha-custom-logo,
  .site-header .custom-logo-link {
    display: block;
    width: auto;
    max-width: 88px;
    min-width: 0;
  }

  .site-header .custom-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: 40px;
    object-fit: contain;
  }

  .site-header .header-search {
    flex: 1 1 96px;
    width: auto;
    min-width: 72px;
    max-width: none;
    margin-inline: 0 !important;
  }

  .site-header .header-search form,
  .site-header .header-search form > div,
  .site-header .header-search input[type="search"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .site-header .header-search input[type="search"] {
    padding-inline-start: 10px !important;
    padding-inline-end: 32px !important;
    text-overflow: ellipsis;
  }

  .site-header .header-actions {
    flex: 0 0 auto;
    gap: 2px !important;
  }
}

/* شريط النتائج والترتيب: ارتفاع مضغوط وواضح على الهاتف. */
.aboduha-shop-toolbar .woocommerce-result-count,
.aboduha-shop-toolbar .woocommerce-ordering {
  margin: 0 !important;
}

.aboduha-shop-toolbar .woocommerce-ordering select {
  display: block;
  width: auto;
  min-width: 210px;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  border: 1px solid var(--aboduha-border) !important;
  border-radius: 10px !important;
  background-color: #fff !important;
  color: var(--aboduha-dark) !important;
  line-height: 1.25 !important;
}

@media (max-width: 639px) {
  .aboduha-shop-toolbar {
    padding: 10px 12px !important;
    gap: 8px !important;
  }

  .aboduha-shop-toolbar .woocommerce-result-count {
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  .aboduha-shop-toolbar .woocommerce-ordering,
  .aboduha-shop-toolbar .woocommerce-ordering select {
    width: 100% !important;
  }
}

/* Base Styles */
a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* WooCommerce Compatibility Tweaks */
.woocommerce-Price-currencySymbol {
  margin-right: 4px;
}

/* النص داخل أي زر أخضر متوسط أو داكن يبقى أبيض دائماً. */
a.bg-emerald-500,
a.bg-emerald-600,
a.bg-emerald-700,
a.bg-emerald-800,
a.bg-emerald-900,
button.bg-emerald-500,
button.bg-emerald-600,
button.bg-emerald-700,
button.bg-emerald-800,
button.bg-emerald-900,
input[type="submit"].bg-emerald-500,
input[type="submit"].bg-emerald-600,
input[type="submit"].bg-emerald-700,
input[type="submit"].bg-emerald-800,
input[type="submit"].bg-emerald-900 {
  color: #ffffff !important;
}

/* هوية المتجر: أبيض وأسود وأخضر، مع دعوات إجراء واضحة. */
.product-card {
  border-color: #a7f3d0 !important;
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.08);
}

.product-card:hover {
  border-color: var(--aboduha-primary) !important;
  box-shadow: 0 14px 30px rgba(5, 150, 105, 0.16);
}

.cart-page-wrapper > .grid .bg-white,
.checkout-page-wrapper form.checkout > .grid > div {
  border-color: #a7f3d0 !important;
  border-top: 4px solid #059669 !important;
  box-shadow: 0 10px 28px rgba(5, 150, 105, 0.1);
}

.checkout-page-wrapper form.checkout > .grid > div > h2 {
  background: #ecfdf5;
  border-color: #a7f3d0 !important;
  border-radius: 12px;
  color: #064e3b !important;
  padding: 12px !important;
}

/* عند امتلاء السلة يبقى الإطار الأخضر خارجياً فقط بلا إطارات داخلية. */
.wp-block-woocommerce-cart .wc-block-cart-items,
.wp-block-woocommerce-cart .wc-block-components-sidebar,
.wc-block-cart .wc-block-cart-items,
.wc-block-cart .wc-block-components-sidebar {
  background: #ffffff;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible;
  box-shadow: none !important;
}

/* نصوص السلة الممتلئة تبقى صغيرة ومرتبة داخل مساحة المنتج دون تداخل. */
body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-cart-items__row,
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row {
  font-size: 12px;
  line-height: 1.55;
}

body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-cart-item__product,
body.woocommerce-cart .wc-block-cart .wc-block-cart-item__product,
body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-components-product-metadata,
body.woocommerce-cart .wc-block-cart .wc-block-components-product-metadata {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-components-product-name,
body.woocommerce-cart .wc-block-cart .wc-block-components-product-name {
  display: block;
  max-width: 100%;
  margin-bottom: 3px;
  color: #0f172a;
  font-size: 13px !important;
  font-weight: 700;
  line-height: 1.45 !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-components-product-metadata,
body.woocommerce-cart .wc-block-cart .wc-block-components-product-metadata,
body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-components-product-metadata__description,
body.woocommerce-cart .wc-block-cart .wc-block-components-product-metadata__description {
  color: #475569;
  font-size: 10.5px !important;
  line-height: 1.55 !important;
}

body.woocommerce-cart .wc-block-components-product-metadata__description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.woocommerce-cart .wc-block-components-quantity-selector,
body.woocommerce-cart .wc-block-cart-item__prices,
body.woocommerce-cart .wc-block-cart-item__total {
  font-size: 11px !important;
}

@media (max-width: 767px) {
  body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-components-product-name,
  body.woocommerce-cart .wc-block-cart .wc-block-components-product-name {
    font-size: 12px !important;
  }

  body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-components-product-metadata,
  body.woocommerce-cart .wc-block-cart .wc-block-components-product-metadata,
  body.woocommerce-cart .wc-block-components-product-metadata__description {
    font-size: 10px !important;
  }
}

.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button,
.woocommerce-checkout #place_order,
.checkout-button,
.return-to-shop .button {
  background: #059669 !important;
  border: 1px solid #047857 !important;
  border-radius: 14px !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  box-shadow: 0 10px 24px rgba(5, 150, 105, 0.24) !important;
}

.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover,
.woocommerce-checkout #place_order:hover,
.checkout-button:hover,
.return-to-shop .button:hover {
  background: #047857 !important;
}

/* السلة الفارغة واقتراحات المنتجات في WooCommerce Blocks. */
.wp-block-woocommerce-empty-cart-block {
  border: 2px solid #a7f3d0;
  border-top: 8px solid #059669;
  border-radius: 24px;
  padding: clamp(24px, 5vw, 52px) !important;
  background: linear-gradient(145deg, #ffffff 55%, #ecfdf5 100%);
  box-shadow: 0 14px 36px rgba(5, 150, 105, 0.12);
}

.wp-block-woocommerce-empty-cart-block > .wp-block-heading:first-child {
  color: #020617;
  font-weight: 900;
}

.wp-block-woocommerce-empty-cart-block .wc-block-grid__product,
.wp-block-woocommerce-empty-cart-block li.wc-block-product,
.wp-block-woocommerce-empty-cart-block .wp-block-post {
  background: #ffffff;
  border: 1px solid #a7f3d0;
  border-radius: 16px;
  padding: 10px !important;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.wp-block-woocommerce-empty-cart-block .wc-block-grid__product:hover,
.wp-block-woocommerce-empty-cart-block li.wc-block-product:hover,
.wp-block-woocommerce-empty-cart-block .wp-block-post:hover {
  transform: translateY(-3px);
  border-color: #059669;
  box-shadow: 0 12px 26px rgba(5, 150, 105, 0.16);
}

.wp-block-woocommerce-empty-cart-block .wp-block-button__link,
.wp-block-woocommerce-empty-cart-block .wc-block-components-product-button__button,
.wp-block-woocommerce-empty-cart-block .add_to_cart_button {
  background: #059669 !important;
  color: #ffffff !important;
  border-radius: 12px !important;
  border: 0 !important;
  font-weight: 800 !important;
}

@media (max-width: 767px) {
  .wp-block-woocommerce-empty-cart-block {
    padding: 22px 12px !important;
    border-radius: 18px;
  }

  .wp-block-woocommerce-cart .wc-block-components-sidebar,
  .wc-block-cart .wc-block-components-sidebar {
    margin-top: 16px;
  }
}

/* Strict 2-column layout on mobile devices (screens < 768px) */
@media (max-width: 767px) {
  .products-grid,
  .homepage-products-grid,
  .woocommerce ul.products,
  .woocommerce-page ul.products,
  ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.625rem !important; /* 10px spacing prevents card overlap */
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
  }

  .woocommerce ul.products li.product,
  .woocommerce-page ul.products li.product {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .product-card {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
}

/* Equal height and clean spacing for product cards across all screen sizes */
.product-card {
  min-width: 0; /* Prevents flexbox/grid blowouts */
  word-break: break-word;
}

.product-card h3,
.product-card h4 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.35;
}

/* التجاوب التلقائي التام مع جميع مقاسات الهواتف والشاشات (Auto Fit on Any Mobile Width) */
html, body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* إلغاء خاصية التثبيت (Sticky) لمعرض الصور في شاشات الموبايل لمنع تدفق الصفحة واستمارة الطلب تحت الصور */
@media (max-width: 1023px) {
  .single-product-gallery,
  .site-main .sticky,
  .w-full.lg\:col-span-5.sticky,
  .w-full.lg\:col-span-5.top-24 {
    position: relative !important;
    top: auto !important;
    z-index: 10 !important;
  }
}



/* v1.1.1: mobile shop archive layout: direct product grid, no nested Woo loop */
@media (max-width: 767px) {
 body.woocommerce-shop .products-grid, body.tax-product_cat .products-grid, body.tax-product_tag .products-grid, .woocommerce .products-grid {
  display:grid !important; grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  width:100% !important; max-width:none !important; min-width:0 !important;
  gap:10px !important; margin:0 !important; padding:0 !important; float:none !important; clear:both !important;
 }
 .woocommerce .products-grid > .product-card, .products-grid > .product-card {
  width:100% !important; max-width:none !important; min-width:0 !important;
  margin:0 !important; float:none !important; box-sizing:border-box !important;
 }
 .products-grid .product-card > div:last-child > div {
  display:grid !important; grid-template-columns:minmax(0,1fr) 34px 34px !important;
  gap:4px !important; width:100% !important; align-items:center !important;
 }
 .products-grid .product-card > div:last-child > div > a:first-child {
  min-width:0 !important; width:100% !important; padding:8px 2px !important;
  font-size:10px !important; white-space:nowrap !important; overflow:hidden !important;
 }
 .products-grid .product-card > div:last-child > div > button,
 .products-grid .product-card > div:last-child > div > a:not(:first-child) {
  width:34px !important; height:34px !important; min-width:0 !important;
 }
}
