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

:root {
  /* v4 palette — dark "command-deck marketplace" tokens. Old variable
     names are kept so the admin panel below picks up the refreshed look
     without any template changes. */
  --bg: #06080c;
  --bg-elev: #0f131a;
  --card: #0f131a;
  --card-hover: #141a23;
  --surface: #0f131a;
  --surface-2: #141a23;
  --surface-3: #1a212c;
  --border: #212936;
  --border-soft: #171d27;
  --text: #f1f4f8;
  --muted: #92a0b2;
  --text-faint: #586475;
  --accent: #00d9ff;
  --accent-2: #1be0a0;
  --accent-violet: #7c6bff;
  --accent-ink: #031519;
  --accent-dim: #0b2730;
  --gold: #ffb937;
  --danger: #ff4571;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.16,1,.3,1);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-feature-settings: 'ss01' 1;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }
main { flex: 1; }

/* =========================================================
   Header — search, nav, account menu (no fake cart/wishlist:
   this storefront is single-product checkout, not a cart, so
   nothing is shown that doesn't actually do something)
   ========================================================= */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 8, 12, .78);
  backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--border-soft);
}
.site-header .bar { display: flex; align-items: center; gap: 18px; height: 66px; }
.brand { font-weight: 800; font-size: 19px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.brand .dot { background: linear-gradient(135deg, var(--accent), var(--accent-violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.site-search { flex: 1; max-width: 420px; }
.site-search form {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 15px; transition: border-color .2s var(--ease);
}
.site-search form:focus-within { border-color: var(--accent); }
.site-search input {
  background: none; border: none; outline: none; flex: 1; min-width: 0;
  color: var(--text); font-family: inherit; font-size: 13.5px;
}
.site-search svg { color: var(--text-faint); flex-shrink: 0; }

nav.main-nav { display: flex; gap: 4px; flex-shrink: 0; }
nav.main-nav a { color: var(--muted); font-weight: 500; font-size: 14px; padding: 8px 12px; border-radius: 9px; transition: all .2s var(--ease); }
nav.main-nav a:hover, nav.main-nav a.active { color: var(--text); background: var(--surface); }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-right: auto; }
.admin-pill { font-size: 12.5px; font-weight: 700; color: var(--accent); background: var(--accent-dim); border: 1px solid rgba(0,214,255,.3); padding: 8px 14px; border-radius: 10px; }

.account-menu { position: relative; }
.account-trigger {
  display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: 13px; padding: 9px 14px; border-radius: 10px;
  cursor: pointer; font-family: inherit; transition: border-color .2s var(--ease);
}
.account-trigger:hover { border-color: var(--accent-dim); color: var(--accent); }
.account-dropdown {
  position: absolute; top: calc(100% + 10px); left: 0; width: 240px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
  z-index: 70;
}
.account-menu.open .account-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.account-dropdown-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.account-dropdown-head .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-dim), var(--surface-3)); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.account-dropdown-head b { font-size: 13px; display: block; }
.account-dropdown-head span { font-size: 11px; color: var(--text-faint); direction: ltr; display: block; text-align: right; }
.ad-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13px; color: var(--muted); transition: all .15s var(--ease); }
.ad-item:hover { background: var(--surface-3); color: var(--text); }
.ad-item svg { flex-shrink: 0; color: var(--text-faint); }
.ad-item.danger:hover { color: var(--danger); }
.ad-sep { height: 1px; background: var(--border-soft); margin: 6px 4px; }
.ad-dropdown-form { margin: 0; }
.ad-dropdown-form button { width: 100%; background: none; border: none; text-align: right; cursor: pointer; }

@media (max-width: 860px) { nav.main-nav, .site-search { display: none; } }

/* =========================================================
   Flash strip (functional discount banner)
   ========================================================= */
.flash-strip { background: linear-gradient(90deg, rgba(0,217,255,.08), rgba(124,107,255,.05)); border-bottom: 1px solid var(--border-soft); }
.flash-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; flex-wrap: wrap; }
.flash-tag { background: var(--danger); color: #fff; font-weight: 800; font-size: 11.5px; padding: 5px 11px; border-radius: 7px; flex-shrink: 0; }
.flash-text { font-size: 13px; color: var(--muted); flex: 1; min-width: 180px; }
.flash-text b { color: var(--text); }

/* =========================================================
   Catalog page head / toolbar
   ========================================================= */
.page-head { padding: 28px 0 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .crumb { font-size: 12px; color: var(--text-faint); margin-bottom: 8px; }
.page-head .crumb .sep { margin: 0 6px; opacity: .5; }
.page-head h1 { font-size: 22px; margin: 0; font-weight: 800; }
.result-count { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }
.result-count b { color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* =========================================================
   Catalog layout: sidebar filters + product grid
   ========================================================= */
.catalog { display: grid; grid-template-columns: 252px 1fr; gap: 26px; padding-bottom: 60px; align-items: start; }
.sidebar { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }
.filter-group { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.filter-group h3 { font-size: 13.5px; margin: 0 0 13px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
.filter-group h3 .clear { font-size: 11.5px; font-weight: 500; color: var(--text-faint); }
.filter-group h3 .clear:hover { color: var(--accent); }
.f-option { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13px; color: var(--muted); cursor: pointer; }
.f-option input { accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.f-option .cnt { margin-right: auto; font-size: 11px; color: var(--text-faint); }
.price-range { display: flex; align-items: center; gap: 8px; }
.price-range input { width: 100%; min-width: 0; font-size: 12.5px; padding: 8px 9px; }
.price-range span { color: var(--text-faint); font-size: 11px; flex-shrink: 0; }
.apply-price { margin-top: 10px; width: 100%; }

@media (max-width: 980px) { .catalog { grid-template-columns: 1fr; } .sidebar { position: static; } }

/* =========================================================
   Product grid (storefront) — pcard
   ========================================================= */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 980px) { .pgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pgrid { grid-template-columns: 1fr; } }

.pcard {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
  position: relative;
}
.pcard:hover { transform: translateY(-4px); border-color: var(--accent-dim); box-shadow: var(--shadow); }
.pcard .thumb { aspect-ratio: 4/3; width: 100%; object-fit: cover; background: #0a0d12; display: block; position: relative; }
.pcard .tags { position: absolute; top: 9px; right: 9px; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.tag { font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 6px; }
.tag.new { background: rgba(0,214,255,.15); color: var(--accent); border: 1px solid rgba(0,214,255,.3); }
.tag.out { background: rgba(88,100,117,.2); color: var(--text-faint); border: 1px solid var(--border); }
.pcard .body { padding: 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.pcard .cat-label { font-size: 10.5px; color: var(--text-faint); }
.pcard h3 { font-size: 14px; font-weight: 700; margin: 0; line-height: 1.5; }
.pcard .price-row { margin-top: auto; padding-top: 8px; }
.pcard .pprice { font-weight: 700; font-size: 15.5px; color: var(--accent-2); }
.pcard .pprice.na { color: var(--text-faint); font-weight: 500; font-size: 12.5px; }
.empty-state { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty-state p { font-size: 13.5px; margin-top: 6px; }

/* =========================================================
   Hero / about blurb (compact, not a decorative landing page)
   ========================================================= */
.intro { padding: 10px 0 0; }
.intro p { color: var(--muted); font-size: 14px; max-width: 680px; line-height: 1.9; margin: 0; }

/* =========================================================
   Buttons / forms (shared by storefront + admin)
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #1fe4ff, #6a7dff); color: var(--accent-ink); font-weight: 700; border: none;
  border-radius: 11px; padding: 12px 22px; cursor: pointer; font-size: 14.5px;
  font-family: inherit; transition: filter .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { border-color: var(--accent-dim); color: var(--accent); filter: none; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { padding: 9px 15px; font-size: 12.5px; border-radius: 9px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
select.select { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: inherit; font-size: 13px; padding: 9px 12px; cursor: pointer; }

.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
input, textarea, select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; color: var(--text); font-family: inherit; font-size: 14px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; max-width: 480px; margin: 50px auto; box-shadow: var(--shadow);
}
.alert { border-radius: 10px; padding: 12px 16px; font-size: 13.5px; margin-bottom: 16px; line-height: 1.8; }
.alert.err { background: rgba(255, 69, 113, 0.12); color: #ff93ae; border: 1px solid rgba(255, 69, 113, 0.3); }
.alert.ok { background: rgba(27, 224, 160, 0.1); color: #7dffcd; border: 1px solid rgba(27, 224, 160, 0.3); }
.form-foot { text-align: center; font-size: 13px; color: var(--text-faint); margin-top: 16px; }
.form-foot a { color: var(--accent); font-weight: 600; }

/* =========================================================
   Product page
   ========================================================= */
.product-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; padding: 36px 0; align-items: start; }
@media (max-width: 860px) { .product-layout { grid-template-columns: 1fr; } }
.gallery-main { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #0a0d12; }
.gallery-main img { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; opacity: .6; }
.gallery-thumbs img:hover { opacity: 1; }
.product-info h1 { font-size: 25px; margin: 0 0 10px; }
.product-info .price-tag { font-size: 23px; font-weight: 700; color: var(--accent-2); margin-bottom: 18px; }
.prose { color: #c3cbd4; line-height: 2; font-size: 14.5px; }
.prose ul { padding-right: 18px; }

/* =========================================================
   Account dashboard
   ========================================================= */
.account-head { display: flex; align-items: center; gap: 14px; padding: 30px 0 10px; }
.account-head .avatar-lg { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-dim), var(--surface-3)); display: grid; place-items: center; font-size: 18px; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.account-head h1 { font-size: 20px; margin: 0; }
.account-head span { font-size: 13px; color: var(--text-faint); direction: ltr; display: block; text-align: right; }
.order-row { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; transition: border-color .2s var(--ease); flex-wrap: wrap; }
.order-row:hover { border-color: var(--accent-dim); }
.order-row .meta b { display: block; font-size: 14px; margin-bottom: 4px; }
.order-row .meta span { font-size: 12px; color: var(--text-faint); }
.order-row .right { display: flex; align-items: center; gap: 12px; }

/* =========================================================
   Admin
   ========================================================= */
.admin-shell { display: flex; min-height: calc(100vh - 66px); gap: 0; }
.admin-sidebar { width: 220px; border-left: 1px solid var(--border); padding: 24px 12px; flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 10px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; margin-bottom: 4px; position: relative; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--card); color: var(--text); }
.admin-sidebar .dot-badge { background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px; margin-right: 6px; }
.admin-content { flex: 1; padding: 28px; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: right; }
table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.status-pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.status-pill.paid, .status-pill.delivered { background: rgba(27,224,160,.12); color: #7dffcd; }
.status-pill.pending { background: rgba(255,185,55,.12); color: #ffd98f; }
.status-pill.failed { background: rgba(255,69,113,.12); color: #ff93ae; }
.stat-row { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; min-width: 160px; }
.stat .num { font-size: 24px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* =========================================================
   Footer
   ========================================================= */
footer.site-footer { border-top: 1px solid var(--border-soft); margin-top: auto; padding-top: 44px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; padding-bottom: 28px; }
.foot-col h4 { font-size: 13px; margin: 0 0 13px; color: var(--text); }
.foot-col a, .foot-col p { display: block; font-size: 12.5px; color: var(--text-faint); margin: 0 0 9px; transition: color .2s var(--ease); }
.foot-col a:hover { color: var(--accent); }
.foot-bottom { border-top: 1px solid var(--border-soft); padding: 18px 0 26px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-faint); flex-wrap: wrap; gap: 10px; }
@media (max-width: 860px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .foot-grid { grid-template-columns: 1fr; } }
