/* ============================================================
   Sham Retail Storefront - Clean Unified Theme (POS Blue Palette)
============================================================ */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --sr-bg: #f8fafc;
  --sr-card-bg: #ffffff;
  --sr-border: #cbd5e1;
  --sr-border-subtle: #e2e8f0;
  --sr-text-main: #0f172a;
  --sr-text-muted: #475569;
  --sr-primary: #2563eb;
  --sr-primary-hover: #1d4ed8;
  --sr-success: #059669;
  --sr-radius: 12px;
  --sr-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

html, body {
  margin: 0;
  padding: 0;
  direction: rtl;
  color: var(--sr-text-main);
  background: var(--sr-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* 1. الهيدر المتناسق */
.store-header {
  background: var(--sr-card-bg);
  border-bottom: 1.5px solid var(--sr-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--sr-shadow);
}

.store-header-inner {
  max-width: 1250px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.store-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.store-logo-icon {
  font-size: 24px;
  background: #eff6ff;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1.5px solid #bfdbfe;
}
.store-titles h1 {
  font-size: 19px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}
.store-sub {
  color: var(--sr-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.store-search-box {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--sr-border);
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 0.2s;
}
.store-search-box:focus-within {
  border-color: var(--sr-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.store-search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
}

/* 2. التوزيع الأساسي للمحتوى */
.store-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  max-width: 1250px;
  margin: 20px auto 50px;
  padding: 0 20px;
  align-items: start;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 12px;
}
.section-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}
.btn-filter-all {
  background: #ffffff;
  border: 1.5px solid var(--sr-border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sr-text-muted);
  transition: all 0.2s;
}
.btn-filter-all.active, .btn-filter-all:hover {
  background: var(--sr-primary);
  border-color: var(--sr-primary);
  color: #ffffff;
}

/* 3. شبكة الأقسام (مستطيلة مطابقة للباك إند تماماً بدون دوائر) */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
  margin-bottom: 25px;
}

.category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px;
  min-height: 145px;
  border: 1.5px solid var(--sr-border);
  border-radius: 10px;
  background: var(--sr-card-bg);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
  text-align: center;
}
.category-tile:hover {
  border-color: var(--sr-primary);
  background: #eff6ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.12);
}
.category-tile.is-active {
  border-color: var(--sr-primary);
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px var(--sr-primary);
}

.category-tile-image {
  width: 100%;
  height: 85px;
  border-radius: 0% !important; /* إلغاء الدوائر نهائياً */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid var(--sr-border-subtle);
  margin-bottom: 6px;
}
.category-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.category-mark {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  font-size: 32px;
  font-weight: 900;
  color: var(--sr-primary);
  background: #dbeafe;
}
.category-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  color: #0f172a;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 34px;
}
.category-count {
  font-size: 11px;
  color: var(--sr-text-muted);
  font-weight: 600;
}

/* 4. شبكة المنتجات (مستطيلة متناسقة) */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--sr-card-bg);
  border: 1.5px solid var(--sr-border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
  transition: transform 0.2s, box-shadow 0.2s;
}
.product-card:hover {
  border-color: var(--sr-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.1);
}

.product-photo {
  width: 100%;
  height: 100px;
  border-radius: 0% !important; /* مستطيل ناصع */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid var(--sr-border-subtle);
  margin-bottom: 6px;
}
.product-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-placeholder {
  font-size: 32px;
  color: #94a3b8;
  font-weight: 800;
}

.product-card h3 {
  font-size: 13px;
  font-weight: 800;
  margin: 4px 0 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 34px;
  color: #0f172a;
  text-align: center;
}

.product-pricing-wrap {
  text-align: center;
  margin: 4px 0 8px;
}
.product-price {
  color: var(--sr-primary);
  font-size: 15px;
  font-weight: 900;
  font-family: monospace;
}
.product-unit {
  font-size: 10.5px;
  color: var(--sr-text-muted);
  font-weight: 600;
}

.add-product {
  width: 100%;
  background: var(--sr-primary) !important;
  color: #ffffff !important;
  border: 0;
  border-radius: 6px;
  padding: 8px 4px;
  font-weight: 800;
  font-size: 12.5px;
  transition: background 0.15s;
}
.add-product:hover {
  background: var(--sr-primary-hover) !important;
}

/* 5. سلة المشتريات */
.cart-sidebar {
  background: var(--sr-card-bg);
  border: 1.5px solid var(--sr-border);
  border-radius: 12px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sr-shadow);
}
.cart-heading {
  background: #f8fafc;
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--sr-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cart-title-wrap {
  font-weight: 800;
  font-size: 15px;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-count-badge {
  background: #dbeafe;
  color: var(--sr-primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.cart-total-price {
  font-size: 15px;
  font-weight: 900;
  font-family: monospace;
  color: var(--sr-primary);
}
.mobile-only-close { display: none; }

.cart-content { overflow-y: auto; padding: 14px; flex: 1; }
.cart-empty { text-align: center; color: var(--sr-text-muted); font-size: 13px; padding: 25px 0; font-weight: 600; }
.cart-item-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f1f5f9; padding: 8px 0; gap: 8px; }
.cart-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 4px; }
.cart-thumb-placeholder { width: 38px; height: 38px; background: #eff6ff; color: var(--sr-primary); display: grid; place-items: center; font-weight: 800; border-radius: 4px; }
.cart-item-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cart-item-name { font-size: 12.5px; color: #0f172a; font-weight: 700; }
.cart-item-unit-price { font-size: 11px; color: var(--sr-text-muted); }
.cart-qty-controls { display: flex; align-items: center; gap: 5px; margin-top: 3px; }
.btn-qty { width: 24px; height: 24px; border: 1px solid var(--sr-border); background: #f8fafc; border-radius: 4px; font-weight: 800; }
.btn-remove { width: 24px; height: 24px; border: none; background: #fee2e2; color: #dc2626; border-radius: 4px; font-weight: 800; }
.qty-num { font-size: 11.5px; font-weight: 800; min-width: 18px; text-align: center; }
.cart-item-total { font-weight: 800; font-family: monospace; font-size: 13px; color: var(--sr-primary); }

.customer-order-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; border-top: 1.5px dashed var(--sr-border); padding-top: 14px; }
.customer-order-form label { font-size: 12px; font-weight: 700; color: #1e293b; display: block; }
.customer-order-form input, .customer-order-form textarea {
  width: 100%;
  border: 1.5px solid var(--sr-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  margin-top: 4px;
}
.customer-order-form input:focus, .customer-order-form textarea:focus {
  border-color: var(--sr-primary);
  outline: none;
}
.fulfillment-box, .payment-box {
  border: 1.5px solid var(--sr-border);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0;
  display: flex;
  gap: 14px;
}
.fulfillment-box legend, .payment-box legend { font-size: 11px; font-weight: 700; color: var(--sr-text-muted); padding: 0 4px; }
.btn-submit-order {
  background: #25d366;
  color: #fff;
  border: 0;
  padding: 12px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.25);
}

/* 6. زر الواتساب العائم في زاوية الشاشة */
.sr-whatsapp-float {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 54px;
  height: 54px;
  background-color: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.4);
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
}
.sr-whatsapp-float:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.5);
}

/* ❌ إخفاء شريط السلة للجوال نهائياً عن شاشات الكمبيوتر ❌ */
.mobile-floating-bar {
  display: none !important;
}

/* إشعار الإضافة المنبثق السريع */
.cart-toast[hidden] {
  display: none !important;
}

.cart-toast {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(6px);
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999999;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 250px;
  max-width: 90vw;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.cart-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.cart-toast img, 
.cart-toast .toast-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ============================================================
   📱 تخصيص الجوال (Mobile)
============================================================ */
@media (max-width: 900px) {
  body {
    padding-bottom: 75px;
  }

  .store-header-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 14px;
    gap: 10px;
  }
  .store-search-box {
    max-width: 100%;
  }

  .store-layout {
    display: block !important;
    padding: 0 12px !important;
    margin: 10px auto 30px !important;
  }

  /* شبكة الأقسام على الجوال */
  .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .category-tile {
    min-height: 125px;
    padding: 6px;
  }
  .category-tile-image {
    height: 70px;
  }

  /* المنتجات: عمودين متناسقين دائماً على الجوال */
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .product-card {
    padding: 8px !important;
  }
  .product-photo {
    height: 95px !important;
  }

  /* السلة السفلية المنبثقة للجوال */
  .cart-sidebar {
    position: fixed !important;
    bottom: -130% !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 85vh !important;
    border-radius: 20px 20px 0 0 !important;
    border: none !important;
    box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.35) !important;
    z-index: 999999 !important;
    transition: bottom 0.35s cubic-bezier(0.33, 1, 0.68, 1) !important;
  }
  .cart-sidebar.is-mobile-open {
    bottom: 0 !important;
  }
  .mobile-only-close {
    display: grid !important;
    place-items: center;
    background: #f1f5f9;
    border: 0;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 15px;
    font-weight: 800;
    color: #475569;
  }

  /* إظهار الشريط العائم للجوال فقط */
  .mobile-floating-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px !important;
    background: #0f172a !important;
    color: #ffffff !important;
    padding: 0 16px !important;
    justify-content: space-between !important;
    align-items: center !important;
    z-index: 99999 !important;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.2) !important;
  }
  .floating-cart-info { display: flex; align-items: center; gap: 8px; }
  .floating-cart-info .badge {
    background: var(--sr-primary);
    color: #ffffff;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 13px;
  }
  .floating-total-box { display: flex; flex-direction: column; }
  .floating-label { font-size: 10.5px; color: #94a3b8; }
  .floating-cart-btn {
    background: var(--sr-primary);
    color: #ffffff;
    border: 0;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13.5px;
  }

  .sr-whatsapp-float {
    bottom: 74px; /* رفعه قليلاً ليكون فوق الشريط السفلي */
    left: 16px;
    width: 48px;
    height: 48px;
  }
}
.products-section {
  scroll-margin-top: 80px; /* مسافة أمان تساوي ارتفاع الهيدر */
}