html, body { touch-action: manipulation; }
:root {
  --orange: #ff9900;
  --orange-dark: #e68a00;
  --bg: #f5f5f5;
  --text: #222;
  --white: #fff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }

/* Header */
.header {
  background: #fff;
  padding: 12px 16px;
  border-bottom: 3px solid var(--orange);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-wrap img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.logo-text {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--orange);
}
.star-badge {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #5a3e00;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-btn {
  position: relative;
  padding: 6px;
}
.cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc3545;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-btn, .user-btn {
  padding: 6px 12px;
  background: #f0f0f0;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
}
.search-box {
  margin-top: 10px;
}
.search-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 0.95rem;
}

/* Category bar */
.cat-bar {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #eee;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: #fff8f0;
  border: 1px solid #ffd8a8;
  border-radius: 18px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}
.cat-pill.active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.cat-pill.sub {
  background: #f5f5f5;
  border-color: #ddd;
  font-weight: 500;
}

/* Products grid */
.products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
}
.product-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.product-img {
  height: 140px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.product-img img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}
.product-body {
  padding: 10px;
}
.product-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  height: 2.6em;
  overflow: hidden;
}
.product-price {
  color: #dc3545;
  font-weight: 800;
  font-size: 0.95rem;
  margin: 6px 0;
}
.add-btn {
  width: 100%;
  padding: 8px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
}
.add-btn:disabled { background: #ccc; }

/* Cart page */
.cart-page { padding: 12px; }
.cart-item {
  display: flex;
  gap: 10px;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  align-items: center;
}
.cart-item-img {
  width: 60px;
  height: 60px;
  min-width: 60px;
  background: #f8f8f8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cart-item-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.cart-item-info { flex: 1; }
.cart-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}
.cart-item-price { color: var(--orange); font-weight: 700; font-size: 0.9rem; }
.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 6px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-total {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  text-align: center;
}
.cart-total-amount {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--orange);
}
.checkout-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
  margin-top: 12px;
  text-align: center;
}


/* ========== شريط التصنيفات الكامل ========== */
.cat-slider-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #eeeeee;
  padding: 0 34px;
  height: 50px;
  overflow: hidden;
  box-sizing: border-box;
}
.cat-slider {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  gap: 8px;
  padding: 8px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  white-space: nowrap;
  box-sizing: border-box;
}
.cat-slider::-webkit-scrollbar {
  display: none;
  height: 0;
  width: 0;
}
.cat-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.82rem;
  color: #333333;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  box-sizing: border-box;
}
.cat-chip:hover,
.cat-chip.active {
  background: #ff9900;
  color: #ffffff;
  border-color: #ff9900;
}
.cat-chip.sub {
  background: #f5f5f5;
  font-weight: 500;
  font-size: 0.75rem;
  color: #555555;
  border-color: #e0e0e0;
}
.cat-chip.sub:hover,
.cat-chip.sub.active {
  background: #ff9900;
  color: #ffffff;
  border-color: #ff9900;
}
.cat-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #ff9900;
  color: #ffffff;
  border: none;
  width: 26px;
  height: 26px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cat-arrow:hover {
  background: #e68a00;
}
.cat-arrow.left {
  right: 4px;
}
.cat-arrow.right {
  left: 4px;
}
@media (max-width: 768px) {
  .cat-slider-wrap {
    padding: 0 30px;
    height: 46px;
  }
  .cat-chip {
    padding: 5px 10px;
    font-size: 0.75rem;
  }
  .cat-chip.sub {
    font-size: 0.7rem;
  }
  .cat-arrow {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
}

/* Arrow position fix */
.cat-arrow.left { right: 4px !important; left: auto !important; }
.cat-arrow.right { left: 4px !important; right: auto !important; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff8f0;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}
.user-badge a {
  color: #dc3545;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
}
.btn-ghost {
  background: none;
  border: none;
  color: #333;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
}
.btn-ghost:hover { background: #f0f0f0; }
