:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #7a7266;
  --gold: #b8914a;
  --gold-dark: #9a7638;
  --line: #ece6dc;
  --radius: 14px;
}

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

body {
  font-family: "Tajawal", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* شريط الإعلان */
.banner {
  background: var(--gold); color: #fff; text-align: center; font-weight: 700;
  padding: 8px 16px; font-size: 0.95rem;
}

/* الهيدر */
.header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250, 248, 245, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }

.btn-outline {
  border: 1px solid var(--text); padding: 8px 18px; border-radius: 999px;
  font-weight: 500; transition: 0.2s; cursor: pointer;
}
.btn-outline:hover { background: var(--text); color: #fff; }

/* الواجهة */
.hero {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2620 100%);
  color: #fff; text-align: center; padding: 90px 0 100px;
}
.hero-kicker { color: var(--gold); font-weight: 700; letter-spacing: 2px; margin-bottom: 8px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); font-weight: 800; line-height: 1.3; }
.hero-sub { color: #cfc6b8; margin: 12px auto 30px; max-width: 480px; }

.btn-gold {
  display: inline-block; background: var(--gold); color: #fff;
  padding: 12px 32px; border-radius: 999px; font-weight: 700; transition: 0.2s;
}
.btn-gold:hover { background: var(--gold-dark); }

/* الفلاتر */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  margin: 40px 0 24px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  font: inherit; border: 1px solid var(--line); background: var(--surface);
  padding: 6px 18px; border-radius: 999px; cursor: pointer; transition: 0.2s;
}
.filter:hover { border-color: var(--gold); }
.filter.active { background: var(--text); color: #fff; border-color: var(--text); }
.sort {
  font: inherit; padding: 7px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
}

/* شبكة المنتجات */
.grid {
  display: grid; gap: 24px; margin-bottom: 70px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); cursor: pointer; transition: 0.25s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,0.08); }
.card-img { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: #f0ebe3; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: 0.4s; }
.card:hover .card-img img { transform: scale(1.04); }
.badge {
  position: absolute; top: 12px; right: 12px; background: #b3261e; color: #fff;
  font-size: 0.8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px;
}
.card-body { padding: 14px 16px 18px; }
.card-cat { color: var(--muted); font-size: 0.85rem; }
.card-name { font-size: 1.1rem; font-weight: 700; margin: 2px 0 6px; }

.price-row { display: flex; align-items: baseline; gap: 10px; }
.price { color: var(--gold-dark); font-weight: 800; font-size: 1.15rem; }
.old-price { color: var(--muted); text-decoration: line-through; font-size: 0.95rem; }

.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 0; }

/* الفوتر */
.footer { border-top: 1px solid var(--line); padding: 28px 0; text-align: center; color: var(--muted); }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 14px; }
.socials:empty { display: none; }
.socials a {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 6px 18px; border-radius: 999px; font-weight: 700; font-size: 0.95rem; transition: 0.2s;
}
.socials a:hover { border-color: var(--gold); color: var(--gold-dark); }

/* النافذة */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.modal-box {
  position: relative; background: var(--surface); border-radius: 18px;
  width: min(900px, 100%); max-height: 92vh; overflow: auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 28px;
}
.modal-close {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); color: var(--text);
  font-size: 1.7rem; line-height: 1; cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,0.25); transition: 0.2s;
}
.modal-close:hover { background: var(--text); color: #fff; }
.modal-gallery img#modalImage { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: #f0ebe3; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs img {
  width: 64px; height: 84px; object-fit: cover; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; opacity: 0.7;
}
.thumbs img.active { border-color: var(--gold); opacity: 1; }
.modal-info { display: flex; flex-direction: column; gap: 12px; padding-top: 10px; }
.modal-info h2 { font-size: 1.6rem; line-height: 1.4; }
.modal-info .price { font-size: 1.5rem; }
.modal-info p { color: #4a443c; }
.tag { align-self: flex-start; background: #f4ede1; color: var(--gold-dark); padding: 2px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; }
.sizes-label { font-weight: 700; margin-top: 4px; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.size {
  font: inherit; min-width: 48px; padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
}
.size.active { background: var(--text); color: #fff; border-color: var(--text); }
.btn-whatsapp {
  margin-top: auto; text-align: center; background: #25d366; color: #fff;
  padding: 13px; border-radius: 12px; font-weight: 700; font-size: 1.05rem; transition: 0.2s;
}
.btn-whatsapp:hover { background: #1ebe5a; }

[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 0.92rem; }
.link-btn {
  font: inherit; background: none; border: none; color: var(--gold-dark);
  cursor: pointer; padding: 0; text-decoration: underline; font-size: 0.92rem;
}

/* الهيدر: السلة */
.header-actions { display: flex; align-items: center; gap: 10px; }
.logo, .header-actions .btn-outline { white-space: nowrap; }
@media (max-width: 360px) {
  .logo { font-size: 1.2rem; }
  .header-actions .btn-outline { display: none; }
}
.cart-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center;
}
.cart-btn:hover { border-color: var(--gold); }
.cart-btn.bump { animation: bump 0.4s; }
@keyframes bump { 50% { transform: scale(1.18); } }
.cart-count {
  position: absolute; top: -4px; left: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--gold); color: #fff; font-size: 0.75rem; font-weight: 700;
  display: grid; place-items: center;
}

/* البحث */
.search {
  display: flex; align-items: center; gap: 8px; margin-top: 36px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px;
  color: var(--muted);
}
.search:focus-within { border-color: var(--gold); }
.search input { flex: 1; border: none; outline: none; font: inherit; padding: 12px 0; background: none; color: var(--text); }
.search + .toolbar { margin-top: 16px; }

/* علامات العبايات */
.label {
  display: inline-block; background: var(--text); color: #fff; font-size: 0.8rem; font-weight: 700;
  padding: 2px 10px; border-radius: 999px;
}
.label.soldout { background: #8a8580; }
.label.on-card { position: absolute; top: 12px; left: 12px; }
.card.is-soldout .card-img img { filter: grayscale(0.7); opacity: 0.75; }
.card-colors { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.tag-row { display: flex; gap: 8px; align-items: center; }

/* معرض الصور */
.gallery-main { position: relative; cursor: zoom-in; touch-action: pan-y; user-select: none; }
.gallery-main img#modalImage { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: #f0ebe3; }
.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.85); color: var(--text); font-size: 1.6rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  direction: ltr; /* عشان المتصفح ما يقلب شكل السهم في الصفحة العربية */
}
.nav-btn.prev { right: 10px; }
.nav-btn.next { left: 10px; }
.img-counter {
  position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.55); color: #fff;
  font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; direction: ltr;
}
.img-counter:empty { display: none; }
.zoom-hint {
  position: absolute; bottom: 10px; left: 10px; background: rgba(0,0,0,0.55); color: #fff;
  font-size: 0.75rem; padding: 2px 10px; border-radius: 999px;
}

.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(10,10,10,0.95); display: flex; align-items: center; justify-content: center; }
.lb-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; transition: transform 0.25s; user-select: none; }
.lb-stage img.zoomed { cursor: zoom-out; transition: transform 0.25s, transform-origin 0s; }
.lb-close { position: absolute; top: 12px; left: 16px; z-index: 2; background: none; border: none; color: #fff; font-size: 2.4rem; cursor: pointer; line-height: 1; }
.lightbox .img-counter { bottom: 18px; right: 50%; transform: translateX(50%); }
.lb-hint { position: absolute; top: 20px; right: 16px; color: #aaa; font-size: 0.85rem; }

/* المقاسات والألوان */
.sizes-head { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.pick-error { color: #b3261e; font-weight: 700; min-height: 1.2em; margin: -4px 0; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.btn-cart {
  font: inherit; font-weight: 700; font-size: 1.05rem; border: none; cursor: pointer;
  background: var(--text); color: #fff; padding: 13px; border-radius: 12px; transition: 0.2s;
}
.btn-cart:hover:not(:disabled) { background: #333; }
.btn-cart:disabled { background: #bdb7ae; cursor: not-allowed; }
.actions .btn-whatsapp { margin-top: 0; }

/* دليل المقاسات */
.modal.small .modal-box { width: min(460px, 100%); display: block; }
.guide-box h2 { margin-bottom: 6px; }
.guide-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.guide-table th, .guide-table td { padding: 10px; text-align: center; border-bottom: 1px solid var(--line); }
.guide-table th { background: #f4ede1; color: var(--gold-dark); font-size: 0.9rem; }

/* السلة */
.drawer { position: fixed; inset: 0; z-index: 60; visibility: hidden; }
.drawer.open { visibility: visible; }
.drawer .modal-backdrop { opacity: 0; transition: opacity 0.25s; }
.drawer.open .modal-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(420px, 100%); background: var(--surface);
  display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 0.25s;
}
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head .modal-close { position: static; }
.cart-items { flex: 1; overflow: auto; padding: 8px 20px; }
.cart-line { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); position: relative; }
.cart-line img, .cart-line .noimg { width: 64px; height: 84px; object-fit: cover; border-radius: 8px; background: #f0ebe3; flex: none; }
.cart-info { flex: 1; min-width: 0; padding-left: 20px; }
.cart-name { font-weight: 700; }
.cart-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cart-row b { color: var(--gold-dark); }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.qty button { width: 30px; height: 30px; border: none; background: none; font-size: 1.1rem; cursor: pointer; }
.qty span { min-width: 22px; text-align: center; font-weight: 700; }
.remove-line { position: absolute; top: 10px; left: 0; border: none; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; }
.drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.total-row { display: flex; justify-content: space-between; font-size: 1.15rem; }
.total-row b { color: var(--gold-dark); }
.drawer-foot .btn-whatsapp { margin-top: 0; }
.drawer-foot .link-btn { align-self: center; color: var(--muted); }

/* رسالة صغيرة */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: #fff; padding: 10px 22px; border-radius: 999px; z-index: 100;
  transition: 0.25s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .modal-box { grid-template-columns: 1fr; padding: 20px; gap: 16px; }
  .header-actions .btn-outline { padding: 7px 12px; font-size: 0.9rem; }
  .lb-hint { display: none; }
  /* على الجوال: زر الإغلاق ثابت فوق الشاشة حتى لو نزلت في التفاصيل */
  .modal .modal-close { position: fixed; top: 22px; left: 22px; }
  .lb-close { width: 44px; height: 44px; background: rgba(255,255,255,0.15); border-radius: 50%; }
  .hero { padding: 60px 0 70px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-body { padding: 10px 12px 14px; }
  .card-name { font-size: 0.98rem; }
}
