:root {
  --oud: #9c4517;        /* البرتقالي المحروق - الخطوط الفاصلة والروابط والعناصر المؤكدة */
  --oud-dark: #3e2a1e;    /* البني الداكن - النصوص والعناوين */
  --oud-light: #c16329;   /* برتقالي الجمر - الشريط العلوي والأزرار */
  --gold: #c99749;        /* الذهبي - بداية التدرج والحدود */
  --gold-light: #e2c597;  /* درجة أفتح من الذهبي، للنص على خلفية غامقة */
  --gold-dark: #c57d39;   /* العنبري - الخط التزييني تحت العنوان */
  --cream: #faf5ec;       /* الكريمي - الخلفية الأساسية */
  --ink: #3e2a1e;         /* البني الداكن - النصوص */
  --label: #b35a1f;       /* البرتقالي - أرقام الأعمال والتسميات الصغيرة */
}

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

body {
  font-family: 'Tajawal', Tahoma, Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- الرأس ---------- */

.top {
  background:
    radial-gradient(circle at 10% 25%, rgba(201, 151, 73, 0.28), transparent 36%),
    radial-gradient(circle at 90% 18%, rgba(193, 99, 41, 0.20), transparent 34%),
    radial-gradient(circle at 72% 100%, rgba(156, 69, 23, 0.16), transparent 40%),
    radial-gradient(circle at 30% 105%, rgba(197, 125, 57, 0.18), transparent 34%),
    var(--cream);
  color: var(--ink);
  text-align: center;
  padding: 58px 16px 38px;
  border-bottom: 1px solid rgba(156, 69, 23, 0.22);
  position: relative;
}

.top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark), var(--oud-light), var(--oud));
  pointer-events: none;
}

.top h1 {
  font-family: 'El Messiri', 'Tajawal', Tahoma, sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.5px;
}

.top h1::after {
  content: '';
  display: block;
  width: 96px;
  height: 3px;
  margin: 12px auto 0;
  border-radius: 3px;
  background: var(--gold-dark);
}

.top p {
  margin-top: 14px;
  font-size: 16px;
  color: #6b4a36;
}

/* ---------- المحتوى ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 26px 16px 50px;
}

.search-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto 28px;
}

.search-box {
  flex: 1;
  max-width: 520px;
  margin: 0;
}

.cat-dropdown {
  position: relative;
  flex-shrink: 0;
}

.cat-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 13px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--oud-light), var(--oud));
  border: none;
  border-radius: 30px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.2s;
}

.cat-dropdown-btn:hover {
  filter: brightness(1.1);
}

.cat-dropdown-btn .caret {
  font-size: 11px;
  transition: transform 0.2s;
}

.cat-dropdown.open .cat-dropdown-btn .caret {
  transform: rotate(180deg);
}

.cat-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e6cfae;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(61, 11, 23, 0.18);
  z-index: 50;
  padding: 6px;
}

.cat-dropdown.open .cat-dropdown-menu {
  display: block;
}

.cat-dropdown-item {
  display: block;
  width: 100%;
  text-align: right;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.cat-dropdown-item:hover {
  background: var(--cream);
}

.cat-dropdown-item.active {
  background: linear-gradient(120deg, var(--oud-light), var(--oud));
  color: #fff;
}

.search-box input {
  width: 100%;
  padding: 13px 20px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  border: 2px solid transparent;
  border-radius: 30px;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(90deg, var(--gold), var(--gold-dark), var(--oud-light), var(--oud)) border-box;
  outline: none;
  transition: box-shadow 0.2s;
}

.search-box input:focus {
  box-shadow: 0 0 0 4px rgba(193, 99, 41, 0.18);
}

.cat-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 18px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.cat-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--label);
  background: #fff;
  border: 1.5px solid #e6cfae;
  border-radius: 20px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.cat-tab:hover {
  border-color: var(--gold);
}

.cat-tab.active {
  background: linear-gradient(120deg, var(--oud-light), var(--oud));
  border-color: transparent;
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

/* ---------- بطاقة المنتج ---------- */

.card {
  position: relative;
  background: #fff;
  border: 1px solid #ecd9bd;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(61, 11, 23, 0.07);
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 12px 26px rgba(61, 11, 23, 0.16);
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  min-width: 40px;
  height: 40px;
  line-height: 36px;
  padding: 0 8px;
  border-radius: 20px;
  background: var(--cream);
  border: 2px solid var(--label);
  color: var(--label);
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 3px 8px rgba(62, 42, 30, 0.25);
}

.img-wrap {
  position: relative;
  overflow: hidden;
  height: 270px;
  background: #f1e9da;
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, var(--gold), var(--gold-dark), var(--oud-light), var(--oud)) 1;
  direction: ltr;
}

.img-track {
  display: flex;
  height: 100%;
  transform: translateX(0%);
}

.img-track img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.45s ease;
}

.img-wrap:hover .img-track img {
  cursor: zoom-in;
}

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(61, 11, 23, 0.55);
  color: #fff;
  font-size: 13px;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}

.img-wrap:hover .nav-btn {
  opacity: 1;
}

.nav-btn:hover {
  background: var(--oud);
}

.nav-btn.prev {
  left: 8px;
}

.nav-btn.next {
  right: 8px;
}

.dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 3;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(61, 11, 23, 0.4);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.dot.active {
  background: var(--gold);
  transform: scale(1.25);
}

.count-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  background: rgba(61, 11, 23, 0.6);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.card h3 {
  margin: 14px 12px 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.price {
  color: var(--label);
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 14px;
}

.wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 14px 16px;
  padding: 12px;
  background: linear-gradient(120deg, var(--gold-dark), var(--oud-light) 45%, var(--oud));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  transition: filter 0.2s;
}

.wa-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.wa-btn:hover {
  filter: brightness(1.12);
  color: #fff;
}

.empty {
  text-align: center;
  padding: 40px;
  color: #8a7479;
}

/* ---------- التذييل ---------- */

footer {
  text-align: center;
  padding: 22px 16px;
  background: var(--oud-dark);
  border-top: 6px solid;
  border-image: linear-gradient(90deg, var(--gold), var(--gold-dark), var(--oud-light), var(--oud)) 1;
  color: var(--gold-light);
  font-size: 14px;
}

.admin-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--gold-light);
  opacity: 0.4;
  font-size: 12px;
  text-decoration: none;
}

.admin-link:hover {
  opacity: 0.9;
}

/* ---------- صندوق تكبير الصورة ---------- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(20, 8, 12, 0.94);
  align-items: center;
  justify-content: center;
}

.lightbox.open {
  display: flex;
}

.lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.lb-stage img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.lb-close {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  line-height: 40px;
  cursor: pointer;
}

.lb-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lb-nav.lb-prev {
  right: 16px;
}

.lb-nav.lb-next {
  left: 16px;
}

.lb-zoom-bar {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 8px 16px;
  z-index: 3;
  color: #fff;
}

.lb-zoom-bar button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 18px;
  line-height: 30px;
  cursor: pointer;
}

.lb-zoom-bar button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lb-zoom-bar span {
  min-width: 42px;
  text-align: center;
  font-size: 13px;
}

.lb-count {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 12px;
}

/* ---------- الجوال ---------- */

@media (max-width: 600px) {
  .top {
    padding: 34px 14px 30px;
  }
  .top h1 {
    font-size: 27px;
  }
  .search-row {
    padding: 0 2px;
  }
  .cat-dropdown-btn {
    padding: 11px 12px;
    font-size: 13px;
  }
  .cat-dropdown-menu {
    min-width: 150px;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .img-wrap {
    height: 190px;
  }
  .cat-tab {
    font-size: 13px;
    padding: 7px 14px;
  }
  .nav-btn {
    opacity: 1;
    width: 26px;
    height: 26px;
    font-size: 11px;
    line-height: 26px;
  }
  .lb-nav {
    width: 38px;
    height: 38px;
    font-size: 13px;
  }
  .lb-nav.lb-prev {
    right: 8px;
  }
  .lb-nav.lb-next {
    left: 8px;
  }
  .lb-close {
    top: 8px;
    left: 8px;
    width: 34px;
    height: 34px;
    font-size: 20px;
    line-height: 34px;
  }
  .lb-count {
    top: 10px;
    right: 10px;
  }
  .lb-zoom-bar {
    bottom: 10px;
  }
  .card h3 {
    font-size: 14px;
    margin: 10px 8px 4px;
  }
  .price {
    font-size: 15px;
    margin-bottom: 10px;
  }
  .wa-btn {
    margin: 0 8px 10px;
    padding: 10px 6px;
    font-size: 13px;
    gap: 5px;
  }
  .wa-btn svg {
    width: 16px;
    height: 16px;
  }
  .badge {
    min-width: 32px;
    height: 32px;
    line-height: 28px;
    font-size: 14px;
    top: 8px;
    right: 8px;
  }
}
