/* ==========================================================================
   فروشگاه (دوره‌ها و محصولات) — هم‌خانواده‌ی سامانه‌ی طراحی سایت (site.css)
   --------------------------------------------------------------------------
   همه‌ی رنگ‌ها، شعاع‌ها، سایه‌ها و فاصله‌ها از توکن‌های site.css می‌آیند تا فروشگاه، وبلاگ و
   صفحه‌های سایت یکدست باشند. اجزای مشترک (دکمه، برچسب، مسیر صفحه، صفحه‌بندی، فیلدهای فرم و
   پیام خالی) از site.css استفاده می‌شوند؛ این فایل فقط اجزای مخصوص فروشگاه را دارد.
   ========================================================================== */

/* ---------- ابزار جست‌وجو و دسته‌ها ---------- */
.shop-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 28px; }
.shop-toolbar .filters { margin-bottom: 0; }
.shop-count { color: var(--ink-3); font-size: .92rem; }
.shop-count strong { color: var(--ink); }

/* ---------- کارت محصول ---------- */
.products-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.products-grid--3 { grid-template-columns: repeat(3, 1fr); }

.product-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--white); box-shadow: var(--sh-1);
    transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t);
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--sh-2); border-color: var(--blue-100); }
.product-card__media { position: relative; aspect-ratio: 4 / 3; background: var(--paper); overflow: hidden; }
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.product-card:hover .product-card__media img { transform: scale(1.05); }
.product-card__badges { position: absolute; top: 12px; inset-inline-start: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.product-card__body { display: flex; flex-direction: column; gap: 12px; flex: 1; padding: 18px 18px 20px; }
.product-card__cat { font-size: .78rem; font-weight: 700; color: var(--blue-600); }
.product-card h3 { font-size: 1.02rem; line-height: 1.8; }
.product-card h3 a { color: inherit; }
.product-card__foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* نشان‌ها */
.pbadge {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px;
    font-size: .75rem; font-weight: 800; line-height: 1.6; backdrop-filter: blur(6px);
}
.pbadge .i { width: 14px; height: 14px; }
.pbadge--free { background: rgba(16, 185, 129, .92); color: #fff; }
.pbadge--sale { background: var(--gold-500); color: var(--navy-900); }
.pbadge--paid { background: rgba(17, 23, 53, .78); color: #fff; }
.pbadge--featured { background: var(--navy-900); color: var(--gold-300); }

/* قیمت */
.price { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.4; }
.price__old { font-size: .82rem; color: var(--ink-3); text-decoration: line-through; }
.price__now { font-family: var(--font-head); font-size: 1.12rem; font-weight: 800; color: var(--navy-900); }
.price__now small { font-size: .72rem; font-weight: 600; color: var(--ink-3); margin-inline-start: 4px; }
.price--free .price__now { color: #059669; }
.price--sale .price__now { color: var(--blue-700); }

/* ---------- صفحه‌ی محصول ---------- */
.product-hero { padding-block: calc(var(--header-h) + 28px) 40px; }
.product-hero .crumbs { margin-bottom: 0; }

.product-layout { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(28px, 4vw, 56px); align-items: start; }
.gallery__main {
    position: relative; overflow: hidden; border-radius: var(--r-xl); background: var(--paper);
    border: 1px solid var(--line); box-shadow: var(--sh-2); aspect-ratio: 4 / 3;
}
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.gallery__badges { position: absolute; top: 16px; inset-inline-start: 16px; display: flex; gap: 8px; }
.gallery__thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.gallery__thumb {
    padding: 0; border: 2px solid transparent; border-radius: var(--r-sm); overflow: hidden; cursor: pointer;
    background: var(--paper); aspect-ratio: 1; transition: border-color var(--t), transform var(--t);
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb:hover { transform: translateY(-2px); }
.gallery__thumb[aria-pressed="true"] { border-color: var(--blue-500); }

.product-info { display: flex; flex-direction: column; gap: 18px; }
.product-info h1 { font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2rem); line-height: 1.55; }
.product-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; color: var(--ink-3); font-size: .9rem; }
.product-meta .stars .i, .product-meta .stars span { width: 17px; height: 17px; }
.product-meta strong { color: var(--ink); }
.product-meta__item { display: inline-flex; align-items: center; gap: 6px; }
.product-meta__item .i { width: 16px; height: 16px; color: var(--blue-600); }

.buy-card {
    position: sticky; top: calc(var(--header-h) + 18px);
    padding: 24px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--white); box-shadow: var(--sh-2);
}
.buy-card__label { font-size: .85rem; color: var(--ink-3); font-weight: 600; }
.buy-card .price { margin-top: 6px; }
.buy-card .price__now { font-size: 1.75rem; }
.buy-card .price__old { font-size: .95rem; }
.buy-card__save { display: inline-flex; margin-top: 8px; padding: 3px 10px; border-radius: 99px; background: var(--gold-100); color: #7A5C0E; font-size: .8rem; font-weight: 800; }
.buy-card__actions { display: grid; gap: 10px; margin-top: 20px; }
.buy-card__owned { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--r-sm); background: #ECFDF5; color: #047857; font-weight: 700; font-size: .92rem; }
.buy-card__owned .i { width: 18px; height: 18px; }
.buy-card__hint { margin-top: 10px; font-size: .8rem; color: var(--ink-3); line-height: 1.9; }
.trust-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.trust-row span { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: .76rem; color: var(--ink-2); font-weight: 600; }
.trust-row .i { width: 20px; height: 20px; color: var(--blue-600); }

.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spec { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.spec__icon { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue-600); }
.spec__icon .i { width: 18px; height: 18px; }
.spec__label { display: block; font-size: .75rem; color: var(--ink-3); }
.spec__value { display: block; font-weight: 700; font-size: .92rem; color: var(--ink); }
.product-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- زبانه‌ها ---------- */
.ptabs { margin-top: clamp(40px, 6vw, 72px); }
.ptabs__list {
    display: flex; gap: 6px; padding: 6px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none;
}
.ptabs__list::-webkit-scrollbar { display: none; }
.ptabs__tab {
    flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding-inline: 18px;
    border: 0; border-radius: 12px; background: none; color: var(--ink-2); font: inherit; font-weight: 700; font-size: .93rem; cursor: pointer;
    transition: background-color var(--t), color var(--t), box-shadow var(--t);
}
.ptabs__tab .i { width: 18px; height: 18px; }
.ptabs__tab:hover { color: var(--ink); }
.ptabs__tab[aria-selected="true"] { background: var(--white); color: var(--blue-700); box-shadow: var(--sh-1); }
.ptabs__count { min-width: 22px; height: 22px; padding-inline: 6px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--blue-500); color: #fff; font-size: .72rem; }
.ptabs__panel { margin-top: 22px; padding: clamp(20px, 3vw, 34px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--white); }
.ptabs__panel[hidden] { display: none; }

.spec-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.spec-table th, .spec-table td { padding: 13px 14px; text-align: start; border-bottom: 1px solid var(--line); }
.spec-table th { width: 34%; color: var(--ink-3); font-weight: 600; }
.spec-table td { color: var(--ink); font-weight: 700; }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }

/* دانلودها */
.dl-group + .dl-group { margin-top: 26px; }
.dl-group__title { display: flex; align-items: center; gap: 8px; font-size: 1rem; margin-bottom: 12px; }
.dl-group__title .i { width: 18px; height: 18px; color: var(--blue-600); }
.dl-group__note { margin: -4px 0 12px; font-size: .85rem; color: var(--ink-3); }
.dl-list { display: grid; gap: 10px; }
.dl-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.dl-item.is-locked { opacity: .7; }
.dl-item h4 { font-size: .97rem; }
.dl-item p { margin-top: 2px; font-size: .85rem; color: var(--ink-3); }
.dl-item__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: .78rem; color: var(--ink-3); }

/* نظرها */
.rv-summary { display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-radius: var(--r); background: var(--gold-50); border: 1px solid var(--blue-100); }
.rv-summary__score { font-family: var(--font-head); font-size: 2.3rem; font-weight: 900; line-height: 1; color: var(--navy-900); }
.rv-summary__count { font-size: .85rem; color: var(--ink-3); }
.rstars { display: inline-flex; gap: 2px; font-size: 1.05rem; line-height: 1; color: var(--line-2); }
.rstars .on { color: var(--gold-500); }

.rv-form { margin-top: 22px; }
.rv-form h3 { font-size: 1.08rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.rv-form h3 .i { width: 20px; height: 20px; color: var(--blue-600); }
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 1.9rem; line-height: 1; color: var(--line-2); cursor: pointer; transition: color var(--t), transform var(--t); }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: var(--gold-500); }
.star-input label:hover { transform: scale(1.12); }
.star-input input:focus-visible + label { outline: 3px solid var(--blue-400); outline-offset: 2px; border-radius: 6px; }
.star-input.is-invalid label { color: #FCA5A5; }
.rating-word { margin-inline-start: 10px; font-weight: 700; color: var(--blue-700); font-size: .9rem; }
.captcha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.captcha img { height: 48px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; }
.field .is-invalid { border-color: #DC2626; }
.field .is-valid { border-color: #10B981; }
.invalid-feedback { display: block; margin-top: 6px; font-size: .82rem; color: #B91C1C; }


.loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px; color: var(--ink-3); font-size: .9rem; }
.loading__spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--blue-100); border-top-color: var(--blue-500); animation: shop-spin .8s linear infinite; }
@keyframes shop-spin { to { transform: rotate(360deg); } }

.rv-list { display: grid; gap: 14px; margin-top: 22px; }
.rv-card { display: flex; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); }
.rv-card__avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-900); color: var(--gold-300); font-weight: 800; font-size: .85rem; }
.rv-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; }
.rv-card__name { font-size: .97rem; }
.rv-card__date { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--ink-3); }
.rv-card__date .i { width: 14px; height: 14px; }
.rv-card p { margin-top: 8px; color: var(--ink-2); font-size: .94rem; line-height: 2; }
.rv-empty { text-align: center; padding: 30px 14px; color: var(--ink-3); }
.rv-empty .i { width: 46px; height: 46px; color: var(--blue-300); }
.rv-empty h4 { margin-top: 8px; color: var(--ink); }

/* ---------- پرداخت ---------- */
.checkout { display: grid; grid-template-columns: 1.4fr .9fr; gap: 24px; align-items: start; }
.checkout-card { padding: clamp(22px, 3vw, 34px); border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--white); box-shadow: var(--sh-2); }
.checkout-card h1, .checkout-card h2 { font-size: 1.35rem; line-height: 1.6; }
.checkout-card__code { margin-top: 4px; font-size: .85rem; color: var(--ink-3); }
.checkout-card__desc { margin-top: 14px; color: var(--ink-2); line-height: 2; }
.checkout-total { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; padding: 18px 20px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); }
.checkout-total .price__now { font-size: 1.6rem; }
.checkout-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.checkout-note { margin-top: 20px; }
.checkout-aside { display: grid; gap: 16px; }
.checkout-aside .checkout-card { box-shadow: var(--sh-1); }
.checkout-aside h3 { font-size: 1.02rem; margin-bottom: 12px; }

.result { max-width: 620px; margin-inline: auto; text-align: center; }
.result__icon { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; }
.result__icon .i { width: 42px; height: 42px; }
.result--ok .result__icon { background: #ECFDF5; color: #059669; }
.result--fail .result__icon { background: #FEF2F2; color: #DC2626; }
.result h1 { font-size: 1.6rem; }
.result p { margin-top: 10px; color: var(--ink-2); }
.result__ref { margin: 22px auto 0; display: grid; gap: 8px; max-width: 420px; text-align: start; padding: 16px 18px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); font-size: .92rem; }
.result__ref strong { color: var(--ink); }
.result .checkout-actions { justify-content: center; }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 1199.98px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1023.98px) {
    .product-layout, .checkout { grid-template-columns: 1fr; }
    .buy-card { position: static; }
    .products-grid, .products-grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
    .products-grid, .products-grid--3, .spec-grid { grid-template-columns: 1fr; }
    .gallery__thumbs { grid-template-columns: repeat(4, 1fr); }
    .dl-item { flex-direction: column; align-items: stretch; }
    .ptabs__tab span:not(.ptabs__count) { display: none; }
}
