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

:root {
  --bg: #fbf8f6;
  --surface: #ffffff;
  --ink: #2d2a2e;
  --muted: #847b80;
  --line: #eee6e2;
  --rose: #c97b84;
  --rose-dark: #a85f69;
  --rose-soft: #f7e9ea;
  --sage: #8fa98f;
  --sage-soft: #eaf1ea;
  --danger: #c0504d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 14px rgba(80, 50, 60, .06);
  --shadow-hover: 0 8px 28px rgba(80, 50, 60, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.8;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--rose); color: #fff; font-weight: 600; cursor: pointer;
  transition: background .2s, transform .1s; white-space: nowrap;
}
.btn:hover { background: var(--rose-dark); }
.btn:active { transform: scale(.98); }
.btn-outline { background: transparent; color: var(--rose-dark); border-color: var(--rose); }
.btn-outline:hover { background: var(--rose-soft); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f4efed; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a33f3c; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.input, select.input, textarea.input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.9; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
label.field small { color: var(--muted); font-weight: 400; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; }
.check input { accent-color: var(--rose); width: 17px; height: 17px; }

/* ---------- header ---------- */
.site-header {
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.header-row { display: flex; align-items: center; gap: 20px; height: 68px; }
.logo { font-size: 24px; font-weight: 800; color: var(--rose-dark); letter-spacing: -.5px; }
.logo span { color: var(--sage); }
.main-nav { display: flex; gap: 4px; }
.main-nav a { padding: 6px 14px; border-radius: 999px; font-weight: 500; color: var(--muted); }
.main-nav a:hover, .main-nav a.active { background: var(--rose-soft); color: var(--rose-dark); }
.search-form { flex: 1; max-width: 420px; margin-inline-start: auto; position: relative; }
.search-form .input { border-radius: 999px; padding-inline-start: 40px; background: var(--bg); }
.search-form svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }

.cat-bar { border-top: 1px solid var(--line); background: #fff; }
.cat-bar .container { display: flex; gap: 8px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none; }
.cat-bar .container::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 13px; white-space: nowrap; color: var(--muted); background: #fff;
}
.chip:hover { border-color: var(--rose); color: var(--rose-dark); }
.chip.active { background: var(--rose); border-color: var(--rose); color: #fff; }
.chip.section-chip { color: var(--ink); font-weight: 600; background: var(--bg); }
.chip.section-chip.active { background: var(--rose); color: #fff; }
.chip-sep { flex: 0 0 1px; background: var(--line); margin: 4px 4px; }
.inline-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------- hero ---------- */
.hero {
  margin: 24px 0; border-radius: 24px; overflow: hidden;
  background: linear-gradient(120deg, var(--rose-soft) 0%, #fdf4ef 50%, var(--sage-soft) 100%);
  padding: 56px 40px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center;
}
.hero h1 { font-size: clamp(26px, 4vw, 40px); line-height: 1.5; margin: 0 0 12px; font-weight: 800; }
.hero p { color: var(--muted); margin: 0 0 24px; max-width: 460px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; }
.hero-art .bubble {
  width: 220px; height: 220px; border-radius: 50%; background: #fff; box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 84px;
}

.section-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 40px; }
.section-card {
  border-radius: var(--radius); padding: 28px; display: flex; justify-content: space-between; align-items: center;
  transition: transform .2s, box-shadow .2s;
}
.section-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.section-card.tone-0 { background: var(--rose-soft); }
.section-card.tone-1 { background: var(--sage-soft); }
.section-card.tone-2 { background: #f8ecf3; }
.section-card.tone-3 { background: #f3eefa; }
.section-card.tone-4 { background: #eaf3f6; }
.section-card h3 { margin: 0 0 4px; font-size: 18px; }
.section-card p { margin: 0; color: var(--muted); font-size: 14px; }
.section-card .emoji { font-size: 40px; flex: 0 0 auto; }
.section-card { padding: 18px; gap: 8px; flex-direction: column-reverse; align-items: flex-start; justify-content: flex-end; }
.section-card p { font-size: 13px; line-height: 1.7; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin: 32px 0 16px; }
.section-head h2 { margin: 0; font-size: 20px; }
.section-head a { color: var(--rose-dark); font-size: 14px; font-weight: 600; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; position: relative;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card-img { aspect-ratio: 1 / 1; background: #f6f0ee; display: grid; place-items: center; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.placeholder { font-size: 48px; opacity: .55; }
.card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-brand { font-size: 12px; color: var(--sage); font-weight: 700; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.7; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 48px; }
.card-price { margin-top: auto; display: flex; flex-direction: column; align-items: flex-end; }
.price { font-weight: 700; font-size: 15px; }
.price-old { text-decoration: line-through; color: var(--muted); font-size: 12px; }
.badge {
  position: absolute; top: 10px; left: 10px; background: var(--rose); color: #fff;
  font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px;
}
.badge.out { background: #9c9396; }
.card.is-out .card-img { filter: grayscale(.6); opacity: .75; }

/* ---------- shop layout ---------- */
.shop-layout { display: grid; grid-template-columns: 260px 1fr; gap: 24px; margin: 24px 0 48px; align-items: start; }
.filters {
  background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  position: sticky; top: 130px; max-height: calc(100vh - 150px); overflow: auto;
}
.filters h3 { font-size: 14px; margin: 0 0 10px; }
.filter-group { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.filter-group:last-of-type { border-bottom: 0; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list a { display: block; padding: 4px 10px; border-radius: 8px; font-size: 14px; color: var(--muted); }
.cat-list a:hover { background: var(--bg); color: var(--ink); }
.cat-list a.active { background: var(--rose-soft); color: var(--rose-dark); font-weight: 600; }
.cat-list .group-title { font-size: 12px; font-weight: 700; color: var(--ink); margin: 8px 0 4px; }
.price-range { display: flex; gap: 8px; }
.price-range .input { padding: 8px 10px; font-size: 13px; }

.shop-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.shop-top h1 { font-size: 20px; margin: 0; }
.shop-top .count { color: var(--muted); font-size: 13px; }
.sort-select { width: auto; border-radius: 999px; padding: 8px 14px; }
.filter-toggle { display: none; }
.empty { text-align: center; padding: 64px 16px; background: #fff; border-radius: var(--radius); }
.empty .emoji { font-size: 48px; }

.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 28px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; display: grid; place-items: center; padding: 0 10px;
  border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 14px;
}
.pagination .current { background: var(--rose); color: #fff; border-color: var(--rose); }

/* ---------- product page ---------- */
.breadcrumb { font-size: 13px; color: var(--muted); margin: 20px 0; }
.breadcrumb a:hover { color: var(--rose-dark); }
.product-main { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; background: #fff; border-radius: 24px; padding: 28px; box-shadow: var(--shadow); }
.gallery-main { aspect-ratio: 1/1; border-radius: var(--radius); overflow: hidden; background: #f6f0ee; display: grid; place-items: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumbs button { width: 68px; height: 68px; flex: 0 0 auto; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: #f6f0ee; }
.thumbs button.active { border-color: var(--rose); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.p-brand { color: var(--sage); font-weight: 700; font-size: 14px; }
.p-title { font-size: 24px; margin: 4px 0 8px; line-height: 1.6; }
.p-short { color: var(--muted); margin: 0 0 16px; }
.p-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tag { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: 13px; }
.tag.green { background: var(--sage-soft); border-color: transparent; color: #4f6f4f; }
.tag.red { background: #fbeceb; border-color: transparent; color: var(--danger); }
.p-price-box { background: var(--bg); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.p-price-box .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.p-price-box .price { font-size: 24px; color: var(--rose-dark); }
.p-price-box .off { background: var(--rose); color: #fff; border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 700; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.features li { display: flex; gap: 8px; align-items: flex-start; }
.features li::before { content: '✓'; color: var(--sage); font-weight: 800; }

.tabs { margin: 24px 0 48px; background: #fff; border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.tab-btns { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab-btns button { background: none; border: 0; padding: 14px 22px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-btns button.active { color: var(--rose-dark); border-color: var(--rose); }
.tab-panel { padding: 24px 28px; white-space: pre-line; }
.spec-table { width: 100%; border-collapse: collapse; white-space: normal; }
.spec-table th, .spec-table td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.spec-table th { width: 160px; color: var(--muted); font-weight: 500; }

/* ---------- footer ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--line); padding: 32px 0; margin-top: 48px; color: var(--muted); font-size: 14px; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- flash ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin: 16px 0; font-weight: 500; }
.flash.success { background: var(--sage-soft); color: #3f6140; }
.flash.error { background: #fbeceb; color: var(--danger); }

/* ---------- ADMIN ---------- */
.admin-body { background: #f6f3f2; }
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-side { background: #fff; border-left: 1px solid var(--line); padding: 24px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.admin-side .logo { margin-bottom: 24px; padding: 0 8px; }
.admin-side nav a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.admin-side nav a:hover { background: var(--bg); color: var(--ink); }
.admin-side nav a.active { background: var(--rose-soft); color: var(--rose-dark); }
.admin-side .bottom { margin-top: auto; font-size: 13px; color: var(--muted); padding: 0 8px; }
.admin-main { padding: 28px; min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-top h1 { margin: 0; font-size: 22px; }
.admin-mobile-bar { display: none; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 16px; margin: 0 0 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: right; color: var(--muted); font-weight: 500; font-size: 13px; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #f6f0ee; display: grid; place-items: center; font-size: 22px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.status { font-size: 12px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; border: 0; cursor: pointer; }
.status.on { background: var(--sage-soft); color: #3f6140; }
.status.off { background: #f0eceb; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer;
  color: var(--muted); transition: border-color .2s, background .2s; display: block;
}
.dropzone:hover, .dropzone.drag { border-color: var(--rose); background: var(--rose-soft); }
.dropzone input { display: none; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 12px; }
.img-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.img-item img { aspect-ratio: 1/1; object-fit: cover; width: 100%; }
.img-item .opts { padding: 6px 8px; font-size: 12px; display: grid; gap: 2px; }
.img-item .opts label { display: flex; gap: 4px; align-items: center; cursor: pointer; }
.img-item.cover { outline: 2px solid var(--rose); }
.sticky-actions { position: sticky; bottom: 0; background: rgba(246,243,242,.95); padding: 14px 0; display: flex; gap: 10px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(135deg, var(--rose-soft), var(--sage-soft)); }
.login-card { background: #fff; width: 100%; max-width: 380px; padding: 32px; border-radius: 24px; box-shadow: var(--shadow-hover); }
.login-card h1 { font-size: 20px; margin: 8px 0 20px; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .main-nav { display: none; }
  .shop-layout { grid-template-columns: 1fr; }
  .filter-toggle { display: inline-flex; }
  .filters {
    position: fixed; inset: 0 0 0 auto; width: min(320px, 88vw); max-height: none; height: 100vh; top: 0;
    border-radius: 0; z-index: 100; transform: translateX(100%); transition: transform .25s;
  }
  .filters.open { transform: translateX(0); box-shadow: -10px 0 40px rgba(0,0,0,.15); }
  .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 90; }
  .product-main { grid-template-columns: 1fr; padding: 16px; gap: 20px; }
  .hero { grid-template-columns: 1fr; padding: 36px 24px; text-align: center; }
  .hero p { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .hero-art { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: fixed; inset: 0 0 0 auto; width: 250px; z-index: 100; transform: translateX(100%); transition: transform .25s; }
  .admin-side.open { transform: translateX(0); box-shadow: -10px 0 40px rgba(0,0,0,.15); }
  .admin-mobile-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); }
  .admin-main { padding: 16px; }
}
@media (max-width: 600px) {
  .header-row { gap: 10px; height: 60px; flex-wrap: nowrap; }
  .logo { font-size: 20px; }
  .search-form { max-width: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 13px; }
  .price { font-size: 14px; }
  .section-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .section-card { padding: 14px; flex-direction: column-reverse; align-items: flex-start; }
  .section-card p { display: none; }
  .section-card h3 { font-size: 15px; }
  .section-card .emoji { font-size: 30px; }
  .p-title { font-size: 20px; }
  .tab-panel { padding: 18px; }
  .spec-table th { width: 110px; }
  .two-col { grid-template-columns: 1fr; }
  .table .hide-sm { display: none; }
}
