/* ===== layout: shell, header, nav, footer, page structure (logical properties only) ===== */
#app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#main { flex: 1 0 auto; outline: none; }
.container { width: min(100% - 2 * var(--gutter), var(--container, 1200px)); margin-inline: auto; }
#bg-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

/* ---- header ---- */
.site-header {
  position: sticky; inset-block-start: 0; z-index: 60; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  border-block-end: 1px solid transparent; transition: border-color var(--t), background var(--t);
}
.site-header.scrolled { border-block-end-color: var(--border); background: color-mix(in srgb, var(--bg) 80%, transparent); }
.header-in { height: 100%; display: flex; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: calc(var(--r-sm) + 2px); flex: none; display: grid; place-items: center;
  background: var(--grad); color: var(--on-primary); font-weight: 800; font-size: 18px; overflow: hidden;
  box-shadow: 0 4px 18px color-mix(in srgb, var(--primary) 40%, transparent);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-mark.has-logo { background: var(--field); box-shadow: none; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.main-nav { display: none; align-items: center; gap: 2px; margin-inline-start: 12px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 14px;
  transition: color var(--t), background var(--t);
}
.nav-link:hover { color: var(--text); background: var(--hover); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--text); background: var(--pri-bg); }
.header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; flex: none;
  border-radius: 999px; border: 1px solid var(--border); background: var(--glass); color: var(--text);
  transition: background var(--t), border-color var(--t), transform var(--t);
}
.icon-btn:hover { background: var(--hover); border-color: var(--border-2); }
.icon-btn[aria-expanded="true"] { border-color: var(--accent); }
.icon-btn.lang-btn { width: auto; padding-inline: 12px; gap: 6px; display: inline-flex; align-items: center; font-weight: 600; font-size: 13px; white-space: nowrap; }
.bal-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding-inline: 12px 14px; border-radius: 999px;
  background: var(--pri-bg); border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent); color: var(--text); font-weight: 700; font-size: 14px;
}
.bal-pill:hover { text-decoration: none; background: color-mix(in srgb, var(--primary) 30%, transparent); }
.badge-dot {
  position: absolute; inset-block-start: -3px; inset-inline-end: -3px; min-width: 18px; height: 18px; padding-inline: 5px;
  border-radius: 999px; background: var(--danger); color: var(--on-primary); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  border: 2px solid var(--bg);
}
.avatar { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; background: var(--grad); color: var(--on-primary); font-weight: 800; border: 0; }

.menu-wrap { position: relative; }
.menu-panel {
  position: absolute; inset-block-start: calc(100% + 10px); inset-inline-end: 0; z-index: 70; width: min(360px, calc(100vw - 2 * var(--gutter)));
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow-2); overflow: hidden;
}
.menu-panel.narrow { width: 240px; }
.menu-head { padding: 12px 14px; border-block-end: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; color: var(--text); width: 100%; background: none; border: 0; text-align: start; font-size: 14px; }
.menu-item:hover { background: var(--hover); text-decoration: none; }
.menu-list { max-height: min(60vh, 420px); overflow-y: auto; }

/* ---- bottom nav (mobile) ---- */
.bottom-nav {
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 60; display: flex; justify-content: space-around;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-block-start: 1px solid var(--border);
}
.bn-link { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); font-size: 11px; font-weight: 600; border-radius: var(--r-sm); min-width: 0; }
.bn-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-link:hover { text-decoration: none; color: var(--text); }
.bn-link[aria-current="page"] { color: var(--text); }
.bn-link[aria-current="page"] .bn-ic { background: var(--grad); color: var(--on-primary); }
.bn-ic { width: 40px; height: 28px; border-radius: 999px; display: grid; place-items: center; transition: background var(--t), color var(--t); }
:root { --bottom-h: 62px; }

/* ---- page scaffolding ---- */
.view { padding-block: 22px 40px; padding-block-end: calc(40px + var(--bottom-h)); }
.page-head { margin-block-end: 20px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-title { font-size: clamp(22px, 4vw, 30px); }
.page-sub { color: var(--muted); margin-block-start: 4px; }
.stack { display: grid; gap: 16px; }
.cols-2 { display: grid; gap: 18px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---- footer ---- */
.site-footer { flex: none; border-block-start: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 60%, transparent); padding-block: 28px calc(28px + var(--bottom-h)); }
.footer-in { display: grid; gap: 16px; justify-items: center; text-align: center; }
.footer-text { color: var(--muted); max-width: 640px; text-align: center; } /* .bidi-auto بيحط text-align:start على العنصر نفسه ⇒ كان بيكسر توسيط الفوتر لما النص يلفّ سطرين */
.footer-contacts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.footer-copy { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; } /* اسم متجر طويل من غير مسافات مايوسّعش الصفحة */

@media (min-width: 900px) {
  :root { --bottom-h: 0px; --gutter: 24px; }
  .main-nav { display: flex; }
  .bottom-nav { display: none; }
  .brand-name { max-width: 220px; }
  .cols-2 { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 899px) {
  .nav-link .nav-label { display: none; }
  .bal-pill { padding-inline: 10px; }
}
@media (max-width: 480px) {
  :root { --gutter: 14px; }
  /* اسم المتجر: بياخد المساحة اللي الأزرار سابتها وبيلفّ على سطرين (من غير قطع عند ١١٠px) — الكلمة الأولى دايماً ظاهرة */
  .brand { flex: 1 1 auto; min-width: 0; }
  .brand-name { max-width: none; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.15; font-size: 15px; overflow-wrap: anywhere; }
  .header-actions { gap: 6px; }
  .icon-btn, .avatar { width: 38px; height: 38px; }
  .bal-pill { height: 38px; font-size: 13px; }
  .icon-btn.lang-btn { padding-inline: 9px; gap: 4px; }
  .menu-panel { position: fixed; inset-block-start: calc(var(--header-h) + 6px); inset-inline: var(--gutter); width: auto; }
  .menu-panel.narrow { inset-inline-start: auto; width: min(260px, calc(100vw - 2 * var(--gutter))); }
}
@media (max-width: 380px) {
  .brand-name { font-size: 14px; }
  .brand-mark { width: 34px; height: 34px; }
  /* شاشة ضيقة: نضغط الأزرار عشان اسم المتجر ياخد مكانه — الكلمة (عربي/EN) بتختفي والكرة بتفضل (الزر فيه aria-label وبيفضل ≥٣٨px)، وأيقونة المحفظة وأيقونة «تسجيل الدخول» بتختفي والنص بيفضل */
  .header-in { gap: 8px; }
  .brand { gap: 8px; }
  .header-actions { gap: 4px; }
  .icon-btn.lang-btn { inline-size: 38px; padding-inline: 0; justify-content: center; }
  .icon-btn.lang-btn .lang-label { display: none; }
  .bal-pill > .ic { display: none; }
  .header-actions > .btn-sm > .ic { display: none; }
}
@media (max-width: 340px) {
  /* ٣٢٠px: ملّي مساحة إضافية للاسم (الخطوط الحقيقية أعرض من الاحتياطي) */
  .brand-name { font-size: 13px; }
  .brand-mark { width: 30px; height: 30px; font-size: 16px; }
  .bal-pill { padding-inline: 6px; font-size: 12px; }
  .header-actions > .menu-wrap > .icon-btn, .header-actions > .menu-wrap > .avatar { width: 36px; height: 36px; }
}

/* ---- التواصل: أزرار عايمة + قسم «تواصل معنا» ---- */
.fab-contact { position: fixed; z-index: 45; display: grid; gap: 12px; inset-block-end: calc(var(--fab-bottom, 24px) + env(safe-area-inset-bottom, 0px)); }
.fab-contact[data-side="right"] { right: 18px; }
.fab-contact[data-side="left"] { left: 18px; }
.fab { position: relative; inline-size: 54px; block-size: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; text-decoration: none; background: linear-gradient(150deg, color-mix(in srgb, var(--fab-c) 82%, #fff), var(--fab-c)); box-shadow: 0 12px 30px -10px var(--fab-c), inset 0 0 0 1px rgba(255, 255, 255, .22); transition: transform var(--t), box-shadow var(--t); }
.fab:hover, .fab:focus-visible { transform: translateY(-3px) scale(1.07); text-decoration: none; box-shadow: 0 16px 38px -8px var(--fab-c), inset 0 0 0 1px rgba(255, 255, 255, .3); }
.fab::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--fab-c); opacity: 0; pointer-events: none; }
html[data-motion="full"] .fab::before { animation: fab-ring 2.6s var(--ease) infinite; }
.fab + .fab::before { animation-delay: 1.3s; }
@keyframes fab-ring { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(1.7); opacity: 0; } }
.fab-tip { position: absolute; inset-block-start: 50%; transform: translateY(-50%); white-space: nowrap; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--text); background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity var(--t); }
.fab-contact[data-side="right"] .fab-tip { right: calc(100% + 10px); }
.fab-contact[data-side="left"] .fab-tip { left: calc(100% + 10px); }
.fab:hover .fab-tip, .fab:focus-visible .fab-tip { opacity: 1; }
@media (max-width: 899px) { .fab-contact { inset-block-end: calc(var(--fab-bottom, 24px) + 74px + env(safe-area-inset-bottom, 0px)); } .fab { inline-size: 50px; block-size: 50px; } .fab-tip { display: none; } }
.contact-sec { margin-block: 38px 10px; padding: 26px 22px; border-radius: var(--r); border: 1px solid var(--card-border); background: var(--card-bg); -webkit-backdrop-filter: var(--card-blur); backdrop-filter: var(--card-blur); position: relative; overflow: hidden; }
.contact-sec::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 120% at 50% -20%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 70%); pointer-events: none; }
.contact-head { position: relative; text-align: center; display: grid; gap: 6px; margin-block-end: 20px; }
.contact-head h2 { font-size: 22px; }
.contact-head > .bidi-auto { text-align: center; } /* نفس سبب .footer-text: start على العنصر بيغلب توسيط الأب (العنوان كان على الطرف والكارت عريض) */
.contact-head p { max-inline-size: 56ch; margin-inline: auto; }
.contact-grid { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; } /* flex بدل auto-fit grid: كارت واحد/اتنين بيتوسّطوا بعرض محدود بدل ما يملوا الصف كله */
.contact-card { --cc: var(--primary); --cc-on: var(--on-primary); flex: 1 1 230px; max-inline-size: 340px; min-inline-size: 0; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text); text-decoration: none; transition: transform var(--t), border-color var(--t), box-shadow var(--t); }
.contact-card:hover, .contact-card:focus-visible { transform: translateY(-3px); text-decoration: none; border-color: var(--cc); box-shadow: 0 14px 34px -16px var(--cc); }
.contact-ic { inline-size: 46px; block-size: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; color: var(--cc-on, #fff); background: linear-gradient(150deg, color-mix(in srgb, var(--cc) 80%, #fff), var(--cc)); box-shadow: 0 8px 22px -10px var(--cc); }
.contact-txt { display: grid; gap: 2px; min-width: 0; flex: 1; }
.contact-txt small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; justify-self: start; max-inline-size: 100%; } /* justify-self: الـsmall (dir=ltr) تحت الاسم بنفس حافة البداية في RTL */
.contact-go { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--cc); white-space: nowrap; }
[dir="rtl"] .contact-go svg { transform: scaleX(-1); }
