:root {
  /* اللوحة المبهجة — وردي مرجاني + كريمي + ذهبي */
  --bg: #fff8f4;
  --surface: #ffffff;
  --border: #f4e4dc;
  --text: #2a1416;
  --text-muted: #8a6b6f;

  --primary: #e85a71;          /* وردي مرجاني نابض */
  --primary-dark: #c43e58;
  --primary-soft: #ffe4ea;
  --primary-glow: rgba(232, 90, 113, 0.25);

  --accent: #d4a574;           /* ذهبي دافئ */
  --accent-soft: #fef3e2;

  --secondary: #7c6cf0;        /* بنفسجي ناعم للتنويع */
  --secondary-soft: #ece9ff;

  --success: #10b981;
  --success-soft: #d1fae5;
  --danger: #ef4444;
  --warning: #f59e0b;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(232, 90, 113, 0.05);
  --shadow: 0 4px 14px rgba(232, 90, 113, 0.08);
  --shadow-lg: 0 12px 32px rgba(232, 90, 113, 0.14);
  --shadow-glow: 0 0 0 4px var(--primary-glow);

  --gradient-hero: linear-gradient(135deg, rgba(255,228,234,0.78) 0%, rgba(255,245,232,0.78) 50%, rgba(255,233,212,0.78) 100%);
  --gradient-primary: linear-gradient(135deg, #f06b85 0%, #e85a71 100%);
  --gradient-card: linear-gradient(180deg, #fff8f4 0%, #ffe4ea 100%);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Tajawal', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  min-height: 100vh;
  direction: rtl;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ─── Layout ─── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  max-width: 1200px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}
.brand-mark, .brand-mark-img {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  transition: transform 0.4s var(--ease-bounce);
}
.brand:hover .brand-mark-img { transform: rotate(-8deg) scale(1.05); }
.brand-mark {
  background: var(--gradient-primary);
  border-radius: 12px;
  color: white;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.brand-mark-img { object-fit: contain; filter: drop-shadow(0 3px 6px rgba(232, 90, 113, 0.2)); }

.nav-actions { display: flex; align-items: center; gap: 12px; }

.cart-btn {
  position: relative;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s var(--ease);
}
.cart-btn:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}
.cart-btn:active { transform: translateY(0); }

/* زر دخول الأدمن — صغير وأنيق */
.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.45;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
}
.admin-link:hover {
  opacity: 1;
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-soft);
  transform: scale(1.05);
}
.admin-link svg { display: block; }
@media (max-width: 600px) {
  .admin-link { width: 32px; height: 32px; }
}
.cart-badge {
  position: absolute;
  top: -6px;
  inset-inline-start: -6px;
  background: var(--gradient-primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  box-shadow: 0 2px 8px var(--primary-glow);
  animation: badgePop 0.4s var(--ease-bounce);
}
@keyframes badgePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ─── Hero / Search ─── */
.hero {
  background: var(--gradient-hero);
  background-size: 200% 200%;
  padding: 28px 16px;
  border-bottom: 1px solid var(--border);
  animation: heroShift 18s ease infinite;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -40px; inset-inline-end: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(232,90,113,0.18), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -60px; inset-inline-start: -30px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(212,165,116,0.18), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.hero > * { position: relative; }
@keyframes heroShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero h1 { font-size: 22px; margin-bottom: 6px; }
.hero p { color: var(--text-muted); margin-bottom: 16px; }
.search-bar {
  display: flex;
  gap: 8px;
  max-width: 600px;
}
.search-bar input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
}
.search-bar button {
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search-bar button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}
.search-bar button:active { transform: scale(0.97); }

/* ─── Categories nav ─── */
.cats-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.cat-pill {
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s var(--ease);
  font-weight: 500;
}
.cat-pill:hover {
  background: var(--primary-soft);
  border-color: var(--primary-soft);
  transform: translateY(-1px);
}
.cat-pill.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.cat-pill.cat-sold {
  background: #1f2937;
  color: #d4a574;
  border-color: #1f2937;
  font-weight: 700;
}
.cat-pill.cat-sold:hover {
  background: #111827;
  color: #e5b783;
}
.cat-pill.cat-sold.active {
  background: linear-gradient(135deg, #1f2937, #374151);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(31,41,55,0.4);
}

/* ─── Product grid ─── */
/* الشبكة الأساسية مرّ تعريفها لاحقاً مع متغير --cols ووضع العرض */

.product-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease), background 0.2s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  animation: cardEnter 0.5s var(--ease) both;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.product-card:hover { background: rgba(255, 255, 255, 0.97); }
.products-grid .product-card:nth-child(1) { animation-delay: 0.02s; }
.products-grid .product-card:nth-child(2) { animation-delay: 0.06s; }
.products-grid .product-card:nth-child(3) { animation-delay: 0.10s; }
.products-grid .product-card:nth-child(4) { animation-delay: 0.14s; }
.products-grid .product-card:nth-child(5) { animation-delay: 0.18s; }
.products-grid .product-card:nth-child(6) { animation-delay: 0.22s; }
.products-grid .product-card:nth-child(7) { animation-delay: 0.26s; }
.products-grid .product-card:nth-child(8) { animation-delay: 0.30s; }
.products-grid .product-card:nth-child(n+9) { animation-delay: 0.34s; }
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-soft);
}
.product-card .img-wrap img {
  transition: transform 0.5s var(--ease);
}
.product-card:hover .img-wrap img {
  transform: scale(1.06);
}
.product-card .img-wrap {
  aspect-ratio: 1;
  background: var(--primary-soft);
  overflow: hidden;
  position: relative;
}
.product-card .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-card .img-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 32px;
}
.product-card .info { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }

.reserved-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  color: white;
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 2;
  letter-spacing: 0.5px;
}
.product-card.is-reserved {
  filter: saturate(0.7);
  pointer-events: auto;
  position: relative;
}
.product-card.is-reserved .img-wrap img { opacity: 0.6; }

.my-cart-badge {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  z-index: 3;
  box-shadow: 0 3px 10px rgba(16,185,129,0.4);
  animation: badgePop 0.4s var(--ease-bounce);
}

/* المنتجات المباعة */
.product-card.is-sold {
  filter: grayscale(20%);
}
.product-card.is-sold .img-wrap img { opacity: 0.65; }
.sold-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(31,41,55,0.55), rgba(0,0,0,0.45));
  color: #d4a574;
  font-weight: 800;
  font-size: 18px;
  display: grid;
  place-items: center;
  letter-spacing: 1px;
  z-index: 2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.sold-price {
  text-decoration: line-through;
  opacity: 0.7;
}
.sold-date {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-inline-start: 4px;
  text-decoration: none;
  vertical-align: middle;
}
.product-card .name { font-weight: 600; font-size: 14px; line-height: 1.4; min-height: 2.8em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .price { color: var(--primary-dark); font-weight: 700; font-size: 15px; margin-top: auto; }
.product-card .meta { color: var(--text-muted); font-size: 12px; }

/* ─── Empty / loading ─── */
.empty, .loading {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Product detail ─── */
.product-detail {
  background: rgba(255, 255, 255, 0.93);
  margin: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery-slide {
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  scroll-snap-align: start;
}
.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* الصورة الواقعية — تأطير مميز كأنها لوحة عرض */
.gallery-slide.is-real {
  padding: 10px;
  background: linear-gradient(135deg, #d1fae5, #ecfdf5, #fff8e1);
}
.gallery-slide.is-real img {
  border-radius: 8px;
  box-shadow:
    0 0 0 3px var(--success),
    0 0 0 6px rgba(255,255,255,0.95),
    0 0 0 8px var(--success),
    0 8px 24px rgba(16,185,129,0.25);
  animation: realFrameGlow 3s var(--ease) infinite;
}
@keyframes realFrameGlow {
  0%, 100% {
    box-shadow:
      0 0 0 3px var(--success),
      0 0 0 6px rgba(255,255,255,0.95),
      0 0 0 8px var(--success),
      0 8px 24px rgba(16,185,129,0.25);
  }
  50% {
    box-shadow:
      0 0 0 3px var(--success),
      0 0 0 6px rgba(255,255,255,0.95),
      0 0 0 8px var(--success),
      0 8px 32px rgba(16,185,129,0.45);
  }
}

/* زوايا فنية على الإطار — توحي بـ"صورة فوتوغرافية" */
.gallery-slide.is-real::before,
.gallery-slide.is-real::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid var(--success);
  z-index: 2;
  pointer-events: none;
}
.gallery-slide.is-real::before {
  top: 18px;
  inset-inline-start: 18px;
  border-right: none;
  border-bottom: none;
}
.gallery-slide.is-real::after {
  bottom: 18px;
  inset-inline-end: 18px;
  border-left: none;
  border-top: none;
}

/* شريط زاوية يمين علوي "القطعة الحقيقية" */
.real-corner-ribbon {
  position: absolute;
  top: 14px;
  inset-inline-end: -38px;
  background: linear-gradient(135deg, var(--success), #047857);
  color: white;
  padding: 5px 50px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  transform: rotate(40deg);
  box-shadow: 0 2px 6px rgba(16,185,129,0.4);
  z-index: 4;
  animation: ribbonShine 0.6s var(--ease) 0.3s both;
}
@keyframes ribbonShine {
  from { opacity: 0; transform: rotate(40deg) translateY(-10px); }
  to { opacity: 1; transform: rotate(40deg) translateY(0); }
}

/* الشارات */
.photo-badge {
  position: absolute;
  top: 22px;
  inset-inline-start: 22px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 3;
  animation: badgeFade 0.4s var(--ease) 0.2s both;
}
@keyframes badgeFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.real-badge {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 4px 14px rgba(16,185,129,0.4);
}
.real-badge .badge-dot {
  width: 8px; height: 8px;
  background: white;
  border-radius: 50%;
  display: inline-block;
  animation: dotPulse 1.6s var(--ease) infinite;
  box-shadow: 0 0 0 0 rgba(255,255,255,0.8);
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,0.8); }
  50% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}

.original-badge {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* النقطة الدالّة على الصورة الواقعية في شريط الـ dots */
.gallery-dots .dot.is-real {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.3);
  width: 10px; height: 10px;
}
.gallery-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 10px;
}
.gallery-dots .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}
.gallery-dots .dot.active { background: var(--primary); }

.detail-body { padding: 16px; }
.detail-body h1 { font-size: 20px; margin-bottom: 8px; }
.detail-body .brand { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
.detail-body .price-big { color: var(--primary-dark); font-weight: 800; font-size: 26px; margin-bottom: 16px; }

.specs-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.specs-list .row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  gap: 12px;
}
.specs-list .row .key { color: var(--text-muted); }
.specs-list .row .val { font-weight: 600; }

.description {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius-sm);
  line-height: 1.7;
  white-space: pre-line;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  font-size: 15px;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--gradient-primary); color: white; box-shadow: 0 4px 12px var(--primary-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px var(--primary-glow); }
.btn-success { background: linear-gradient(135deg, #34d399, #10b981); color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.25); }
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(16,185,129,0.35); }
.btn-outline { background: transparent; color: var(--primary-dark); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-danger { background: var(--danger); color: white; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.detail-actions {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

/* ─── Cart ─── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
}
.cart-overlay.open { display: block; }
.cart-panel {
  position: fixed;
  top: 0; bottom: 0;
  inset-inline-start: 0;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  z-index: 101;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
[dir="rtl"] .cart-panel { inset-inline-start: 0; transform: translateX(100%); }
.cart-panel.open { transform: translateX(0); }
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cart-header h2 { font-size: 18px; }
.cart-close {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px; height: 32px;
}
.reservation-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 10px 12px 0;
  background: linear-gradient(135deg, #d1fae5, #ecfdf5);
  border: 1px solid #6ee7b7;
  border-radius: var(--radius-sm);
  color: #065f46;
  position: relative;
  overflow: hidden;
}
.reservation-banner.urgent {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #f59e0b;
  color: #92400e;
}
.reservation-banner.critical {
  background: linear-gradient(135deg, #fecaca, #fca5a5);
  border-color: var(--danger);
  color: #991b1b;
  animation: pulseBanner 1s ease-in-out infinite;
}
@keyframes pulseBanner {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.015); }
}
.reservation-banner .banner-icon {
  font-size: 28px;
  flex-shrink: 0;
  animation: tickTock 2s ease-in-out infinite;
}
@keyframes tickTock {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}
.reservation-banner .banner-text { flex: 1; min-width: 0; }
.reservation-banner .banner-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.reservation-banner .banner-sub {
  font-size: 13px;
  opacity: 0.9;
}
.reservation-banner .countdown-time {
  font-family: 'SF Mono', Menlo, monospace;
  font-weight: 800;
  font-size: 16px;
  background: rgba(255,255,255,0.6);
  padding: 1px 8px;
  border-radius: 6px;
  display: inline-block;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item .thumb {
  width: 70px; height: 70px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  flex-shrink: 0;
  overflow: hidden;
}
.cart-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .info { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cart-item .name { font-size: 14px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-item .price { color: var(--primary-dark); font-weight: 700; font-size: 14px; }
.cart-item .controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.qty-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}
.qty-btn:hover { background: var(--primary-soft); }
.qty-val { min-width: 24px; text-align: center; font-weight: 600; }
.cart-item .remove {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-inline-start: auto;
}
.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.cart-footer {
  border-top: 1px solid var(--border);
  padding: 16px;
  background: var(--bg);
}
.cart-summary {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cart-summary .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  color: var(--text);
}
.cart-summary .row .label { color: var(--text-muted); }
.cart-summary .delivery-row {
  background: var(--accent-soft);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin: 4px 0;
}
.cart-summary .delivery-row .label { color: var(--accent); font-weight: 600; }
.cart-summary .delivery-row .delivery-val { font-weight: 700; color: var(--accent); }
.cart-summary .delivery-hint {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 4px;
  margin-top: -2px;
}
.cart-summary .total-row {
  border-top: 2px dashed var(--border);
  padding-top: 10px;
  margin-top: 4px;
  font-size: 17px;
}
.cart-summary .total-row .label { color: var(--text); font-weight: 600; }
.cart-summary .total-row .total-val {
  font-weight: 800;
  color: var(--primary-dark);
  font-size: 22px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.location-section {
  margin: 12px 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.location-section .btn { font-size: 14px; }
.location-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #6ee7b7;
}
.location-status a { font-size: 12px; }

.delivery-banner {
  background: linear-gradient(90deg, var(--accent-soft), var(--primary-soft));
  border-bottom: 1px solid var(--border);
  padding: 9px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: bannerSlide 0.5s var(--ease);
}
.delivery-banner strong { color: var(--primary-dark); font-weight: 700; }
@keyframes bannerSlide {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 50%;
  transform: translateX(50%);
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ─── Footer ─── */
.site-footer {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 24px 16px;
  margin-top: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Helpers ─── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-muted { color: var(--text-muted); }
.tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* ════════════════════════════════════════════
   تحسينات الموبايل
   ════════════════════════════════════════════ */

/* iOS: منع تكبير الصفحة عند التركيز على input */
input, select, textarea { font-size: 16px; }

/* مساحة آمنة لشاشات iPhone مع notch */
@supports (padding: max(0px)) {
  .site-header .inner {
    padding-inline-start: max(16px, env(safe-area-inset-left));
    padding-inline-end: max(16px, env(safe-area-inset-right));
  }
  .site-footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .detail-actions { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .cart-footer { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* الشاشات الصغيرة (هاتف) */
@media (max-width: 600px) {
  .site-header .inner { padding: 10px 14px; gap: 8px; }
  .brand { font-size: 17px; gap: 8px; }
  .brand-mark { width: 34px; height: 34px; font-size: 16px; }

  .cart-btn { padding: 9px 12px; font-size: 14px; }
  .cart-btn span:nth-child(2) { display: none; } /* إخفاء كلمة "السلة" — تبقى الأيقونة */

  .hero { padding: 20px 14px; }
  .hero h1 { font-size: 19px; line-height: 1.4; }
  .hero p { font-size: 14px; margin-bottom: 12px; }

  .search-bar input { padding: 11px 12px; }
  .search-bar button { padding: 0 14px; font-size: 14px; }

  .cats-nav { padding: 10px 12px; gap: 6px; }
  .cat-pill { padding: 7px 13px; font-size: 13px; }

  .products-grid { gap: 10px; padding: 12px; }
  .product-card .info { padding: 8px 10px 10px; }
  .product-card .name { font-size: 13px; min-height: 2.6em; }
  .product-card .price { font-size: 14px; }
  .product-card .meta { font-size: 11px; }

  .product-detail { margin: 10px; }
  .detail-body { padding: 14px; }
  .detail-body h1 { font-size: 18px; }
  .detail-body .price-big { font-size: 22px; margin-bottom: 12px; }

  .specs-list { padding: 10px; gap: 6px; }
  .specs-list .row { font-size: 13px; }

  .description { padding: 10px; font-size: 14px; }

  /* أزرار اللمس — لا أقل من 44px للوصولية */
  .btn { padding: 12px 18px; min-height: 44px; }
  .qty-btn { width: 32px; height: 32px; }

  .cart-panel { max-width: 100%; }
  .cart-header { padding: 12px 14px; }
  .cart-close { width: 40px; height: 40px; font-size: 28px; }
  .cart-item { gap: 10px; padding: 10px 0; }
  .cart-item .thumb { width: 60px; height: 60px; }
  .cart-item .name { font-size: 13px; }

  .cart-total { font-size: 16px; }
  .cart-total .value { font-size: 19px; }

  .detail-actions { padding: 10px 12px; gap: 8px; }
  .detail-actions .btn { padding: 12px 14px; }
}

/* شاشات صغيرة جداً (تحت 360px) */
@media (max-width: 360px) {
  .products-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 17px; }
  .brand span { display: none; } /* تترك علامة "ق" فقط */
}

/* وضع landscape على الجوال — تقليل الـ hero */
@media (max-width: 900px) and (orientation: landscape) {
  .hero { padding: 14px; }
  .hero h1 { font-size: 18px; margin-bottom: 4px; }
  .hero p { display: none; }
}

/* Toast - slide up animation */
.toast { transform: translateX(50%) translateY(20px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease-bounce); }
.toast.show { transform: translateX(50%) translateY(0); }

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ════════════════════════════════════════════
   نص متدرّج وأيقونات عائمة
   ════════════════════════════════════════════ */

.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.floating-icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.float-icon {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: 28px;
  opacity: 0.4;
  animation: floatBounce 6s var(--ease) infinite;
  animation-delay: var(--d, 0s);
  filter: drop-shadow(0 4px 8px rgba(232,90,113,0.15));
}
@keyframes floatBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-10px) rotate(-5deg); }
  50% { transform: translateY(-4px) rotate(3deg); }
  75% { transform: translateY(-12px) rotate(-2deg); }
}

/* ════════════════════════════════════════════
   البراندات تسبح في الخلفية — مرئية بهدوء بين العناصر
   ════════════════════════════════════════════ */

.brands-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
  user-select: none;
}

.float-brand {
  position: absolute;
  height: 80px;
  width: auto;
  opacity: 0.22;
  filter: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* رفع المحتوى الثابت فوق طبقة البراندات (العناصر العائمة لها z-index خاص) */
.site-header,
.cats-nav,
.view-controls,
main,
.site-footer,
.product-detail { position: relative; z-index: 1; }

/* مواقع البراندات الـ 9 — موزّعة لتغطّي الرؤية بدون تكدّس */
.fb-1 { top: 6%;  left: 4%;  height: 78px; animation: drift1 32s ease-in-out infinite; animation-delay: -2s; }
.fb-2 { top: 14%; right: 6%; height: 60px; animation: drift2 38s ease-in-out infinite; animation-delay: -8s; }
.fb-3 { top: 32%; left: 8%;  height: 70px; animation: drift3 44s ease-in-out infinite; animation-delay: -14s; }
.fb-4 { top: 42%; right: 10%; height: 52px; animation: drift4 36s ease-in-out infinite; animation-delay: -4s; }
.fb-5 { top: 58%; left: 6%;  height: 65px; animation: drift1 40s ease-in-out infinite; animation-delay: -20s; }
.fb-6 { top: 68%; right: 4%; height: 56px; animation: drift2 34s ease-in-out infinite; animation-delay: -10s; }
.fb-7 { top: 80%; left: 14%; height: 70px; animation: drift3 42s ease-in-out infinite; animation-delay: -16s; }
.fb-8 { top: 88%; right: 12%; height: 60px; animation: drift4 30s ease-in-out infinite; animation-delay: -6s; }
.fb-9 { top: 50%; right: 45%; height: 55px; animation: drift1 50s ease-in-out infinite; animation-delay: -24s; }

/* أربع مسارات سباحة فنية مختلفة */
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  20% { transform: translate(35px, -22px) rotate(4deg) scale(1.05); }
  45% { transform: translate(60px, 35px) rotate(-3deg) scale(0.96); }
  70% { transform: translate(15px, 50px) rotate(5deg) scale(1.03); }
  85% { transform: translate(-25px, 18px) rotate(-2deg) scale(1); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  25% { transform: translate(-40px, 30px) rotate(-5deg) scale(0.97); }
  50% { transform: translate(-20px, -28px) rotate(3deg) scale(1.06); }
  75% { transform: translate(28px, -10px) rotate(-2deg) scale(1.02); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  30% { transform: translate(45px, 25px) rotate(6deg) scale(1.04); }
  60% { transform: translate(-30px, 40px) rotate(-4deg) scale(0.98); }
  85% { transform: translate(20px, -15px) rotate(2deg) scale(1.02); }
}
@keyframes drift4 {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  20% { transform: translate(-25px, -20px) rotate(-3deg) scale(1.05); }
  50% { transform: translate(40px, 30px) rotate(4deg) scale(0.96); }
  80% { transform: translate(-15px, 45px) rotate(-5deg) scale(1.02); }
}

/* الموبايل — لوغوات أصغر لكن بنفس البهاء */
@media (max-width: 600px) {
  .float-brand { opacity: 0.18; height: 56px !important; }
  .fb-9 { display: none; }
}

/* احترام تفضيل تقليل الحركة — يبقون لكن بلا حركة */
@media (prefers-reduced-motion: reduce) {
  .float-brand { animation: none !important; }
}

/* ════════════════════════════════════════════
   اختيار طريقة العرض
   ════════════════════════════════════════════ */

.view-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.view-label { color: var(--text-muted); font-weight: 500; }
.view-btns { display: inline-flex; gap: 4px; background: var(--bg); border-radius: 999px; padding: 3px; }
.view-btn {
  background: transparent;
  border: none;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: all 0.2s var(--ease);
}
.view-btn:hover { color: var(--primary); }
.view-btn.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.products-grid {
  --cols: 2;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 14px;
  padding: 16px;
}
.products-grid[data-view="1"] { --cols: 1; }
.products-grid[data-view="2"] { --cols: 2; }
.products-grid[data-view="3"] { --cols: 3; }

@media (max-width: 600px) {
  .products-grid[data-view="3"] { gap: 8px; padding: 8px; }
  .products-grid[data-view="3"] .product-card .name { font-size: 11px; }
  .products-grid[data-view="3"] .product-card .price { font-size: 12px; }
  .products-grid[data-view="3"] .product-card .info { padding: 6px 8px; }
  .products-grid[data-view="1"] .product-card { display: grid; grid-template-columns: 130px 1fr; }
  .products-grid[data-view="1"] .product-card .img-wrap { aspect-ratio: 1; }
  .products-grid[data-view="1"] .product-card .info { padding: 12px; }
  .products-grid[data-view="1"] .product-card .name { font-size: 15px; min-height: 0; -webkit-line-clamp: 3; }

  .brands-label { font-size: 12px; }
  .brand-logo { height: 26px; }
  .brands-track { gap: 24px; }

  .float-icon { font-size: 22px; }
}
