@import url("tokens.css");

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn[wght].woff2") format("woff2-variations"),
       url("../fonts/Vazirmatn[wght].woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

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

body {
  font-family: var(--font-base);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--fs-md);
  line-height: 1.6;
}

h1, h2, h3 { letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); line-height: 1.4; }

a { color: inherit; text-decoration: none; }

/* button */
.btn {
  display: inline-block;
  background: var(--button-bg);
  color: var(--button-fg);
  border: none;
  border-radius: var(--button-radius);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s var(--ease), background .15s var(--ease);
}
.btn:hover { background: var(--button-bg-hover); }
.btn:active { background: var(--button-bg-active); transform: scale(.97); }
.btn:disabled { background: var(--zinc-700); color: var(--color-text-faint); cursor: not-allowed; }

/* card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: var(--card-padding);
}

/* input */
.input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--input-fg);
  border-radius: var(--input-radius);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-md);
  font-family: inherit;
  width: 100%;
  transition: border-color .15s var(--ease);
}
.input::placeholder { color: var(--color-text-faint); }
.input:focus { outline: none; border-color: var(--color-primary); }

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4) var(--sp-5);
  background: rgba(11,11,13,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.site-header h1 { font-size: var(--fs-xl); }

/* search */
.search-wrap { position: relative; margin-bottom: var(--sp-5); }
.search-wrap .input { padding-inline-end: var(--sp-6); }
.search-wrap svg {
  position: absolute;
  inset-inline-end: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
}

/* filters */
.filter-bar {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.filter-bar select.input {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
}

/* product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}
.product-card {
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  opacity: 0;
  animation: rise .5s var(--ease) forwards;
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.product-card:hover { transform: translateY(-3px); border-color: var(--zinc-600); }
.product-card:active { transform: translateY(-3px) scale(.98); }
.product-card .thumb {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--zinc-800);
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-card h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(var(--fs-lg) * 1.4 * 2);
}
.product-card .price {
  color: var(--color-primary);
  font-weight: 700;
  font-size: var(--fs-sm);
  margin-top: auto;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.product-grid .product-card:nth-child(1) { animation-delay: 0ms; }
.product-grid .product-card:nth-child(2) { animation-delay: 40ms; }
.product-grid .product-card:nth-child(3) { animation-delay: 80ms; }
.product-grid .product-card:nth-child(4) { animation-delay: 120ms; }
.product-grid .product-card:nth-child(n+5) { animation-delay: 160ms; }

/* skeleton loading */
.skeleton-card { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3); }
.skeleton-box {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--zinc-800) 25%, var(--zinc-700) 50%, var(--zinc-800) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-box.thumb { aspect-ratio: 1 / 1; }
.skeleton-box.line { height: 14px; width: 70%; }
.skeleton-box.line.short { width: 40%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-6);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}
.pagination .btn { padding: var(--sp-2) var(--sp-4); }
.pagination .btn:disabled { opacity: .4; }

/* bottom navigation */
body { padding-bottom: 76px; }
.bottom-nav {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 20;
  display: flex;
  background: rgba(11,11,13,.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) 0;
  background: none;
  border: none;
  color: var(--color-text-faint);
  font-family: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: color .15s var(--ease);
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--color-primary); }
.nav-item:active { transform: scale(.95); }

/* orders */
.order-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.order-card .order-id { color: var(--color-text-faint); font-size: var(--fs-xs); }
.order-card .order-total { color: var(--color-primary); font-weight: 700; }
.order-card .order-status {
  display: inline-block;
  font-size: var(--fs-xs);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  background: var(--zinc-800);
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
}

/* empty / error state */
.state-msg {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-text-faint);
  padding: var(--sp-8) var(--sp-4);
  font-size: var(--fs-sm);
}
