/* فروشگاه فایل — مکمل quiz.css (صفحه‌های فروشگاه هر دو را لود می‌کنند؛ کادر کناری shop-box فقط این فایل را) */
.shop-price { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.shop-price.is-free { background: rgba(34, 160, 90, .12); color: #1f8a4f; }
.shop-type-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); font-size: 12px; color: var(--text-muted); }

/* کارت محصول (از quiz-card/quiz-grid ارث می‌برد) */
.shop-card .shop-card-footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.shop-card .shop-card-more { margin-inline-start: auto; color: var(--accent); font-size: 13px; font-weight: 600; }
.shop-card-noimg { display: flex; align-items: center; justify-content: center; height: 140px; background: var(--accent-soft); color: var(--accent); font-size: 44px; }

/* صفحهٔ محصول */
.shop-facts { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: var(--text-secondary); font-size: 14px; }
.shop-facts i { margin-inline-end: 4px; color: var(--text-muted); }
.shop-facts-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.shop-buy-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; margin: 0 0 18px; }
.shop-buy-box .shop-price { font-size: 16px; padding: 6px 16px; }
.shop-file-list { list-style: none; margin: 0; padding: 0; }
.shop-file-list li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); line-height: 1.9; }
.shop-file-list li:first-child { border-top: 0; }
.shop-file-list i { font-size: 20px; color: var(--accent); }
.shop-file-list small { color: var(--text-muted); margin-inline-start: auto; white-space: nowrap; }

/* محصولات مرتبط / پیشنهادی */
.shop-related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shop-related-item { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); color: inherit; text-decoration: none; }
.shop-related-item:hover { border-color: var(--accent); }
.shop-related-item strong { line-height: 1.7; font-size: 14.5px; }

/* کادر کناری رویداد/مقاله/پادکست/آزمون */
.gd-shop .shop-box-item { padding: 10px 0; border-top: 1px solid var(--border); }
.gd-shop .shop-box-item:first-of-type { border-top: 0; }
.gd-shop .shop-box-title { display: block; line-height: 1.8; margin-bottom: 6px; }
.gd-shop .shop-box-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* فرم خرید */
.shop-amount-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.shop-amount-row input { max-width: 220px; text-align: left; direction: ltr; }
.shop-summary { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); margin: 0 0 14px; line-height: 1.9; }
@media (max-width: 640px) {
  .shop-buy-box { flex-direction: column; align-items: stretch; text-align: center; }
  .shop-file-list li { flex-wrap: wrap; }
  .shop-file-list small { margin-inline-start: 0; }
}

/* کد تخفیف */
.shop-coupon-row { display: flex; gap: 8px; align-items: stretch; }
.shop-coupon-row input { flex: 1; min-width: 0; }

/* فیلدهای اجباریِ پرنشده / نامعتبر در فرم خرید */
#shForm input.is-invalid, #shForm select.is-invalid, #shForm textarea.is-invalid {
  border-color: var(--danger); background: var(--danger-soft); box-shadow: 0 0 0 3px var(--danger-border);
}
#shForm .form-group.has-error > label, #shForm fieldset.has-error > legend, #shForm .qf-methods.has-error { color: var(--danger); }
#shForm fieldset.is-invalid, #shForm .qf-methods.is-invalid, #shForm .qf-captcha.is-invalid {
  border: 1px solid var(--danger) !important; background: var(--danger-soft); border-radius: var(--radius-md);
}
#shClientErr strong, .alert-error strong { font-weight: 700; }

/* مبلغ دلخواه: − [ مبلغ تومان ] + و مبلغ به حروف */
.shop-pwyw { background: var(--surface, transparent); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 14px; text-align: center; }
.shop-pwyw-title { display: block; font-weight: 700; margin-bottom: 12px; }
.shop-pwyw-row { display: flex; align-items: center; justify-content: center; gap: 12px; direction: ltr; }
.shop-pwyw-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; touch-action: manipulation; user-select: none; }
.shop-pwyw-btn:hover { border-color: var(--accent, currentColor); }
.shop-pwyw-field { display: flex; align-items: center; gap: 10px; direction: rtl; }
.shop-pwyw-field input { width: 190px; max-width: 46vw; min-width: 0; text-align: center; font-size: 1.25rem; font-weight: 700; padding: 10px 8px; }
.shop-pwyw-unit { font-weight: 700; white-space: nowrap; }
.shop-pwyw-words { min-height: 1.6em; margin: 10px 0 4px; font-size: .9rem; opacity: .75; line-height: 1.8; }
#shForm #shPwyw.has-error .shop-pwyw-title { color: var(--danger); }

/* فرم خرید داخل صفحهٔ محصول */
#shPayBox[hidden], #shTotalBox[hidden] { display: none; }
.shop-buy-here { scroll-margin-top: 90px; }
.shop-buy-here > h2 { margin: 0 0 12px; font-size: 18px; }
#shForm .qf-files.is-invalid { border: 1px solid var(--danger); background: var(--danger-soft); border-radius: var(--radius-md); padding: 8px; }

/* ردیف بالای صفحهٔ محصول: کادر نمونه (دمو) و کادر قیمت/خرید کنار هم و هم‌قد */
.shop-top-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; margin: 0 0 18px; }
.shop-top-row.is-single { grid-template-columns: minmax(0, 1fr); }
.shop-top-row > .qf-box, .shop-top-row > .shop-buy-box { margin: 0; box-sizing: border-box; height: 100%; }
.shop-top-row:not(.is-single) > .shop-buy-box { flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px; }
@media (max-width: 700px) { .shop-top-row { grid-template-columns: minmax(0, 1fr); } }

/* کادر نمونه (دمو): فشرده — برچسب + عنوان در یک ستون، دکمه کنارش (حدود ۶۰px ارتفاع) */
.shop-top-row > .qf-demo { padding: 10px 16px; display: flex; flex-direction: column; justify-content: center; }
.qf-demo-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0; min-height: 36px; }
.qf-demo-row + .qf-demo-row { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.qf-demo-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.6; }
.qf-demo-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.qf-demo-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qf-demo-tag { font-size: 12px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.qf-demo-text strong { font-size: 14.5px; }
.qf-demo-text small { color: var(--text-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qf-demo-row .btn { flex: 0 0 auto; }
/* کادر قیمت/خرید در ردیف بالا هم افقی و فشرده */
.shop-top-row > .shop-buy-box { padding: 10px 16px; }
.shop-top-row > .shop-buy-box .btn { min-height: 38px; padding-block: 6px; }
.shop-top-row:not(.is-single) > .shop-buy-box { flex-direction: row; justify-content: space-between; align-items: center; text-align: start; gap: 12px; }
/* دکمهٔ «خرید فایل‌ها» پایین فهرست فایل‌های فروشی */
.shop-open-buy { margin-top: 14px; }
.shop-open-buy[hidden] { display: none; }
.shop-open-buy .btn { width: 100%; justify-content: center; }

/* هر فایل در فهرست انتخاب داخل یک پوشش است تا فایل «مبلغ دلخواه» ورودی مبلغش را داخل همان کارت داشته باشد */
.qf-file-wrap { border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg); overflow: hidden; }
.qf-file-wrap:has(input[type="checkbox"]:checked) { border-color: var(--accent); background: var(--accent-soft); }
.qf-file-wrap > .qf-file { border: 0; border-radius: 0; background: transparent; }
.qf-file-wrap > .qf-file:has(input:checked) { background: transparent; }
.shop-fa { padding: 12px 14px 14px; text-align: center; border-top: 1px dashed var(--border-strong); }
.shop-fa[hidden] { display: none; }
.shop-fa-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.shop-fa .shop-pwyw-field input { width: 170px; font-size: 1.1rem; padding: 8px 8px; }
.shop-fa .shop-pwyw-btn { width: 36px; height: 36px; }
.shop-fa .shop-pwyw-words { margin: 8px 0 2px; font-size: .85rem; }
