@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* پالت اصلی: آبی فیروزه‌ای و آبی (جایگزین قرمز دیجی‌کالا) */
  --brand-teal: #0d9488;
  --brand-teal-dark: #0f766e;
  --brand-blue: #0369a1;
  --brand-blue-light: #0ea5e9;
  --brand-gradient: linear-gradient(90deg, #0e7490, #0d9488);
  --brand-accent-bg: #ccfbf1;

  /* رنگ خطر/هشدار - مستقل از رنگ برند، فقط برای حذف/خطا/ناموجود */
  --danger-red: #e11d48;
  --danger-red-bg: #ffe4e6;

  --bg: #f4f7f8;
  --card-bg: #ffffff;
  --text-dark: #102a2a;
  --text-muted: #64748b;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

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

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 16px;
  flex-wrap: wrap;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-teal-dark);
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.logo-img { height: 38px; width: auto; }

.search-form {
  flex: 1;
  display: flex;
  min-width: 200px;
}
.search-form input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--brand-teal);
  border-left: none;
  border-radius: 6px 0 0 6px;
  font-family: inherit;
  outline: none;
}
.search-form button {
  padding: 10px 18px;
  background: var(--brand-teal);
  color: #fff;
  border: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-outline {
  border: 1px solid var(--brand-teal);
  color: var(--brand-teal-dark);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.cart-link {
  position: relative;
  font-weight: 600;
  white-space: nowrap;
}
.cart-badge {
  position: absolute;
  top: -8px;
  left: -10px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
}

.dropdown { position: relative; cursor: pointer; }
.user-chip { font-weight: 600; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  min-width: 160px;
  padding: 6px 0;
  z-index: 60;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
}
.dropdown-menu a:hover { background: var(--bg); }

.header-nav {
  display: flex;
  gap: 20px;
  padding: 10px 16px;
  overflow-x: auto;
  font-size: 14px;
  font-weight: 500;
  border-top: 1px solid var(--border);
}
.header-nav a:hover { color: var(--brand-teal-dark); }

.page-main { padding: 24px 16px 60px; min-height: 60vh; }

/* ---------- Hero / Banner ---------- */
.hero-banner {
  background: var(--brand-gradient);
  color: #fff;
  border-radius: 12px;
  padding: 40px 32px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.hero-banner h1 { margin: 0 0 8px; font-size: 26px; }
.hero-banner p { margin: 0; opacity: 0.9; }
.hero-banner .btn-yellow {
  background: #fff;
  color: var(--brand-teal-dark);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
}

/* ---------- Category chips ---------- */
.category-chips {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin-bottom: 28px;
}
.category-chip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
}
.category-chip:hover { border-color: var(--brand-teal); color: var(--brand-teal-dark); }

/* ---------- Section titles ---------- */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 16px;
}
.section-title h2 { font-size: 19px; margin: 0; border-right: 4px solid var(--brand-teal); padding-right: 10px; }
.section-title a { color: var(--brand-teal-dark); font-size: 14px; font-weight: 600; }

/* ---------- Product grid & card ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}
.product-card:hover {
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.12);
  transform: translateY(-2px);
}
.product-card img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #f0f0f0;
}
.product-card .title {
  font-size: 14px;
  font-weight: 500;
  min-height: 40px;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .rating { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.price-row { margin-top: auto; }
.price-old {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 12px;
  display: block;
}
.price-new { font-weight: 700; font-size: 16px; color: var(--brand-teal-dark); }
.discount-badge {
  background: var(--brand-accent-bg);
  color: var(--brand-teal-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 4px;
}
.stock-badge { font-size: 12px; color: #16a34a; margin-top: 4px; }
.stock-badge.out { color: var(--danger-red); }

.add-to-cart-btn {
  margin-top: 10px;
  width: 100%;
  background: var(--brand-teal);
  color: #fff;
  border: none;
  padding: 9px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.add-to-cart-btn:hover { background: var(--brand-teal-dark); }
.add-to-cart-btn:disabled { background: #ccc; cursor: not-allowed; }

/* ---------- Filters ---------- */
.filters-bar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.filters-bar select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: inherit;
}

/* ---------- Product detail ---------- */
.product-detail {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 32px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.product-detail img { width: 100%; border-radius: 10px; }
.product-detail h1 { font-size: 22px; margin-top: 0; }
.product-detail .description { color: var(--text-muted); line-height: 1.9; margin: 16px 0; }
.buy-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-top: 20px;
}
.buy-box .price-new { font-size: 22px; }

/* ---------- Forms (auth, checkout, admin) ---------- */
.form-card {
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}
.form-card h1 { text-align: center; font-size: 20px; margin-top: 0; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand-teal);
}
.btn-primary {
  width: 100%;
  background: var(--brand-teal);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
}
.btn-primary:hover { background: var(--brand-teal-dark); }
.form-error {
  background: var(--danger-red-bg);
  color: #9f1239;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}
.form-footer-link { text-align: center; margin-top: 14px; font-size: 14px; }

/* ---------- Cart ---------- */
.cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
.cart-table th, .cart-table td { padding: 14px; border-bottom: 1px solid var(--border); text-align: right; font-size: 14px; }
.cart-table img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }
.cart-table input[type=number] { width: 60px; padding: 6px; border: 1px solid var(--border); border-radius: 6px; }
.cart-summary {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-top: 20px;
  max-width: 360px;
  margin-right: auto;
}
.cart-summary .total-row { display: flex; justify-content: space-between; font-weight: 700; font-size: 17px; margin-bottom: 14px; }

.link-btn {
  background: none;
  border: none;
  color: var(--danger-red);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  text-decoration: underline;
}

/* ---------- Tables (orders / admin lists) ---------- */
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: right; font-size: 14px; }
.data-table th { background: #fafafa; }
.status-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-pending_payment { background: #fff4d6; color: #92640a; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-shipped { background: #e0e7ff; color: #4338ca; }
.status-delivered { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #f1f5f9; color: #475569; }
.status-payment_failed { background: var(--danger-red-bg); color: #9f1239; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ---------- Admin layout ---------- */
.admin-wrapper { display: flex; gap: 24px; }
.admin-sidebar {
  width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  height: fit-content;
}
.admin-sidebar a { display: block; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--brand-accent-bg); color: var(--brand-teal-dark); }
.admin-content { flex: 1; min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .value { font-size: 22px; font-weight: 700; color: var(--brand-teal-dark); }

.btn-small { padding: 6px 12px; font-size: 13px; border-radius: 6px; border: none; cursor: pointer; font-family: inherit; font-weight: 600; }
.btn-small.red { background: var(--danger-red); color: #fff; }
.btn-small.gray { background: #eee; color: #333; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* ---------- Enamad box in footer ---------- */
.enamad-box { margin: 14px 0; display: flex; justify-content: center; }

/* ---------- Footer ---------- */
.site-footer {
  background: #0f2027;
  color: #cbd5e1;
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  margin-top: 40px;
}
.site-footer p { margin: 4px 0; }

@media (max-width: 768px) {
  .product-detail { grid-template-columns: 1fr; }
  .admin-wrapper { flex-direction: column; }
  .admin-sidebar { width: 100%; display: flex; overflow-x: auto; gap: 4px; }
}
