:root {
  /* نظام الألوان مشتقّ من لوجو Rassco Kids */
  --primary: #2CB6CD;        /* تركوازي اللوجو */
  --primary-dark: #1B93A8;
  --primary-soft: #E3F6FA;
  --accent: #F7A50A;         /* برتقالي اللوجو */
  --accent-soft: #FEF0D6;
  --yellow: #FDDC14;         /* أصفر اللوجو */
  --yellow-soft: #FFF6D0;    /* أصفر ناعم للخلفيات */
  --ink: #1f2937;
  --muted: #8a94a6;
  --line: #eef1f5;
  --bg: #f6f8fa;
  --card: #ffffff;
  --danger: #ef4444;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(16, 24, 40, 0.06);
  --shadow-sm: 0 2px 10px rgba(16, 24, 40, 0.05);
  --maxw: 480px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Tajawal', system-ui, 'Segoe UI', Tahoma, sans-serif;
  background: #e9edf1;
  color: var(--ink);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* إطار الموبايل الموسّط */
.app-frame {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,0.08);
  padding-bottom: 90px;
}

/* الرأس */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, var(--yellow-soft), #fffdf5);
  padding: 14px 16px 16px;
  border-radius: 0 0 24px 24px;
  box-shadow: var(--shadow-sm);
}
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--primary);
  background: var(--primary-soft);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-greeting { font-size: 12px; color: #96700a; font-weight: 700; }
.brand-name { font-size: 17px; font-weight: 800; color: var(--ink); }
.bell-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
  background: #fff; box-shadow: var(--shadow-sm);
}

.search-box {
  margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid #f0e6bf; border-radius: 14px;
  padding: 0 14px; height: 48px; box-shadow: var(--shadow-sm);
}
.search-box .search-icon { color: var(--primary); flex-shrink: 0; }
.search-box input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 15px; color: var(--ink);
}

/* المحتوى */
.app-main { padding: 16px; }

/* أقسام العرض */
.section { margin-bottom: 22px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-title { font-size: 18px; font-weight: 800; position: relative; padding-bottom: 7px; }
.section-title::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 34px; height: 4px; background: var(--yellow); border-radius: 4px;
}
.section-more { color: var(--primary); font-size: 13px; font-weight: 700; }

/* شبكة المنتجات */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.product-row {
  display: flex; gap: 12px; overflow-x: auto;
  padding-bottom: 6px; scroll-snap-type: x mandatory;
}
.product-row::-webkit-scrollbar { display: none; }
.product-row .product-card { width: 150px; flex: 0 0 auto; scroll-snap-align: start; }

.product-card {
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  position: relative; display: flex; flex-direction: column;
}
.product-card .p-img {
  width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f0f2f5;
}
.product-card .p-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .p-name {
  font-size: 14px; font-weight: 700; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 40px;
}
.product-card .p-price-row { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.product-card .p-price { color: var(--primary); font-weight: 800; font-size: 15px; }
.product-card .p-old { color: var(--muted); text-decoration: line-through; font-size: 12px; }
.badge-new {
  position: absolute; top: 10px; right: 10px;
  background: var(--yellow); color: #4a3900; font-size: 11px; font-weight: 800;
  padding: 3px 9px; border-radius: 20px;
}
.badge-off {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
}
.p-add {
  position: absolute; bottom: 12px; left: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(23,182,196,.4);
}
.out-stock { position:absolute; inset:0; background:rgba(255,255,255,.6); display:grid; place-items:center; font-weight:800; color:var(--danger); }

/* الهيرو / البانر */
.hero {
  border-radius: var(--radius); overflow: hidden; margin-bottom: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 22px; position: relative; min-height: 130px;
  display: flex; flex-direction: column; justify-content: center;
}
.hero.with-img { background-size: cover; background-position: center; }
.hero h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.hero p { margin: 0; opacity: .92; font-size: 14px; }
.hero-overlay { position:absolute; inset:0; background:linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,0,0,.05)); }
.hero > * { position: relative; z-index: 1; }

/* الأقسام (شبكة) */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cat-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); text-align: center;
}
.cat-card .c-img { width: 100%; aspect-ratio: 16/11; object-fit: cover; background: var(--primary-soft); }
.cat-card .c-name { padding: 12px; font-weight: 700; font-size: 15px; }
.cat-scroll { display:flex; gap:10px; overflow-x:auto; padding-bottom:6px; }
.cat-scroll::-webkit-scrollbar{ display:none; }
.cat-chip {
  flex:0 0 auto; background:var(--card); border:1px solid var(--line);
  padding:8px 16px; border-radius:30px; font-weight:700; font-size:14px;
}
.cat-chip.active { background:var(--primary); color:#fff; border-color:var(--primary); }

/* صفحة المنتج */
.pd-gallery { border-radius: var(--radius); overflow: hidden; background:#fff; box-shadow: var(--shadow-sm); }
.pd-main-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background:#f0f2f5; }
.pd-thumbs { display:flex; gap:8px; padding:10px; overflow-x:auto; }
.pd-thumbs img { width:60px; height:60px; border-radius:10px; object-fit:cover; border:2px solid transparent; }
.pd-thumbs img.active { border-color: var(--primary); }
.pd-info { background:#fff; border-radius: var(--radius); padding:16px; margin-top:14px; box-shadow: var(--shadow-sm); }
.pd-name { font-size:20px; font-weight:800; margin:0 0 8px; }
.pd-price-row { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.pd-price { color:var(--primary); font-size:22px; font-weight:800; }
.pd-old { color:var(--muted); text-decoration:line-through; }
.pd-desc { color:#4b5563; font-size:15px; white-space:pre-wrap; }
.opt-title { font-weight:700; margin:16px 0 8px; }
.opt-row { display:flex; gap:8px; flex-wrap:wrap; }
.opt-chip { border:1.5px solid var(--line); border-radius:10px; padding:7px 14px; font-weight:700; font-size:14px; }
.opt-chip.active { border-color:var(--primary); background:var(--primary-soft); color:var(--primary-dark); }
.color-dot { width:32px; height:32px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1.5px var(--line); }
.color-dot.active { box-shadow:0 0 0 2px var(--primary); }

.qty-box { display:flex; align-items:center; gap:14px; margin:16px 0; }
.qty-box button { width:36px; height:36px; border-radius:10px; background:var(--primary-soft); color:var(--primary-dark); font-size:20px; font-weight:700; }
.qty-box span { font-weight:800; font-size:18px; min-width:24px; text-align:center; }

/* أزرار */
.btn {
  display:flex; align-items:center; justify-content:center; gap:8px;
  background: var(--primary); color:#fff; font-weight:700; font-size:16px;
  padding: 14px; border-radius: 14px; width:100%;
}
.btn:disabled { opacity:.5; }
.btn-wa { background:#25D366; }
.btn-outline { background:#fff; color:var(--primary); border:1.5px solid var(--primary); }
.sticky-buy {
  position: sticky; bottom: 0; background: var(--bg);
  padding-top: 12px; display:flex; gap:10px; margin-top:16px;
}

/* السلة */
.cart-item { display:flex; gap:12px; background:#fff; border-radius:16px; padding:10px; box-shadow:var(--shadow-sm); margin-bottom:12px; }
.cart-item img { width:78px; height:78px; border-radius:12px; object-fit:cover; background:#f0f2f5; }
.cart-item .ci-body { flex:1; display:flex; flex-direction:column; }
.cart-item .ci-name { font-weight:700; font-size:15px; }
.cart-item .ci-meta { color:var(--muted); font-size:12px; }
.cart-item .ci-price { color:var(--primary); font-weight:800; margin-top:auto; }
.ci-remove { color:var(--danger); align-self:flex-start; font-size:20px; }
.cart-summary { background:#fff; border-radius:16px; padding:16px; box-shadow:var(--shadow-sm); }
.cart-line { display:flex; justify-content:space-between; margin-bottom:8px; }
.cart-total { display:flex; justify-content:space-between; font-weight:800; font-size:18px; border-top:1px dashed var(--line); padding-top:10px; margin-top:6px; }

/* حسابي / معلومات */
.info-card { background:#fff; border-radius:16px; padding:16px; box-shadow:var(--shadow-sm); margin-bottom:14px; }
.info-row { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.info-row:last-child { border-bottom:none; }
.info-row .ir-icon { width:40px; height:40px; border-radius:12px; background:var(--primary-soft); color:var(--primary-dark); display:grid; place-items:center; flex-shrink:0; }

/* حالة فارغة */
.empty { text-align:center; padding:60px 20px; color:var(--muted); }
.empty svg { color:var(--line); margin-bottom:14px; }
.empty h3 { color:var(--ink); margin:0 0 6px; }

/* هيكل تحميل */
.skeleton { background:linear-gradient(90deg,#eef1f5 25%,#e3e8ee 37%,#eef1f5 63%); background-size:400% 100%; animation:sk 1.3s ease infinite; border-radius:12px; }
@keyframes sk { 0%{background-position:100% 0} 100%{background-position:0 0} }
.sk-card { height:210px; }

/* زر واتساب العائم */
.wa-fab {
  position: fixed; bottom: 100px; z-index: 45;
  left: calc(50% - var(--maxw)/2 + 16px);
  width: 56px; height: 56px; border-radius: 50%;
  background:#25D366; display:grid; place-items:center;
  box-shadow: 0 8px 24px rgba(37,211,102,.45);
}
@media (max-width: 512px){ .wa-fab { left: 16px; } }

/* شريط التنقّل السفلي */
.bottom-nav {
  position: fixed; bottom: 0; z-index: 50;
  width: 100%; max-width: var(--maxw);
  left: 50%; transform: translateX(-50%);
  background:#fff; display:flex; justify-content:space-around;
  padding: 8px 6px 10px; border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 24px rgba(16,24,40,.08);
}
.nav-item {
  display:flex; flex-direction:column; align-items:center; gap:3px;
  color:var(--muted); font-size:11px; font-weight:600; flex:1; padding:4px 0;
  position: relative;
}
.nav-item.active { color: var(--primary); }
.cart-icon-wrap { position: relative; }
.cart-badge {
  position:absolute; top:-6px; left:-8px; background:var(--danger); color:#fff;
  font-size:10px; font-weight:700; min-width:17px; height:17px; padding:0 4px;
  border-radius:20px; display:grid; place-items:center;
}

/* لافتة تثبيت التطبيق (PWA) */
.pwa-banner {
  position: fixed; z-index: 60; bottom: 84px;
  left: 50%; transform: translateX(-50%);
  width: calc(100% - 24px); max-width: calc(var(--maxw) - 24px);
  background: #fff; border-radius: 18px; padding: 14px;
  box-shadow: 0 10px 40px rgba(16,24,40,.18);
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line);
  animation: pwaUp .3s ease;
}
@keyframes pwaUp { from { opacity: 0; transform: translateX(-50%) translateY(20px); } }
.pwa-logo { width: 52px; height: 52px; border-radius: 13px; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.pwa-text { flex: 1; min-width: 0; }
.pwa-title { font-weight: 800; font-size: 15px; }
.pwa-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pwa-install {
  margin-top: 8px; background: var(--primary); color: #fff;
  font-weight: 700; font-size: 14px; padding: 9px 18px; border-radius: 10px;
}
.pwa-close {
  align-self: flex-start; color: var(--muted); font-size: 24px; line-height: 1;
  width: 26px; height: 26px; flex-shrink: 0;
}
.ios-share { display: inline-block; color: var(--primary); font-weight: 800; }

/* Toast */
.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color:#fff; padding:12px 20px; border-radius:12px;
  font-weight:600; font-size:14px; opacity:0; pointer-events:none; transition:.25s; z-index:100;
  max-width: 90%;
}
.toast.show { opacity:1; transform: translateX(-50%) translateY(0); }
