:root {
  --bg-page: #0f1115;
  --bg-soft: #181b22;
  --bg-elevated: #1f242d;
  --bg-muted-btn: #252a34;
  --text-main: #f3f4f6;
  --text-sub: #9ca3af;
  --border-light: #262b35;
  --border-strong: #3b4252;
  --btn-primary-bg: #f3f4f6;
  --btn-primary-text: #0f1115;
  --badge-dark: rgba(15, 17, 21, 0.88);
  --badge-gold: #f6b21a;
  --badge-soldout: rgba(75, 85, 99, 0.92);
  --whatsapp-green: #25d366;
  --confirm-green: #22c55e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', sans-serif;
}

body {
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 16px;
}

/* الشريط العلوي */
.top-banner {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* الهيدر والقائمة الرئيسية */
.navbar {
  background-color: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 120;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cube-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.cube-icon img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.2;
}

.logo small {
  color: var(--text-sub);
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
}

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-soft);
  color: var(--text-main);
  font-weight: 600;
  outline: none;
}

.search-box input::placeholder {
  color: var(--text-sub);
}

.search-box input:focus {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.cart-btn {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: 1.5px solid var(--btn-primary-bg);
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.cart-btn:hover {
  background: #e5e7eb;
}

/* شريط التصنيفات */
.categories-bar {
  background: var(--bg-soft);
  border-top: 1px solid var(--border-light);
  padding: 9px 0;
}

.cat-links {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.cat-btn {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  transition: 0.2s;
}

.cat-btn.active,
.cat-btn:hover {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
}

/* البانر الرئيسي */
.hero {
  background: var(--bg-soft);
  padding: 34px 0;
  border-bottom: 1px solid var(--border-light);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 24px;
}

.badge {
  display: inline-block;
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
}

.hero-text h2 {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--text-main);
  margin: 12px 0;
  line-height: 1.3;
}

.hero-text p {
  color: var(--text-sub);
  margin-bottom: 18px;
  font-weight: 600;
}

.btn-primary {
  display: inline-block;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 800;
  transition: 0.2s;
}

.btn-primary:hover {
  background: #e5e7eb;
}

.hero-image img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

/* قسم المنتجات والترتيب */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 26px 0 18px;
}

.section-header h3 {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text-main);
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#productCountText {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-sub);
}

.sort-select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  outline: none;
}

/* شبكة المنتجات: عمودان في الموبايل */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 50px;
}

@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }
}

.product-card {
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.product-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-elevated);
  border-radius: 6px;
  overflow: hidden;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge-top-right,
.badge-top-left,
.badge-bottom-left,
.badge-bottom-right {
  position: absolute;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.25;
  padding: 3px 7px;
  border-radius: 4px;
  z-index: 2;
}

.badge-top-right {
  top: 7px;
  right: 7px;
  background: var(--badge-dark);
  color: #ffffff;
}

.badge-top-left {
  top: 7px;
  left: 7px;
  background: var(--badge-dark);
  color: #ffffff;
}

.badge-bottom-left {
  bottom: 7px;
  left: 7px;
  background: var(--badge-gold);
  color: #111317;
}

.badge-bottom-right {
  bottom: 7px;
  right: 7px;
  background: var(--badge-soldout);
  color: #ffffff;
}

.product-info {
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.brand-tag {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-sub);
}

.product-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 3px 0 8px;
  line-height: 1.35;
  min-height: 36px;
}

.price-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.current-price {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--text-main);
}

.old-price {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-sub);
  text-decoration: line-through;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-buy-now {
  width: 100%;
  padding: 7px 10px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: 1.5px solid var(--btn-primary-bg);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
}

.btn-buy-now:hover {
  background: #e5e7eb;
}

.add-btn {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
}

.add-btn:hover {
  background: var(--bg-muted-btn);
}

.btn-sold-out {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-muted-btn);
  color: var(--text-sub);
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: not-allowed;
}

/* سلة المشتريات */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  z-index: 200;
}

.cart-drawer {
  position: fixed;
  top: 0;
  left: -390px;
  width: 360px;
  max-width: 92vw;
  height: 100vh;
  background: var(--bg-soft);
  color: var(--text-main);
  border-right: 1px solid var(--border-light);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transition: left 0.3s ease;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
}

.cart-drawer.open {
  left: 0;
}

.cart-overlay.open {
  display: block;
}

.cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h3 {
  font-size: 1rem;
  font-weight: 900;
}

.close-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.cart-items {
  flex: 1;
  padding: 12px 16px;
  overflow-y: auto;
}

.empty-msg {
  color: var(--text-sub);
  text-align: center;
  padding: 20px 0;
  font-weight: 600;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding: 8px 0;
  gap: 8px;
}

.cart-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-soft);
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 900;
  margin-bottom: 10px;
}

.checkout-btn {
  width: 100%;
  padding: 10px 12px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: none;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
}

.checkout-btn:hover {
  background: #e5e7eb;
}

/* زر الواتساب العائم */
.whatsapp-float {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--whatsapp-green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.35);
  z-index: 150;
  text-decoration: none;
  transition: transform 0.2s;
}

.whatsapp-float:hover {
  transform: scale(1.06);
}

/* الفوتر */
.footer {
  background: var(--bg-soft);
  text-align: center;
  padding: 22px 16px;
  color: var(--text-sub);
  font-size: 0.88rem;
  font-weight: 600;
  border-top: 1px solid var(--border-light);
}

@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-text h2 {
    font-size: 1.45rem;
  }

  .nav-content {
    padding: 10px 14px;
  }

  .logo h1 {
    font-size: 1.08rem;
  }
}