/* ==========================================================================
   سنابل الخير — طبقة التصميم (بتتحمّل بعد app.css)
   كل تعديلات الشكل والحركة هنا. لو عايز ترجع للتصميم الأصلي: شيل سطر design.css من index.html.
   مفيش هنا أي حاجة بتخص السلة أو الطلبات.
   ========================================================================== */

:root {
  --bg: #f4f6f4;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --card-line: #e5ebe7;
}

/* ---------- الصفحة الرئيسية وصفحة القسم ---------- */
.site[data-view="home"] [data-list-only],
.site[data-view="list"] [data-home-only] { display: none !important; }
.site[data-view="list"] .cat-strip { transform: none; opacity: 1; pointer-events: auto; height: auto; overflow: visible; }
.back-home { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--green); font-weight: 800; font-size: 0.85rem; }
.site[data-view="list"] .controls-bar { padding-top: 14px; }

/* ---------- الهيدر ---------- */
.app-header { background: linear-gradient(180deg, #11502f, #0b3d25); }
.header-inner { padding-block: 8px 4px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.head-icon { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.1); color: #fff; transition: transform 0.2s var(--ease), background 0.2s; }
.head-icon:active { transform: scale(0.92); }
.head-icon .icon { width: 20px; height: 20px; }
.head-badge { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--gold); color: var(--ink); font-size: 0.7rem; font-weight: 800; line-height: 18px; text-align: center; }
.branch-chip { min-height: 40px; }
.header-search { padding-bottom: 8px; }
.search-input { min-height: 44px; }

/* ---------- البانرات والفرع ---------- */
.hero-wrap { padding-top: 12px; }
.hero-slider { position: relative; border-radius: var(--r-l); overflow: hidden; box-shadow: var(--shadow-s); background: var(--green-soft); }
.hero-rail { margin-top: 0; gap: 0; }
.hero-slide { flex: 0 0 100%; border-radius: 0; }
.hero-slide img { aspect-ratio: 1280 / 560; width: 100%; height: auto; object-fit: cover; }
.hero-dots { position: absolute; inset-inline: 0; bottom: 8px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.hero-dot { width: 7px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.65); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15); transition: width 0.3s var(--ease), background 0.3s; }
.hero-dot.is-on { width: 20px; background: #fff; }
.branch-strip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px 12px; background: #fff; border: 1px solid var(--card-line); border-radius: var(--r-m); }
.branch-strip h1 { font-size: 1.05rem; font-weight: 800; line-height: 1.3; }
.branch-strip-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.8rem; color: var(--muted); }
.branch-strip-line .footer-state.is-open { color: var(--green); font-weight: 700; }
.branch-strip-line .status-dot { margin-inline-end: 4px; }
.dot-sep { opacity: 0.5; }
.branch-strip-actions { display: flex; gap: 6px; flex: none; }
.branch-strip-actions .btn { min-height: 38px; padding: 0 12px; box-shadow: none; }

/* ---------- الأقسام: صف بالسحب ---------- */
.section { padding-top: 22px; }
.section-title { font-size: 1.12rem; }
.section-title::before { width: 5px; height: 1em; }
.more-link { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 2px; border: 0; background: none; color: var(--green); font-weight: 800; font-size: 0.85rem; }
.more-link span { font-size: 1.2rem; line-height: 1; transition: transform 0.2s var(--ease); }
.more-link:hover span { transform: translateX(-3px); }
.cat-tiles { display: flex; flex-wrap: nowrap; gap: 10px; padding-top: 30px; padding-bottom: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cat-tiles::-webkit-scrollbar { display: none; }
.cat-tiles .cat-tile { flex: 0 0 96px; padding: 0 3px 7px; font-size: 0.72rem; line-height: 1.3; border-radius: 14px; scroll-snap-align: start; transition: transform 0.45s var(--ease), opacity 0.45s ease, box-shadow 0.25s, border-color 0.2s; }
.cat-tile:active { transform: scale(0.95); }
@media (hover: hover) { .cat-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-m); } }
.rail { gap: 8px; padding: 8px 2px 14px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-item { flex: 0 0 122px; }
.offer-card { flex: 0 0 min(52vw, 210px); transition: transform 0.45s var(--ease), opacity 0.45s ease, box-shadow 0.25s; }
@media (hover: hover) { .offer-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-m); } }
.reorder-banner { margin-top: 14px; }

/* ---------- كروت المنتجات: صغيرة ونضيفة ---------- */
.products-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.product-card { border-radius: 12px; border-color: var(--card-line); background: #fff; transition: none; }
.product-media { background: #fff; }
.product-media.is-category { background: var(--tint, #f6f8f6); }
.product-media:not(.is-category) .media-open img { object-fit: contain; padding: 9%; filter: none; }
.product-media.is-category .media-open img { padding: 16%; }
.product-badges { top: 5px; inset-inline-start: 5px; gap: 3px; }
.badge { padding: 1px 6px; border-radius: 5px; font-size: 0.62rem; line-height: 1.5; }
.fav-btn { top: 4px; inset-inline-end: 4px; width: 28px; height: 28px; box-shadow: 0 1px 3px rgba(15, 42, 29, 0.15); }
.fav-btn .icon { width: 15px; height: 15px; }
.card-add { position: absolute; bottom: 6px; inset-inline-end: 6px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--green); color: #fff; font-size: 1.35rem; font-weight: 700; line-height: 1; display: grid; place-items: center; box-shadow: 0 3px 8px rgba(11, 61, 37, 0.35); transition: transform 0.2s var(--ease), background 0.2s; }
.card-add::after { content: ""; position: absolute; inset: -6px; }
.card-add:active { transform: scale(0.88); }
.qty-quick { position: absolute; bottom: 6px; inset-inline-end: 6px; width: auto; min-height: 30px; border-radius: 999px; box-shadow: 0 3px 8px rgba(11, 61, 37, 0.35); }
.qty-quick .qty-btn { width: 30px; min-height: 30px; font-size: 1.15rem; }
.qty-quick .qty-val { min-width: 18px; font-size: 0.85rem; }
.product-info { padding: 6px 7px 8px; gap: 3px; }
.product-name { font-size: 0.78rem; line-height: 1.3; min-height: 2.6em; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-unit { font-size: 0.68rem; line-height: 1.3; }
.product-note { display: none; }
.shelf { padding: 0; border: 0; background: transparent; border-radius: 0; gap: 0 6px; align-items: baseline; }
.shelf .price { font-size: 1rem; }
.shelf .price small { font-size: 0.62rem; }
.shelf .old-price { font-size: 0.72rem; }
.shelf .price--ask { font-size: 0.72rem; }
.shelf.is-offer { background: transparent; border: 0; }
.shelf.is-offer::after { display: none; }
.card-action { width: 100%; min-height: 30px; padding: 0 6px; font-size: 0.72rem; border-radius: 8px; box-shadow: none; }
.soldout-chip { padding: 4px 8px; font-size: 0.72rem; border-radius: 8px; }

/* ---------- الزر الجانبي (مساعدة) وشريط السلة ---------- */
.help-tab { inset-inline-end: auto; inset-inline-start: auto; left: 0; right: auto; top: 46%; bottom: auto; flex-direction: column; gap: 6px; min-height: 0; width: 34px; padding: 10px 0; border-radius: 0 14px 14px 0; background: #1f9d55; box-shadow: 2px 4px 14px rgba(11, 61, 37, 0.3); transition: width 0.2s var(--ease), background 0.2s; }
.help-tab .icon { width: 16px; height: 16px; }
.help-tab:hover { width: 38px; background: #178347; }
.help-tab-text { display: block; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 0.74rem; letter-spacing: 0; }
@media (max-width: 639px) { .help-tab { width: 31px; padding: 8px 0; } .help-tab .icon { width: 15px; height: 15px; } .help-tab-text { display: block; font-size: 0.7rem; } }
.to-top { bottom: 84px; }
.cart-bar-btn { min-height: 54px; border-radius: 16px; background: linear-gradient(180deg, #16603a, #0f4a2e); box-shadow: 0 10px 26px rgba(8, 40, 24, 0.38); transition: transform 0.2s var(--ease); }
.cart-bar-btn:active { transform: scale(0.98); }
.cart-bar:not([hidden]) .cart-bar-btn { animation: bar-up 0.4s var(--ease) both; }
@keyframes bar-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- رسالة التثبيت: شريط في الأعلى ---------- */
.install-card { position: relative; inset: auto; z-index: 2; display: block; max-width: none; margin: 0; padding: 0; border-radius: 0; box-shadow: none; background: linear-gradient(90deg, #0b3d25, #1f7f4b); color: #fff; overflow: hidden; max-height: 160px; transition: max-height 0.3s ease, opacity 0.3s ease; animation: install-in 0.5s var(--ease) both; }
.install-card.is-leaving { max-height: 0; opacity: 0; }
@keyframes install-in { from { max-height: 0; opacity: 0; } to { max-height: 160px; opacity: 1; } }
.install-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 1180px; margin-inline: auto; padding: 8px var(--gutter); }
.install-card img { width: 40px; height: 40px; border-radius: 10px; padding: 2px; }
.install-text { flex: 1; min-width: 0; }
.install-text strong { font-size: 0.92rem; }
.install-card p { font-size: 0.76rem; line-height: 1.4; color: #d5e8dc; }
.install-actions { display: flex; align-items: center; gap: 6px; }
.install-actions .btn { min-height: 34px; padding: 0 14px; box-shadow: none; }
.install-close { width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 0.9rem; }
.install-steps { flex-basis: 100%; font-size: 0.78rem; color: #fff; }

/* ---------- النافذة المنبثقة للمنتج: الصور الحقيقية بدون قص ---------- */
.modal-product-media:not(.is-category) { background: #fff; border: 1px solid var(--card-line); }
.modal-product-media:not(.is-category) img { object-fit: contain; padding: 4%; }

/* ---------- ظهور الكروت بنعومة مع السكرول ---------- */
.has-reveal .section-head:not(.is-in) { opacity: 0; transform: translateY(14px); }
.has-reveal .cat-tile:not(.is-in), .has-reveal .offer-card:not(.is-in) { opacity: 0; transform: translateY(18px); }
.has-reveal .branch-strip:not(.is-in), .has-reveal .reorder-banner:not(.is-in) { opacity: 0; transform: translateY(14px); }
.section-head, .branch-strip, .reorder-banner { transition: transform 0.55s var(--ease), opacity 0.5s ease; }
.rv-instant { transition: none !important; }

/* ---------- شاشة اختيار الفرع ---------- */
.branch-page { position: relative; overflow: hidden; background: radial-gradient(60% 40% at 88% 4%, rgba(255, 205, 40, 0.38), rgba(255, 205, 40, 0) 70%), linear-gradient(170deg, #1f7f4b, #145a35 52%, #0b3d25); }
.branch-decor { position: absolute; top: -34vmax; inset-inline-end: -30vmax; width: 84vmax; height: 84vmax; border-radius: 50%; background: radial-gradient(circle, rgba(255, 205, 40, 0.28), rgba(255, 205, 40, 0) 62%); pointer-events: none; }
.branch-brand, .branch-main, .branch-footer { position: relative; z-index: 1; }
.branch-logo-wrap { width: 96px; height: 96px; padding: 6px; border-radius: 24px; box-shadow: 0 0 0 3px var(--gold), 0 12px 30px rgba(0, 0, 0, 0.35); }
.store-title { font-size: 1.9rem; font-weight: 800; line-height: 1.2; color: #ffd84a; text-shadow: 0 3px 0 rgba(8, 40, 24, 0.45); }
.store-tagline { color: #e6f2ea; font-size: 0.95rem; }
.branch-heading h2 { font-size: 1.5rem; }
.branch-card { border-radius: 22px; box-shadow: 0 0 0 3px var(--gold), 0 14px 34px rgba(0, 0, 0, 0.3); transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease); }
.branch-card:active { transform: scale(0.985); }
.branch-card:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }
.branch-cover img { transition: transform 0.8s var(--ease); }
.branch-cta { background: var(--gold); color: var(--ink); box-shadow: 0 4px 0 #8c6a0d; transition: transform 0.2s var(--ease), gap 0.2s; }
.branch-cta .icon { transition: transform 0.25s var(--ease); }
@media (hover: hover) {
  .branch-card:hover { transform: translateY(-6px); box-shadow: 0 0 0 3px var(--gold), 0 24px 44px rgba(0, 0, 0, 0.36); }
  .branch-card:hover .branch-cover img { transform: scale(1.05); }
  .branch-card:hover .branch-cta .icon { transform: translateX(-4px); }
}
@media (prefers-reduced-motion: no-preference) {
  .branch-logo-wrap { animation: drop-in 0.8s var(--ease) both; }
  .store-title { animation: rise-in 0.6s var(--ease) 0.2s both; }
  .store-tagline { animation: rise-in 0.6s var(--ease) 0.3s both; }
  .branch-heading { animation: rise-in 0.6s var(--ease) 0.4s both; }
  .branch-card { animation: rise-in 0.7s var(--ease) both; animation-delay: calc(0.5s + var(--i, 0) * 0.15s); }
  .branch-note, .branch-footer { animation: rise-in 0.6s var(--ease) 0.9s both; }
  .branch-decor { animation: sun-in 1.8s ease-out both; }
  .chip-dot.is-open, .status-pill.is-open .status-dot { position: relative; }
  .chip-dot.is-open::after, .status-pill.is-open .status-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(125, 255, 79, 0.55); animation: radar-pulse 1.8s ease-out infinite; pointer-events: none; }
}
@keyframes rise-in { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes drop-in { 0% { opacity: 0; transform: translateY(-50px) scale(0.7) rotate(-8deg); } 60% { opacity: 1; transform: translateY(6px) scale(1.04) rotate(2deg); } 100% { opacity: 1; transform: none; } }
@keyframes sun-in { from { transform: scale(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes radar-pulse { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(2.6); opacity: 0; } }

/* ---------- شاشات أوسع ---------- */
@media (min-width: 640px) {
  .products-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .rail-item { flex-basis: 150px; }
  .hero-slide img { aspect-ratio: 1280 / 480; }
  .cat-tiles .cat-tile { flex-basis: 104px; }
  .product-name { font-size: 0.85rem; }
  .shelf .price { font-size: 1.1rem; }
}
@media (min-width: 960px) {
  .products-grid { grid-template-columns: repeat(6, 1fr); }
  .rail-item { flex-basis: 168px; }
  .cat-tiles { grid-template-columns: none; }
}
@media (max-width: 339px) { .products-grid { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  .has-reveal .section-head:not(.is-in), .has-reveal .cat-tile:not(.is-in), .has-reveal .offer-card:not(.is-in), .has-reveal .branch-strip:not(.is-in), .has-reveal .reorder-banner:not(.is-in) { opacity: 1; transform: none; }
}
/* هيدر الموبايل: منع تغطية اسم الموقع */
@media (max-width: 480px) {
  .header-actions { gap: 6px; }
  .head-icon { width: 36px; height: 36px; }
  .branch-chip { min-height: 36px; padding-inline: 10px; gap: 6px; font-size: 0.85rem; }
  .brand { gap: 8px; }
  .brand img { width: 38px; height: 38px; }
  .brand-text strong { font-size: 1rem; }
}
@media (max-width: 340px) {
  .chip-name { display: none; }
}
/* أيقونة القسم لما مفيش صورة (أقسام جديدة + المنتجات من غير صور) */
.cat-tile .cat-ico { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; color: var(--green); }
.cat-tile .cat-ico .icon { width: 30px; height: 30px; }
.cat-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: var(--green); opacity: 0.55; }
.cat-fallback .icon { width: 38%; height: 38%; }
.grid-note { grid-column: 1 / -1; text-align: center; padding: 32px 12px; color: var(--muted, #5d6f60); line-height: 2; }

.empty-branch { text-align: center; padding: 28px 16px; margin: 16px 0; background: #fff; border: 1px solid var(--line, #e3e9e4); border-radius: 18px; display: grid; gap: 10px; justify-items: center; }
.empty-branch h2 { margin: 0; font-size: 1.1rem; }
.empty-branch p { margin: 0; color: var(--muted, #5d6f60); line-height: 1.9; }

/* ==========================================================================
   تحديث معتمد (اختيار أ) — شريط فاتح خلف عنوان القسم
   + مسافة لزر «عرض المزيد» بعيد عن زر المساعدة العائم
   + إخفاء زر المسح المكرر في سفاري
   للرجوع عن البند الأول: امسح قواعد .section-head من هنا لآخر الملف.
   ========================================================================== */
.section-head {
  padding: 9px 14px;
  padding-inline-end: 26px;
  margin-bottom: 14px;
  border: 1px solid #d3e7da;
  border-radius: 14px;
  background: linear-gradient(270deg, #dcefe3 0%, #eef6f0 65%, rgba(238, 246, 240, 0) 100%);
}
.section-head .section-title { color: #0b3d25; }
.section-head .section-title::before { width: 5px; height: 1.2em; background: #c79a1e; }
.section-head .section-hint, .section-head a { color: #16603a; font-weight: 700; }
/* سفاري بيرسم زر مسح جوه خانة البحث فوق زر المسح بتاعنا */
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
