* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 12px;
}

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 15px;
}

.container { max-width: 1150px; margin: 0 auto; padding: 0 16px; }

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 20px; flex-wrap: wrap;
}
.logo { font-size: 22px; font-weight: 700; color: var(--primary); text-decoration: none; }
.main-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.main-nav a { color: var(--text); text-decoration: none; font-size: 15px; transition: color .2s; }
.main-nav a:hover { color: var(--primary); }
.admin-link { color: var(--primary); font-weight: 600; }
.user-name { color: var(--muted); font-size: 14px; }
.badge { background: var(--primary); color: #fff; border-radius: 20px; padding: 1px 8px; font-size: 12px; margin-right: 4px; }
.btn-small { background: var(--primary); color: #fff !important; padding: 6px 14px; border-radius: 8px; font-size: 14px; }

.main-content { padding: 30px 16px 60px; min-height: 65vh; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; }
.alert.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert.error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.hero {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; border-radius: var(--radius);
  padding: 36px 28px; margin-bottom: 30px;
}
.hero h1 { font-size: 26px; margin-bottom: 8px; }
.hero p  { opacity: .9; font-size: 15px; }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 24px; }
.toolbar form { display: flex; gap: 10px; flex: 1; min-width: 260px; }
.toolbar input[type=text], .toolbar select {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 14px; background: #fff; outline: none;
}
.toolbar input[type=text] { flex: 1; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }

.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0,0,0,.08); }
.card-img {
  height: 170px; background: #eef2ff; display: flex;
  align-items: center; justify-content: center;
  font-size: 42px; font-weight: 700; color: #a5b4fc; overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 15px; font-weight: 600; }
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { color: var(--primary); }
.card-cat { font-size: 12px; color: var(--muted); }
.card-price { font-size: 16px; font-weight: 700; color: var(--primary); margin-top: auto; }
.stock-out { color: var(--danger); font-size: 13px; }
.stock-in  { color: var(--success); font-size: 13px; }

.btn {
  display: inline-block; padding: 10px 18px; border-radius: 10px;
  background: var(--primary); color: #fff; text-decoration: none;
  border: none; cursor: pointer; font-family: inherit; font-size: 14px;
  transition: background .2s; text-align: center;
}
.btn:hover { background: var(--primary-dark); }
.btn.full { width: 100%; }
.btn.outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.outline:hover { background: #eef2ff; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.gray { background: #6b7280; }
.btn.gray:hover { background: #4b5563; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.form-box {
  background: #fff; border-radius: var(--radius); padding: 28px;
  border: 1px solid var(--border); max-width: 520px; margin: 0 auto;
}
.form-box h2 { margin-bottom: 22px; font-size: 20px; text-align: center; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-family: inherit; font-size: 14px; outline: none;
  background: #fff; transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { min-height: 110px; resize: vertical; }
.form-footer { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.form-footer a { color: var(--primary); text-decoration: none; }

.product-detail {
  display: grid; grid-template-columns: 1fr 1fr; gap: 34px;
  background: #fff; border-radius: var(--radius); padding: 28px;
  border: 1px solid var(--border);
}
.product-detail .big-img {
  height: 340px; background: #eef2ff; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; color: #a5b4fc; overflow: hidden;
}
.product-detail .big-img img { width: 100%; height: 100%; object-fit: cover; }
.product-detail h1 { font-size: 24px; margin-bottom: 12px; }
.product-detail .price { font-size: 26px; color: var(--primary); font-weight: 700; margin: 18px 0; }
.product-detail .desc { color: var(--muted); margin-bottom: 22px; line-height: 2; }
.qty-row { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.qty-row input { width: 80px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; text-align: center; }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 13px 14px; text-align: right; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: #f9fafb; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat { background: #fff; padding: 22px; border-radius: var(--radius); border: 1px solid var(--border); text-align: center; }
.stat .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat .lbl { font-size: 14px; color: var(--muted); margin-top: 6px; }

.section-title { font-size: 20px; margin: 30px 0 18px; border-right: 4px solid var(--primary); padding-right: 10px; }

.site-footer { background: #fff; border-top: 1px solid var(--border); padding: 22px 0; text-align: center; color: var(--muted); font-size: 14px; }

.status { padding: 3px 10px; border-radius: 20px; font-size: 12px; display: inline-block; }
.status.pending  { background: #fef3c7; color: #92400e; }
.status.paid     { background: #dbeafe; color: #1e40af; }
.status.sent     { background: #dcfce7; color: #166534; }
.status.canceled { background: #fee2e2; color: #991b1b; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 16px; }

@media (max-width: 720px) {
  .product-detail { grid-template-columns: 1fr; }
  .header-inner { height: auto; padding: 12px 0; }
  .main-nav { gap: 12px; font-size: 14px; }
}