/* =====================================================
   layout.css — Header / Nav / Footer / Sticky Bar
   حباش حمدي | Mobile-First | RTL
   ui-ux-pro-max: Warm Artisan Food Brand
   تحديث 2026-06-30: إخفاء sticky-bar داخل /cart (مكرر لوظيفة الصفحة نفسها)
   ===================================================== */

/* ─────────────────────────────────────────────────────
   HEADER / NAV
   skill rules applied:
   • touch-target ≥ 48px on all interactive elements
   • safe-area-awareness: padding respects notch/env()
   • nav-label-icon: icon + text on every nav link
   • nav-state-active: current page highlighted
   • fixed-element-offset: body gets padding-top = nav height
   ───────────────────────────────────────────────────── */

:root {
  --nav-h:         64px;
  --sticky-h:      68px;
  --sticky-safe:   calc(var(--sticky-h) + env(safe-area-inset-bottom, 0px));
}

/* ── Nav shell ─────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 8px rgba(90,36,24,.07);
}

.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ── Logo ──────────────────────────────────────── */
.site-nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  flex-shrink: 0;
}
.site-nav__logo-img {
  height: 44px;
  width: auto;
  display: block;
}
.site-nav__logo-text {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--color-brown);
  line-height: 1.2;
  /* hide on very small screens */
}
@media (max-width: 360px) {
  .site-nav__logo-text { display: none; }
}

/* ── Desktop Links ─────────────────────────────── */
.site-nav__links {
  display: none;
  align-items: center;
  gap: var(--space-md);
  list-style: none;
}
@media (min-width: 768px) {
  .site-nav__links { display: flex; }
}

.site-nav__links a {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-brown);
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  /* skill: touch-target — extend hit area */
  min-height: 44px;
  transition: color 150ms ease, border-color 150ms ease;
  white-space: nowrap;
}
.site-nav__links a:hover {
  color: var(--color-golden);
  border-bottom-color: var(--color-golden);
}
.site-nav__links a.active {
  color: var(--color-golden);
  border-bottom-color: var(--color-golden);
}
.site-nav__links a svg {
  width: 16px; height: 16px;
  flex-shrink: 0; opacity: .6;
}

/* ── Nav Actions (cart + hamburger) ───────────── */
.site-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Cart button */
.nav-cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* skill: touch-target */
  min-width: 48px;
  min-height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-brown);
  border-radius: var(--radius-md);
  transition: background 150ms ease;
  text-decoration: none;
}
.nav-cart-btn:hover { background: var(--color-bg); }
.nav-cart-btn svg   { width: 24px; height: 24px; }

.nav-cart-count {
  position: absolute;
  top: 6px;
  left: 6px; /* RTL: badge في اليسار */
  background: var(--color-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0 3px;
  pointer-events: none;
}
/* مخفي لما السلة فاضية */
.nav-cart-count[data-count="0"] { display: none; }

/* Hamburger button */
.nav-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  /* skill: touch-target */
  min-width: 48px;
  min-height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-md);
  transition: background 150ms ease;
}
.nav-hamburger:hover { background: var(--color-bg); }
@media (min-width: 768px) {
  .nav-hamburger { display: none; }
}
.nav-hamburger__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-brown);
  border-radius: 2px;
  transition: transform 250ms ease, opacity 250ms ease;
}
/* open state */
.nav-hamburger[aria-expanded="true"] .nav-hamburger__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] .nav-hamburger__bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-hamburger[aria-expanded="true"] .nav-hamburger__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─────────────────────────────────────────────────────
   MOBILE NAV DRAWER
   skill: slide from right (RTL), overlay, focus-trap
   ───────────────────────────────────────────────────── */

/* Overlay */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
.nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer */
.nav-drawer {
  position: fixed;
  top: 0;
  right: 0; /* RTL: يخرج من اليمين */
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--color-white);
  z-index: 310;
  /* skill: transform only for animation */
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* skill: safe-area-awareness */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-drawer.is-open {
  transform: translateX(0);
}
@media (min-width: 768px) {
  .nav-drawer, .nav-overlay { display: none !important; }
}

/* Drawer header */
.nav-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md) var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.nav-drawer__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}
.nav-drawer__logo img { height: 40px; width: auto; }
.nav-drawer__logo-name {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--color-brown);
}

/* Close button */
.nav-drawer__close {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-brown);
  border-radius: var(--radius-md);
  transition: background 150ms ease;
}
.nav-drawer__close:hover { background: var(--color-bg); }
.nav-drawer__close svg   { width: 22px; height: 22px; }

/* Drawer links */
.nav-drawer__links {
  flex: 1;
  padding: var(--space-md);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.nav-drawer__links a {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  /* skill: touch-target ≥ 48px */
  min-height: 52px;
  padding: 0 var(--space-md);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--color-brown);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background 150ms ease, color 150ms ease;
}
.nav-drawer__links a:hover,
.nav-drawer__links a.active {
  background: var(--color-bg);
  color: var(--color-golden);
}
.nav-drawer__links a svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  color: var(--color-gold);
}

/* Drawer footer: واتساب */
.nav-drawer__footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}
.nav-drawer__wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 52px;
  width: 100%;
  background: #22C55E;
  color: #fff;
  font-size: var(--fs-base);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-full);
  transition: background 150ms ease, transform 150ms ease;
}
.nav-drawer__wa:hover  { background: #16A34A; }
.nav-drawer__wa:active { transform: scale(.97); }
.nav-drawer__wa svg    { width: 20px; height: 20px; flex-shrink: 0; }

/* ─────────────────────────────────────────────────────
   FOOTER
   skill: Warm Artisan, clear NAP, local SEO
   ───────────────────────────────────────────────────── */

.site-footer {
  background: var(--color-brown);
  color: rgba(255,255,255,.8);
  padding: var(--space-3xl) 0 0;
  /* مسافة للـ sticky bar على الموبايل */
}
@media (max-width: 767px) {
  .site-footer { padding-bottom: var(--sticky-safe); }
}
@media (min-width: 768px) {
  .site-footer { padding-bottom: 0; }
}
/* صفحة السلة لا يوجد بها sticky-bar إطلاقاً — لا داعي لمساحة إضافية أسفل الفوتر */
body.page-cart .site-footer {
  padding-bottom: 0;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md) var(--space-2xl);
}
@media (min-width: 600px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .site-footer__grid { grid-template-columns: 2fr 1fr 1fr; }
}

/* عمود البراند */
.footer-brand__logo {
  height: 56px;
  width: auto;
  margin-bottom: var(--space-md);
  display: block;
}
.footer-brand__name {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: var(--space-sm);
}
.footer-brand__desc {
  font-size: var(--fs-sm);
  color: rgba(255,255,255,.65);
  line-height: 1.75;
  margin-bottom: var(--space-lg);
  max-width: 300px;
}
/* زر واتساب في الفوتر */
.footer-wa-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 48px;
  padding: 0 var(--space-lg);
  background: #22C55E;
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-full);
  transition: background 150ms ease, transform 150ms ease;
}
.footer-wa-btn:hover  { background: #16A34A; color: #fff; }
.footer-wa-btn:active { transform: scale(.97); }
.footer-wa-btn svg    { width: 18px; height: 18px; flex-shrink: 0; }

/* عناوين الأعمدة */
.footer-col__title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(216,179,106,.25);
}

/* روابط سريعة */
.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.footer-links a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 36px;
  font-size: var(--fs-sm);
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: color 150ms ease;
}
.footer-links a:hover { color: var(--color-golden); }
.footer-links a svg   { width: 14px; height: 14px; flex-shrink: 0; opacity: .5; }

/* بيانات التواصل */
.footer-contact__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.footer-contact__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: .55;
  color: var(--color-gold);
}
.footer-contact__label {
  font-size: 11px;
  color: var(--color-gold);
  font-weight: 600;
  margin-bottom: 3px;
  letter-spacing: .04em;
}
.footer-contact__value {
  font-size: var(--fs-sm);
  color: rgba(255,255,255,.8);
  line-height: 1.6;
}
.footer-contact__value a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  direction: ltr;
  display: inline-block;
}
.footer-contact__value a:hover { color: var(--color-golden); }

/* الشريط السفلي للفوتر */
.site-footer__bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: var(--space-md) var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.footer-copy {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.4);
}
.footer-local-seo {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.3);
  text-align: left; /* LTR direction for this line */
}

/* ─────────────────────────────────────────────────────
   DEVELOPER CREDIT — أسفل الفوتر، الواجهة العامة فقط
   موشن CSS خفيف: ظهور ناعم من 8px عند التحميل + لمعان
   ذهبي يمر على الاسم كل 7 ثوانٍ. transform/opacity فقط،
   عنصر ثابت في مكانه الطبيعي (ليس fixed)، مرة واحدة.
   ───────────────────────────────────────────────────── */
.dev-credit {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .4rem;
  padding: .4rem 1rem 1.1rem;
  font-size: .78rem;
  opacity: 0;
  animation: devCreditIn .9s ease .25s forwards;
}
.dev-credit__label { color: rgba(255,255,255,.42); }
.dev-credit__link {
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .3px;
  background: linear-gradient(110deg,
    var(--color-gold, #D8B36A) 25%,
    #ffedc4 42%,
    var(--color-golden, #E89A2D) 58%,
    var(--color-gold, #D8B36A) 75%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: devCreditShine 7s linear infinite;
}
.dev-credit__link:hover,
.dev-credit__link:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--color-gold, #D8B36A);
  text-underline-offset: 3px;
}
@keyframes devCreditIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: .92; transform: none; }
}
@keyframes devCreditShine {
  0%   { background-position: 130% 0; }
  100% { background-position: -130% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dev-credit { animation: none; opacity: .92; transform: none; }
  .dev-credit__link { animation: none; background-position: 50% 0; }
}

/* ─────────────────────────────────────────────────────
   STICKY MOBILE BAR
   skill: bottom nav ≤5 items, safe-area-awareness,
          show on mobile only, not in admin/coming-soon
   ───────────────────────────────────────────────────── */

.sticky-bar {
  position: fixed;
  bottom: 0;
  right: 0; /* RTL */
  left: 0;
  z-index: 190;
  background: var(--color-brown);
  border-top: 2px solid var(--color-golden);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  /* skill: safe-area-awareness (iOS home indicator) */
  padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px rgba(0,0,0,.18);
  /* only on mobile */
}
@media (min-width: 768px) {
  .sticky-bar { display: none; }
}

/* صفحة السلة نفسها لا تحتاج sticky-bar: المستخدم بالفعل داخل السلة،
   وزر "إرسال الطلب" في ملخص الطلب هو الإجراء الرئيسي بديلاً عنه.
   إخفاء كامل بدلاً من الاعتماد على JS، يمنع أي وميض ظهور قبل التحميل. */
body.page-cart .sticky-bar {
  display: none !important;
}
body.page-cart {
  padding-bottom: 0 !important;
}

/* Cart side */
.sticky-bar__cart {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  min-height: 48px; /* skill: touch-target */
  padding: 0 var(--space-sm);
}
.sticky-bar__cart-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sticky-bar__cart-icon-wrap svg {
  width: 26px; height: 26px;
  color: rgba(255,255,255,.85);
}
.sticky-bar__cart-badge {
  position: absolute;
  top: -6px;
  left: -6px; /* RTL */
  background: var(--color-golden);
  color: var(--color-brown);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}
.sticky-bar__cart-badge[data-count="0"] { display: none; }

.sticky-bar__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sticky-bar__count {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.6);
  line-height: 1;
}
.sticky-bar__total {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--color-gold);
  line-height: 1;
}
/* مخفي لما السلة فاضية */
.sticky-bar__info.is-empty .sticky-bar__count { display: none; }
.sticky-bar__info.is-empty .sticky-bar__total { display: none; }
.sticky-bar__empty-msg {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.4);
}
/* مخفي لما في منتجات */
.sticky-bar__info:not(.is-empty) .sticky-bar__empty-msg { display: none; }

/* Order CTA button */
.sticky-bar__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  /* skill: touch-target */
  min-height: 48px;
  padding: 0 var(--space-lg);
  background: var(--color-golden);
  color: var(--color-brown);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: background 150ms ease, transform 150ms ease;
  border: none; cursor: pointer;
  font-family: var(--font-main);
}
.sticky-bar__cta:hover  { background: var(--color-gold); }
.sticky-bar__cta:active { transform: scale(.97); }
.sticky-bar__cta svg    { width: 16px; height: 16px; flex-shrink: 0; }

/* body offset عشان المحتوى ما يتغطاش بالـ sticky bar */
body.has-sticky-bar {
  padding-bottom: var(--sticky-safe);
}
/* استثناء صفحة السلة: لا يوجد sticky-bar فيها، فلا حاجة لمساحة سفلية إضافية */
body.has-sticky-bar.page-cart {
  padding-bottom: 0;
}

/* ─────────────────────────────────────────────────────
   NAV ACTIVE STATE
   يتحدد بـ JS حسب الرابط الحالي
   ───────────────────────────────────────────────────── */
.site-nav__links a.active,
.nav-drawer__links a.active {
  color: var(--color-golden);
}
.site-nav__links a.active {
  border-bottom-color: var(--color-golden);
}
.nav-drawer__links a.active {
  background: var(--color-bg);
}
