/* پکینو — پک‌ساز. از ویژگی‌های منطقی (inline-start/end) استفاده شده تا در RTL و LTR درست باشد. */
.pakino {
  --pk-primary: #7c3aed;
  --pk-ink: #1f2330;
  --pk-muted: #6b7180;
  --pk-line: #e7e8ee;
  --pk-bg: #fff;
  --pk-soft: #f3f0fb;
  --pk-ok: #15803d;
  --pk-radius: 14px;
  color: var(--pk-ink);
  font-size: 15px;
  line-height: 1.7;
  margin: 0 auto 32px;
  max-width: 1240px;
  position: relative;
}
@supports (color: color-mix(in srgb, red 50%, white)) {
  .pakino { --pk-soft: color-mix(in srgb, var(--pk-primary) 9%, #fff); }
}
.pakino *, .pakino *::before, .pakino *::after { box-sizing: border-box; }
.pakino button { font: inherit; cursor: pointer; margin: 0; min-height: 0; line-height: 1.5; text-transform: none; letter-spacing: normal; box-shadow: none; vertical-align: middle; }
.pakino select, .pakino input[type="search"] { margin: 0; min-height: 0; height: auto; box-shadow: none; }
.pakino button:disabled { cursor: not-allowed; }
.pakino img { max-width: 100%; display: block; }
.pakino-skeleton { height: 420px; border-radius: var(--pk-radius); background: linear-gradient(90deg, #f3f4f7 25%, #eceef2 50%, #f3f4f7 75%); background-size: 200% 100%; animation: pk-shimmer 1.2s infinite; }
.pakino.is-ready .pakino-skeleton { display: none; }
@keyframes pk-shimmer { to { background-position: -200% 0; } }
.pakino-closed { padding: 18px; border: 1px dashed #d0d3db; border-radius: 12px; text-align: center; color: #6b7180; }

/* سربرگ */
.pk-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pk-title { margin: 0; font-size: clamp(20px, 2.6vw, 28px); line-height: 1.4; }
.pk-intro { margin: 4px 0 0; color: var(--pk-muted); }
.pk-countdown { background: #fff4e5; color: #9a3412; border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.pk-countdown b { font-variant-numeric: tabular-nums; }

/* پله‌ها */
.pk-tiers { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pk-tiers li { flex: 0 0 auto; display: flex; flex-direction: column; padding: 8px 14px; border-radius: 12px; background: #f5f6f9; border: 1px solid transparent; min-width: 120px; transition: .25s; }
.pk-tiers li b { font-size: 12px; color: var(--pk-muted); font-weight: 500; }
.pk-tiers li span { font-weight: 700; }
.pk-tiers li.is-on { background: var(--pk-soft); border-color: var(--pk-primary); }
.pk-tiers li.is-on b { color: var(--pk-primary); }
.pk-tiers li.is-on span::after { content: " ✓"; color: var(--pk-primary); }

.pk-note { background: #eef6ff; color: #1e40af; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }

/* چیدمان */
.pk-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.pk-side { position: sticky; top: 90px; background: var(--pk-bg); border: 1px solid var(--pk-line); border-radius: var(--pk-radius); padding: 18px; box-shadow: 0 6px 24px rgba(20, 24, 40, .06); max-height: calc(100vh - 110px - var(--pk-bottom, 0px)); overflow-y: auto; overflow-x: hidden; }
.pk-side__head { display: flex; align-items: center; justify-content: space-between; }
.pk-side h3 { margin: 0 0 10px; font-size: 18px; }
.pk-side h3 .pk-count { color: var(--pk-muted); font-size: 14px; font-weight: 400; }
.pk-close { display: none; background: none; border: 0; font-size: 18px; color: var(--pk-muted); }

/* ابزارها */
.pk-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.pk-search { width: 100%; border: 1px solid var(--pk-line); border-radius: 10px; padding: 10px 14px; font: inherit; background: #fafbfc; }
.pk-search:focus { outline: 2px solid var(--pk-primary); outline-offset: 1px; background: #fff; }
.pk-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 2px; }
.pk-chip { flex: 0 0 auto; white-space: nowrap; border: 1px solid var(--pk-line); background: #fff; border-radius: 999px; padding: 5px 14px; font-size: 14px; color: var(--pk-ink); }
.pk-chip[aria-pressed="true"] { background: var(--pk-primary); border-color: var(--pk-primary); color: #fff; }

/* مراحل */
.pk-steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; gap: 6px; overflow-x: auto; }
.pk-step { display: flex; align-items: center; gap: 6px; border: 1px solid var(--pk-line); background: #fff; border-radius: 999px; padding: 5px 12px 5px 14px; white-space: nowrap; font-size: 14px; color: var(--pk-ink); }
.pk-step__n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #eef0f4; font-size: 12px; }
.pk-step em { font-style: normal; color: var(--pk-muted); }
.pk-step.is-current { border-color: var(--pk-primary); background: var(--pk-soft); }
.pk-step.is-current .pk-step__n { background: var(--pk-primary); color: #fff; }
.pk-step.is-done .pk-step__n { background: var(--pk-ok); color: #fff; }
.pk-step.is-skipped { color: var(--pk-muted); text-decoration: line-through; }
.pk-stephead { margin-bottom: 10px; color: var(--pk-muted); }
.pk-stephead strong { color: var(--pk-ink); font-size: 18px; }
.pk-stephead small { color: #b45309; display: block; }
.pk-opt { font-style: normal; font-size: 12px; background: #f1f2f5; border-radius: 6px; padding: 1px 8px; }
.pk-stepnav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

/* شبکهٔ محصولات */
.pk-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.pk-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--pk-line); border-radius: var(--pk-radius); overflow: hidden; transition: border-color .2s, box-shadow .2s, transform .2s; }
.pk-card:hover { box-shadow: 0 8px 22px rgba(20, 24, 40, .08); transform: translateY(-2px); }
.pk-card.is-picked { border-color: var(--pk-primary); box-shadow: 0 0 0 1px var(--pk-primary); }
.pk-card__img { position: relative; aspect-ratio: 1 / 1; background: #f6f7f9; }
.pk-card__img img { width: 100%; height: 100%; object-fit: cover; }
.pk-sale { position: absolute; top: 8px; inset-inline-start: 8px; background: #dc2626; color: #fff; font-size: 11px; border-radius: 6px; padding: 1px 7px; }
.pk-badge-n { position: absolute; z-index: 2; top: 8px; inset-inline-end: 8px; min-width: 26px; height: 26px; border-radius: 13px; background: var(--pk-primary); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; padding: 0 6px; }
.pk-card__body { padding: 10px 12px 4px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pk-card__name { color: var(--pk-ink); text-decoration: none; font-size: 14px; font-weight: 600; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.2em; }
.pk-card__name:hover { color: var(--pk-primary); }
.pk-var { width: 100%; border: 1px solid var(--pk-line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; background: #fff; }
.pk-card__price { font-weight: 700; }
.pk-card__price del { color: var(--pk-muted); font-weight: 400; font-size: 13px; }
.pk-flag { color: #b45309; font-size: 12px; }
.pk-add { margin: 8px 12px 12px; border: 0; border-radius: 10px; padding: 8px; background: var(--pk-soft); color: var(--pk-primary); font-weight: 700; transition: .2s; }
.pk-add:hover:not(:disabled) { background: var(--pk-primary); color: #fff; }
.pk-add:disabled { opacity: .45; }
.pk-add.is-in { background: var(--pk-primary); color: #fff; }
.pk-loading, .pk-empty { grid-column: 1 / -1; text-align: center; color: var(--pk-muted); padding: 40px 0; }
.pk-more { text-align: center; margin-top: 16px; }

/* دکمه‌ها */
.pk-btn { border: 0; border-radius: 12px; padding: 12px 18px; background: var(--pk-primary); color: #fff; font-weight: 700; transition: filter .2s, opacity .2s; }
.pk-btn:hover:not(:disabled) { filter: brightness(1.08); }
.pk-btn:disabled { opacity: .45; }
.pk-btn--ghost { background: #fff; color: var(--pk-ink); border: 1px solid var(--pk-line); font-weight: 500; }

/* نوار پیشرفت */
.pk-progress { margin: 4px 0 12px; }
.pk-bar { height: 8px; border-radius: 4px; background: #eef0f4; overflow: hidden; }
.pk-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pk-primary), color-mix(in srgb, var(--pk-primary) 60%, #fff)); border-radius: 4px; transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.pk-msg { margin: 6px 0 0; font-size: 14px; color: var(--pk-ink); min-height: 1.7em; }
.pk-msg b { color: var(--pk-primary); }

/* جعبه */
.pk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 12px; }
.pk-slot { aspect-ratio: 1; border: 2px dashed #d5d8df; border-radius: 10px; overflow: hidden; }
.pk-slot.is-full { border: 2px solid var(--pk-primary); animation: pk-in .3s ease; }
.pk-slot img { width: 100%; height: 100%; object-fit: cover; }
.pk-slots p { grid-column: 1 / -1; margin: 2px 0 0; font-size: 13px; color: var(--pk-muted); }
@keyframes pk-in { from { transform: scale(.6); opacity: 0; } }

/* اقلام انتخاب‌شده */
.pk-picked { list-style: none; margin: 0 0 12px; padding: 0 0 0 2px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; }
/* دسکتاپ: ستون خلاصه انعطاف‌پذیر است؛ فقط فهرست اقلام اسکرول می‌شود و جمع و دکمه همیشه دیده می‌شوند. */
@media (min-width: 861px) {
  .pk-side { display: flex; flex-direction: column; }
  .pk-side > * { flex: 0 0 auto; }
  .pk-side > .pk-picked { flex: 1 1 auto; min-height: 64px; }
}
.pk-picked li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; animation: pk-in .25s ease; }
.pk-picked img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #f3f4f7; }
.pk-picked__info { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.6; }
.pk-picked__name { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pk-picked__info small { color: var(--pk-muted); }
.pk-picked__price del { color: var(--pk-muted); }
.pk-picked__empty { display: block !important; color: var(--pk-muted); font-size: 14px; text-align: center; padding: 12px 0; border: 1px dashed var(--pk-line); border-radius: 10px; }
.pk-qty { display: flex; align-items: center; gap: 4px; }
.pk-qty button { width: 24px; height: 24px; border-radius: 8px; border: 1px solid var(--pk-line); background: #fff; line-height: 1; padding: 0; }
.pk-qty span { min-width: 18px; text-align: center; font-size: 13px; }
.pk-qty .pk-x { border: 0; color: #9ca3af; }
.pk-qty .pk-x:hover { color: #dc2626; }

/* اقلام فعلی سبد */
.pk-incart { background: #f6f8fb; border: 1px dashed #d6dbe4; border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; font-size: 13px; }
.pk-incart__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.pk-incart__head a, .pk-incart__note a { font-size: 12px; color: var(--pk-primary); text-decoration: none; white-space: nowrap; }
.pk-incart ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; }
.pk-incart li { display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center; }
.pk-incart img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.pk-incart__name { line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pk-incart__name small { color: var(--pk-muted); }
.pk-incart__price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pk-incart__price del { color: var(--pk-muted); display: block; font-size: 11px; }
.pk-incart__hint, .pk-incart__note { margin: 6px 0 0; color: var(--pk-muted); font-size: 12px; line-height: 1.7; }
.pk-incart__note { margin: 0; }

/* جمع */
.pk-sum { margin: 0; border-top: 1px solid var(--pk-line); padding-top: 10px; }
.pk-sum div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.pk-sum dt { color: var(--pk-muted); }
.pk-sum dd { margin: 0; font-variant-numeric: tabular-nums; }
.pk-sum__disc.is-on dd { color: var(--pk-ok); font-weight: 700; }
.pk-sum__total { font-size: 17px !important; font-weight: 800; border-top: 1px dashed var(--pk-line); margin-top: 6px; padding-top: 8px !important; }
.pk-sum__total dt { color: var(--pk-ink) !important; }
.pk-save { margin: 10px 0 0; background: #ecfdf3; color: var(--pk-ok); border-radius: 10px; padding: 8px 12px; text-align: center; font-size: 14px; }
.pk-ship { margin: 8px 0 0; font-size: 13px; color: var(--pk-muted); text-align: center; }
.pk-ship.is-on { color: var(--pk-ok); font-weight: 600; }
.pk-cta { width: 100%; margin-top: 12px; padding: 14px; font-size: 16px; }
.pk-why { margin: 6px 0 0; font-size: 13px; color: #b45309; text-align: center; min-height: 1em; }

/* اعلان و جشن */
.pk-toast { position: fixed; z-index: 99999; inset-inline: 0; margin: auto; bottom: calc(90px + var(--pk-bottom, 0px)); width: max-content; max-width: calc(100% - 32px); background: var(--pk-ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.pk-toast.is-on { animation: pk-toast 2.6s ease forwards; }
@keyframes pk-toast { 0% { transform: translateY(20px); opacity: 0; } 10%, 85% { transform: none; opacity: 1; } 100% { opacity: 0; } }
.pakino.pk-pop .pk-sum__disc dd, .pakino.pk-pop .pk-save { animation: pk-pop .5s ease; }
@keyframes pk-pop { 40% { transform: scale(1.12); } }

/* نوار پایین موبایل */
.pk-mbar { display: none; }

/* ---------------- قالب لیستی ---------------- */
.pakino--list .pk-grid { grid-template-columns: 1fr; gap: 8px; }
.pakino--list .pk-card { flex-direction: row; align-items: center; }
.pakino--list .pk-card:hover { transform: none; }
.pakino--list .pk-card__img { width: 84px; min-width: 84px; aspect-ratio: 1; }
.pakino--list .pk-card__body { padding: 8px 12px; }
.pakino--list .pk-card__name { min-height: 0; -webkit-line-clamp: 1; }
.pakino--list .pk-add { margin: 0 12px; white-space: nowrap; padding: 8px 16px; }
.pakino--list .pk-badge-n { top: 6px; inset-inline-end: auto; inset-inline-start: 6px; }

/* ---------------- قالب مینیمال ---------------- */
.pakino--minimal { --pk-radius: 18px; }
.pakino--minimal .pk-card { border: 0; background: transparent; }
.pakino--minimal .pk-card:hover { box-shadow: none; }
.pakino--minimal .pk-card__img { border-radius: 18px; overflow: hidden; }
.pakino--minimal .pk-card.is-picked { box-shadow: none; }
.pakino--minimal .pk-card.is-picked .pk-card__img { outline: 3px solid var(--pk-primary); outline-offset: -3px; }
.pakino--minimal .pk-card__body { padding: 8px 2px 2px; }
.pakino--minimal .pk-add { margin: 6px 0 0; border-radius: 999px; }
.pakino--minimal .pk-side { box-shadow: none; background: #fafafb; border: 0; }

/* ---------------- موبایل ---------------- */
@media (max-width: 860px) {
  .pk-body { grid-template-columns: minmax(0, 1fr); }
  .pk-main { min-width: 0; }
  .pk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pakino--list .pk-grid { grid-template-columns: 1fr; }
  .pk-card__body { padding: 8px 10px 2px; }
  .pk-add { margin: 6px 10px 10px; }
  .pk-tiers { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding-inline: 4px; }
  .pk-tiers::-webkit-scrollbar, .pk-chips::-webkit-scrollbar, .pk-steps::-webkit-scrollbar { display: none; }
  .pk-chips { flex-wrap: nowrap; overflow-x: auto; }
  .pk-chips, .pk-steps { scrollbar-width: none; }
  .pk-title { font-size: 20px; }
  .pk-tiers li { min-width: 108px; }

  .pk-side { position: fixed; z-index: 99990; inset-inline: 0; bottom: var(--pk-bottom, 0px); top: auto; max-height: 82vh; border-radius: 20px 20px 0 0; transform: translateY(105%); transition: transform .3s ease; padding-bottom: 96px; }
  .pakino.pk-sheet-open .pk-side { transform: none; }
  .pakino.pk-sheet-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 99980; }
  .pk-close { display: block; }
  .pk-side .pk-cta { display: none; }

  .pk-mbar { display: flex; position: fixed; z-index: 99995; inset-inline: 0; bottom: var(--pk-bottom, 0px); gap: 10px; align-items: center; background: #fff; padding: 10px max(12px, var(--pk-avoid-right, 0px)) calc(10px + env(safe-area-inset-bottom)) max(12px, var(--pk-avoid-left, 0px)); box-shadow: 0 -6px 24px rgba(20, 24, 40, .1); }
  .pk-mbar__info { flex: 1; display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; padding: 0; text-align: start; min-width: 0; color: var(--pk-ink); }
  .pk-mbar__count { font-size: 12px; color: var(--pk-muted); }
  .pk-mbar__count::after { content: " ▴"; }
  .pk-mbar__total { font-size: 16px; }
  .pk-mbar__save { font-style: normal; font-size: 12px; color: var(--pk-ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .pk-mbar__cta { flex: 0 1 auto; max-width: 60%; padding: 12px 14px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pakino { padding-bottom: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  .pakino *, .pakino *::before, .pakino *::after { animation: none !important; transition: none !important; }
}

