/* ===========================================================================
   فست‌کارت — صفحهٔ سبد. بازطراحیِ دور ۸۱
   ===========================================================================

   ردیفِ کارت‌مانند برای هر کالا، ستونِ خلاصهٔ چسبان، نوارِ پایینیِ موبایل.
   هر رنگ از نشانه‌های قالب (`--theme-*`ِ `apps/appearance/design.py`) است تا
   رنگِ برندی که فروشنده در تنظیماتِ قالب می‌گذارد اینجا هم برسد؛ عددِ دومِ
   هر `var()` فقط جانشینِ روزی است که نشانه‌ای تعریف نشده باشد.

   تا فاز ۶۶ این صفحه `<style>`ِ درون‌خطی داشت و تا دور ۸۰ جدولی هفت‌ستونه
   با دکمه‌های فیروزه‌ایِ ثابت (`#3dcfff`).
   =========================================================================== */

.fk-checkout { padding-block: var(--ds-space-4, 1.5rem) var(--ds-space-6, 3rem); }

.fk-cart {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: var(--ds-space-4, 1.5rem);
    align-items: start;
}

/* --- ستونِ کالاها ------------------------------------------------------- */
/* دو کلاس و `padding` صریح: یکی از قاعده‌های سراسریِ قالب ۴۴ پیکسل فاصلهٔ بالا به این ظرف می‌داد. */
.fk-cart .fk-cart__main {
    padding: 0;
    background: var(--theme-surface, #fff);
    border: 1px solid var(--theme-line, #e5e7eb);
    border-radius: var(--theme-radius-lg, 16px);
    box-shadow: var(--theme-shadow-sm, 0 1px 2px rgb(15 23 42 / .04));
    overflow: hidden;
}

.fk-cart__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--theme-line, #e5e7eb);
}
.fk-cart__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: var(--ds-text-lg, 1.15rem);
    font-weight: 800;
    color: var(--theme-ink, #1f2937);
}
.fk-cart__count {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--theme-accent-soft, #eafaf6);
    color: var(--theme-accent, #0da487);
    font-size: 12px;
    font-weight: 700;
}
.fk-cart__clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--theme-radius-sm, 8px);
    background: transparent;
    color: var(--theme-ink-muted, #6b7280);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.fk-cart__clear:hover,
.fk-cart__clear:focus-visible { color: var(--theme-sale-ink, #b91c1c); background: var(--theme-sale-soft, #fef2f2); border-color: var(--theme-sale-soft, #fecaca); }

.fk-cart__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px 22px 18px;
    color: var(--theme-accent, #0da487);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.fk-cart__more:hover { text-decoration: underline; text-underline-offset: 4px; }

/* --- هر کالا ------------------------------------------------------------ */
.fk-lines { margin: 0; padding: 0; list-style: none; }

.fk-line {
    position: relative;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto 150px;
    grid-template-areas: "media body qty total";
    align-items: center;
    gap: 18px;
    padding: 20px 22px 20px 52px;
    border-bottom: 1px solid var(--theme-line, #e5e7eb);
    transition: background-color .15s ease;
}
[dir="ltr"] .fk-line { padding: 20px 52px 20px 22px; }
.fk-line:hover { background: var(--theme-tint, #fafafa); }

.fk-line__media {
    grid-area: media;
    display: block;
    width: 96px;
    height: 96px;
    border-radius: var(--theme-radius, 12px);
    border: 1px solid var(--theme-line, #e5e7eb);
    background: var(--theme-surface, #fff);
    overflow: hidden;
}
.fk-line__media img { width: 100%; height: 100%; object-fit: contain; display: block; }

.fk-line__body { grid-area: body; min-width: 0; display: grid; gap: 8px; }
.fk-line__name {
    color: var(--theme-ink, #1f2937);
    font-size: var(--ds-text-base, 1rem);
    font-weight: 700;
    line-height: 1.6;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.fk-line__name:hover { color: var(--theme-accent, #0da487); }

.fk-line__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.fk-line__tags li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--theme-tint, #f5f5f5);
    color: var(--theme-ink-muted, #6b7280);
    font-size: 12px;
    overflow-wrap: anywhere;
}
.fk-line__tags i { color: var(--theme-accent, #0da487); font-size: 11px; }

.fk-line__unit { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin: 0; font-size: 13px; color: var(--theme-ink, #1f2937); }
.fk-line__unit-label { color: var(--theme-ink-muted, #6b7280); font-size: 12px; }
.fk-line__unit del { color: var(--ds-price-was, var(--theme-ink-muted, #9ca3af)); font-size: 12px; }
.fk-line__unit small { color: var(--theme-ink-muted, #6b7280); }
.fk-line__off {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--theme-sale, #ef4444);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

/* --- شمارندهٔ تعداد ------------------------------------------------------ */
.fk-line__qty { grid-area: qty; }
.fk-stepper {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 3px;
    border: 1px solid var(--theme-line, #e5e7eb);
    border-radius: 999px;
    background: var(--theme-surface, #fff);
}
.fk-stepper__btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--theme-accent, #0da487);
    font-size: 13px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.fk-stepper__btn:hover { background: var(--theme-accent-soft, #eafaf6); }
.fk-stepper__btn:focus-visible { outline: 2px solid var(--theme-accent, #0da487); outline-offset: 1px; }
.fk-stepper__btn.is-remove { color: var(--theme-sale-ink, #b91c1c); }
.fk-stepper__btn.is-remove:hover { background: var(--theme-sale-soft, #fef2f2); }
.fk-stepper__value {
    width: 38px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--theme-ink, #1f2937);
    font: inherit;
    font-weight: 800;
    text-align: center;
    pointer-events: none;
    -moz-appearance: textfield;
    appearance: textfield;
}
.fk-stepper__value::-webkit-inner-spin-button,
.fk-stepper__value::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* --- جمعِ ردیف و حذف ----------------------------------------------------- */
.fk-line__total { grid-area: total; display: grid; justify-items: end; gap: 2px; text-align: end; color: var(--theme-ink, #1f2937); }
.fk-line__total b { font-size: var(--ds-text-lg, 1.1rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.fk-line__total small { color: var(--theme-ink-muted, #6b7280); }
.fk-line__extra { color: var(--theme-ink-muted, #6b7280); font-size: 11.5px; }

.fk-line__remove {
    position: absolute;
    top: 14px;
    inset-inline-end: 12px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--theme-ink-muted, #6b7280);
    text-decoration: none;
    transition: color .15s ease, background-color .15s ease;
}
.fk-line__remove:hover,
.fk-line__remove:focus-visible { color: var(--theme-sale-ink, #b91c1c); background: var(--theme-sale-soft, #fef2f2); }

/* --- ستونِ خلاصه --------------------------------------------------------- */
.fk-cart__side { position: sticky; top: 96px; display: grid; gap: 14px; }

/* کارتِ خلاصه و دکمه‌ها: `css/components/checkout-summary.css` — مشترکِ سبد و ارسال. */

.fk-assure {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 14px 16px;
    list-style: none;
    border-radius: var(--theme-radius-lg, 16px);
    background: var(--theme-tint, #f8fafc);
    color: var(--theme-ink-muted, #6b7280);
    font-size: 12.5px;
}
.fk-assure li { display: flex; align-items: center; gap: 10px; }
.fk-assure i { width: 18px; text-align: center; color: var(--theme-accent, #0da487); }

/* نوارِ پایینیِ موبایل: در دسکتاپ نیست */
.fk-cartbar { display: none; }
/* بلندیِ نوارِ پایینیِ قالب (`layout/mobile_bar.html`، `d-md-none`) — نوارهای ثابتِ این صفحه بالایش می‌نشینند */
@media (max-width: 767.98px) { :root { --fk-mobile-menu: 67px; } .fk-cartbar { padding-bottom: 10px !important; } }

/* --- سبدِ خالی ----------------------------------------------------------- */
.fk-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
    padding: 48px 24px;
    text-align: center;
    background: var(--theme-surface, #fff);
    border: 1px solid var(--theme-line, #e5e7eb);
    border-radius: var(--theme-radius-lg, 16px);
}
.fk-empty__art {
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    margin-bottom: 6px;
    border-radius: 50%;
    background: var(--theme-accent-soft, #eafaf6);
}
.fk-empty__title { margin: 0; font-size: var(--ds-text-xl, 1.3rem); font-weight: 800; color: var(--theme-ink, #1f2937); }
.fk-empty__text { margin: 0; max-width: 42ch; color: var(--theme-ink-muted, #6b7280); line-height: 1.9; }
.fk-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }

/* --- تبلت و موبایل ------------------------------------------------------- */
@media (max-width: 1199.98px) {
    .fk-cart { grid-template-columns: minmax(0, 1fr) 320px; }
    .fk-line { grid-template-columns: 84px minmax(0, 1fr) auto; grid-template-areas: "media body body" "media qty total"; row-gap: 12px; }
    .fk-line__media { width: 84px; height: 84px; }
}

@media (max-width: 991.98px) {
    .fk-cart { grid-template-columns: minmax(0, 1fr); }
    .fk-cart__side { position: static; }
    /* جا برای نوارِ ثابتِ پایین، تا دکمه‌ای زیرش پنهان نماند */
    .fk-checkout { padding-bottom: calc(96px + var(--fk-mobile-menu, 0px)); }
    .fk-cartbar {
        position: fixed;
        inset-inline: 0;
        /* بالای نوارِ پایینیِ خودِ قالب (`.mobile-menu`، زیرِ ۷۶۸ پیکسل) — نه رویش */
        bottom: var(--fk-mobile-menu, 0px);
        z-index: 1030;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
        background: var(--theme-surface, #fff);
        border-top: 1px solid var(--theme-line, #e5e7eb);
        box-shadow: 0 -8px 24px rgb(15 23 42 / .08);
    }
    .fk-cartbar__sum { display: grid; line-height: 1.4; }
    .fk-cartbar__sum > small { color: var(--theme-ink-muted, #6b7280); font-size: 11.5px; }
    .fk-cartbar__sum b { font-size: var(--ds-text-lg, 1.1rem); font-weight: 900; color: var(--theme-ink, #1f2937); }
    .fk-cartbar__sum b small { font-size: 11px; font-weight: 600; color: var(--theme-ink-muted, #6b7280); }
    .fk-cartbar .fk-btn { min-height: 46px; padding-inline: 26px; }
}

@media (max-width: 575.98px) {
    .fk-cart__head { padding: 14px 16px; }
    .fk-cart__clear span { display: none; }
    .fk-line { grid-template-columns: 72px minmax(0, 1fr); grid-template-areas: "media body" "qty total"; gap: 10px 12px; padding: 16px 16px 16px 44px; }
    [dir="ltr"] .fk-line { padding: 16px 44px 16px 16px; }
    .fk-line__media { width: 72px; height: 72px; }
    .fk-line__remove { top: 10px; inset-inline-end: 6px; }
    .fk-cart__more { margin-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .fk-line, .fk-btn, .fk-stepper__btn { transition: none; }
}
