:root {
  --green: #16c86e;
  --green-dark: #0fa85a;
  --black: #121212;
  --grey-bg: #f4f4f5;
  --grey-border: #e2e2e5;
  --text: #1a1a1a;
  --muted: #7a7a7a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: #fff;
  color: var(--text);
  direction: rtl;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--grey-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  max-width: 1200px;
  margin: 0 auto;
}
.logo {
  font-size: 24px;
  font-weight: 800;
  color: var(--black);
  letter-spacing: 0.5px;
}
.icon-btn {
  background: none;
  border: none;
  font-size: 20px;
  position: relative;
  padding: 6px;
  color: var(--black);
}
.cart-count {
  position: absolute;
  top: -2px;
  left: -2px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.search-bar {
  display: flex;
  max-width: 1200px;
  margin: 0 auto 12px;
  padding: 0 16px;
  gap: 8px;
}
.search-bar input {
  flex: 1;
  background: var(--grey-bg);
  border: 1px solid var(--grey-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
}
.search-bar button {
  background: var(--grey-bg);
  border: 1px solid var(--grey-border);
  border-radius: var(--radius);
  padding: 0 16px;
}
.cat-nav {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 0 16px 12px;
  max-width: 1200px;
  margin: 0 auto;
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav a {
  white-space: nowrap;
  font-size: 14px;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.cat-nav a:hover, .cat-nav a.active {
  color: var(--black);
  border-color: var(--green);
}

/* ---------- Layout ---------- */
.site-main { max-width: 1200px; margin: 0 auto; padding: 0 16px 60px; }
.section { margin: 32px 0; }
.section-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 16px;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  border-radius: 16px;
  padding: 36px 24px;
  color: #fff;
  margin: 20px 0 32px;
  text-align: center;
}
.hero h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 8px;
}
.hero p { margin: 0; opacity: 0.9; font-size: 14px; }

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.product-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.product-scroll::-webkit-scrollbar { display: none; }
.product-scroll .product-card { min-width: 170px; flex: 0 0 auto; }

.product-card {
  border: 1px solid var(--grey-border);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.product-card:hover {
  border-color: var(--green);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.badge-fast {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(22,200,110,0.12);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}
.product-thumb {
  aspect-ratio: 1 / 1;
  background: var(--grey-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #c4c4c8;
  margin-bottom: 10px;
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 8px;
  flex: 1;
  color: var(--text);
}
.product-price {
  font-weight: 800;
  font-size: 14.5px;
}
.product-price .old {
  text-decoration: line-through;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  display: block;
  margin-bottom: 2px;
}
.stock-out {
  color: #d33;
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Product detail ---------- */
.product-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 24px;
}
@media (min-width: 768px) {
  .product-detail { grid-template-columns: 1fr 1fr; }
}
.pd-thumb {
  background: var(--grey-bg);
  border-radius: 16px;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  color: #c4c4c8;
  overflow: hidden;
}
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pd-title { font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.pd-sku { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.pd-price { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.pd-price .old { text-decoration: line-through; color: var(--muted); font-size: 15px; font-weight: 400; margin-inline-start: 8px;}
.pd-stock { margin-bottom: 20px; font-size: 13px; }
.pd-stock.ok { color: var(--green-dark); }
.pd-stock.out { color: #d33; }
.pd-desc { line-height: 1.9; color: #444; margin-bottom: 24px; font-size: 14.5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--black);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: #000; }
.btn-green { background: var(--green); }
.btn-green:hover { background: var(--green-dark); }
.btn-block { width: 100%; }
.btn-outline {
  background: #fff;
  color: var(--black);
  border: 1px solid var(--grey-border);
}
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cart page ---------- */
.cart-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--grey-border);
}
.cart-row .thumb {
  width: 64px; height: 64px;
  background: var(--grey-bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #c4c4c8;
  overflow: hidden; flex-shrink: 0;
}
.cart-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-row .info { flex: 1; min-width: 0; }
.cart-row .info .name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.cart-row .info .unit-price { font-size: 12.5px; color: var(--muted); }
.qty-control {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--grey-border); border-radius: 8px; padding: 4px;
}
.qty-control button {
  width: 26px; height: 26px; border: none; background: var(--grey-bg); border-radius: 6px; font-size: 15px;
}
.qty-control span { min-width: 18px; text-align: center; font-size: 13px; }
.remove-link { color: #d33; font-size: 12.5px; margin-top: 6px; display: inline-block; }
.cart-summary {
  background: var(--grey-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}
.cart-summary .row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.cart-summary .total { font-weight: 800; font-size: 17px; border-top: 1px solid var(--grey-border); padding-top: 12px; margin-top: 8px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---------- Checkout form ---------- */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.form-field input, .form-field textarea {
  width: 100%;
  border: 1px solid var(--grey-border);
  border-radius: 8px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
}
.form-field textarea { resize: vertical; min-height: 80px; }

/* ---------- Misc pages ---------- */
.page-title { font-size: 21px; font-weight: 800; margin: 24px 0 16px; }
.success-box {
  text-align: center;
  padding: 50px 20px;
}
.success-box .icon { font-size: 48px; color: var(--green); margin-bottom: 12px; }
.order-number { font-family: monospace; background: var(--grey-bg); padding: 6px 14px; border-radius: 8px; display: inline-block; margin: 10px 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--black);
  color: #ccc;
  margin-top: 40px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 16px;
  text-align: center;
}
.footer-brand { color: #fff; font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.footer-links { display: flex; gap: 18px; justify-content: center; margin: 16px 0; flex-wrap: wrap; }
.footer-links a { color: #aaa; font-size: 13.5px; }
.footer-links a:hover { color: var(--green); }
.footer-copy { font-size: 12px; color: #777; margin-top: 10px; }

/* ---------- Admin ---------- */
.admin-body { background: var(--grey-bg); min-height: 100vh; font-family: 'Vazirmatn', sans-serif; direction: rtl; }
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; background: #fff; padding: 14px 20px; border-radius: 10px;
  border: 1px solid var(--grey-border);
}
.admin-nav { display: flex; gap: 16px; }
.admin-nav a { font-size: 14px; color: var(--muted); }
.admin-nav a.active, .admin-nav a:hover { color: var(--green-dark); font-weight: 700; }
.admin-card { background: #fff; border: 1px solid var(--grey-border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th, .admin-table td { padding: 10px; border-bottom: 1px solid var(--grey-border); text-align: right; }
.admin-table th { color: var(--muted); font-weight: 600; }
.login-box { max-width: 360px; margin: 80px auto; background: #fff; border-radius: 12px; padding: 30px; border: 1px solid var(--grey-border); }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: #fde8e8; color: #c22; }
.alert-success { background: #e6f9ee; color: #0f9a53; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.status-pill { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-pending { background: #fff3cd; color: #916a00; }
.status-confirmed { background: #e6f9ee; color: #0f9a53; }
.status-shipped { background: #e6f0f9; color: #1a5fb4; }
.status-cancelled { background: #fde8e8; color: #c22; }

/* ---------- Mobile menu ---------- */
.menu-toggle { display: none; }
@media (max-width: 640px) {
  .menu-toggle { display: inline-block; }
  .cat-nav.hidden-mobile { display: none; }
}
