/* ============================================================
   فروشگاه: سبد خرید، تسویه، آدرس‌ها و سفارش‌ها
   از همان توکن‌های app.css استفاده می‌کند (--brand، --bg-card، …)
   ============================================================ */

.shop-page {
    padding: calc(var(--nav-h) + 40px) 0 80px;
    position: relative;
    z-index: 1;
    min-height: 70vh;
}

.shop-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.shop-title {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-light), var(--brand-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.shop-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 6px;
}

/* ---------- کارت پایه ---------- */
.shop-card {
    background: var(--panel-bg);
    border: 1px solid rgba(0,157,174,0.22);
    border-radius: 20px;
    padding: 22px;
    backdrop-filter: blur(12px);
}

    .shop-card + .shop-card {
        margin-top: 18px;
    }

.shop-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- چیدمان دو ستونه ---------- */
.shop-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 22px;
    align-items: start;
}

.shop-aside {
    position: sticky;
    top: calc(var(--nav-h) + 20px);
}

/* ---------- دکمه‌ها ---------- */
.shop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

    .shop-btn:hover {
        transform: translateY(-2px);
    }

    .shop-btn:disabled,
    .shop-btn.is-disabled {
        opacity: .5;
        cursor: not-allowed;
        transform: none;
    }

.shop-btn--primary {
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    color: var(--on-brand);
    box-shadow: 0 8px 24px rgba(0,157,174,.28);
}

.shop-btn--secondary {
    background: rgba(0,157,174,.08);
    border-color: rgba(0,157,174,.35);
    color: var(--text-light);
}

.shop-btn--ghost {
    background: transparent;
    border-color: var(--surface-2);
    color: var(--text-muted);
}

.shop-btn--danger {
    background: rgba(220,70,70,.1);
    border-color: rgba(220,70,70,.4);
    color: var(--danger-text);
}

.shop-btn--block {
    width: 100%;
}

.shop-btn--sm {
    padding: 8px 14px;
    font-size: 0.82rem;
    border-radius: 11px;
}

/* ---------- پیام‌ها ---------- */
.shop-alert {
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: .9rem;
    border: 1px solid;
}

.shop-alert--success {
    background: rgba(45,180,130,.1);
    border-color: rgba(45,180,130,.4);
    color: var(--success-text);
}

.shop-alert--error {
    background: rgba(220,70,70,.1);
    border-color: rgba(220,70,70,.4);
    color: var(--danger-text);
}

.shop-alert--info {
    background: rgba(0,157,174,.08);
    border-color: rgba(0,157,174,.32);
    color: var(--text-muted);
}

.shop-validation {
    color: var(--danger-text);
    font-size: .85rem;
}

    .shop-validation ul {
        list-style: none;
        display: grid;
        gap: 6px;
    }

.shop-error {
    color: var(--danger-text);
    font-size: .8rem;
    min-height: 1em;
}

/* ---------- حالت خالی ---------- */
.shop-empty {
    text-align: center;
    padding: 60px 20px;
}

.shop-empty__icon {
    font-size: 3.4rem;
    display: block;
    margin-bottom: 14px;
    opacity: .7;
}

.shop-empty__text {
    color: var(--text-muted);
    margin-bottom: 22px;
}

/* ============================================================
   سبد خرید
   ============================================================ */
.cart-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--surface-2);
}

    .cart-item:last-child {
        border-bottom: none;
    }

.cart-item__thumb {
    width: 76px;
    height: 76px;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0,157,174,.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

    .cart-item__thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.cart-item__title {
    font-weight: 700;
    font-size: .98rem;
    margin-bottom: 4px;
}

.cart-item__meta {
    color: var(--text-muted);
    font-size: .82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.cart-item__old {
    text-decoration: line-through;
    opacity: .6;
}

.cart-item__side {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.cart-item__total {
    font-weight: 800;
    color: var(--brand-light);
    white-space: nowrap;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(0,157,174,.3);
    border-radius: 12px;
    overflow: hidden;
}

    .qty-control button {
        width: 34px;
        height: 34px;
        background: rgba(0,157,174,.08);
        border: none;
        color: var(--text-light);
        font-size: 1.1rem;
        cursor: pointer;
        font-family: inherit;
    }

        .qty-control button:hover {
            background: rgba(0,157,174,.2);
        }

    .qty-control span {
        min-width: 40px;
        text-align: center;
        font-weight: 700;
    }

/* ---------- خلاصه‌ی مبلغ ---------- */
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    font-size: .9rem;
    color: var(--text-muted);
}

.summary-row--discount {
    color: var(--success-text);
}

.summary-row--total {
    border-top: 1px dashed var(--surface-2);
    margin-top: 8px;
    padding-top: 14px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-light);
}

    .summary-row--total .summary-amount {
        color: var(--brand-light);
    }

.summary-note {
    margin-top: 14px;
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ============================================================
   آدرس‌ها
   ============================================================ */
.address-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.address-card {
    border: 1px solid var(--surface-2);
    border-radius: 16px;
    padding: 18px;
    background: var(--surface-1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.address-card--default {
    border-color: rgba(0,157,174,.5);
    box-shadow: 0 0 0 1px rgba(0,157,174,.2) inset;
}

.address-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.address-card__title {
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

.address-badge {
    font-size: .7rem;
    padding: 3px 10px;
    border-radius: 50px;
    background: rgba(0,157,174,.15);
    border: 1px solid rgba(0,157,174,.4);
    color: var(--brand-light);
}

.address-card__body {
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.9;
}

.address-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

    .address-card__actions form {
        display: inline;
    }

/* انتخاب آدرس در صفحه‌ی تسویه */
.address-option {
    display: block;
    cursor: pointer;
}

    .address-option input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .address-option .address-card {
        transition: border-color .15s ease, background .15s ease;
    }

    .address-option input:checked + .address-card {
        border-color: var(--brand);
        background: rgba(0,157,174,.09);
    }

    .address-option input:focus-visible + .address-card {
        outline: 2px solid var(--brand-light);
        outline-offset: 2px;
    }

/* ---------- فرم ---------- */
.shop-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 16px;
}

.shop-label {
    font-size: .85rem;
    font-weight: 600;
}

.shop-input,
.shop-textarea,
.shop-select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 13px;
    background: var(--surface-1);
    border: 1px solid var(--surface-2);
    color: var(--text-light);
    font-family: inherit;
    font-size: .92rem;
}

    .shop-input:focus,
    .shop-textarea:focus,
    .shop-select:focus {
        outline: none;
        border-color: var(--brand);
        background: rgba(0,157,174,.06);
    }

.shop-textarea {
    min-height: 96px;
    resize: vertical;
}

.shop-select option {
    background: var(--bg-card);
    color: var(--text-light);
}

.shop-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.shop-check {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: .88rem;
    cursor: pointer;
    margin-bottom: 16px;
}

    .shop-check input {
        width: 18px;
        height: 18px;
        accent-color: var(--brand);
        cursor: pointer;
    }

.title-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.title-chip {
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid rgba(0,157,174,.3);
    background: rgba(0,157,174,.06);
    color: var(--text-muted);
    font-family: inherit;
    font-size: .8rem;
    cursor: pointer;
}

    .title-chip:hover,
    .title-chip.active {
        background: rgba(0,157,174,.2);
        color: var(--text-light);
    }

/* ---------- نقشه ---------- */
.map-picker {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(0,157,174,.25);
    position: relative;
}

.map-picker__canvas {
    height: 320px;
    width: 100%;
    background: var(--bg-card);
}

.map-picker__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(0,157,174,.07);
    font-size: .8rem;
    color: var(--text-muted);
}

.map-picker__coords {
    direction: ltr;
    font-variant-numeric: tabular-nums;
}

.map-static {
    height: 220px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(0,157,174,.25);
}

/* ============================================================
   سفارش‌ها
   ============================================================ */
.order-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 700;
    border: 1px solid;
    white-space: nowrap;
}

.order-status--pending {
    background: rgba(230,180,60,.12);
    border-color: rgba(230,180,60,.45);
    color: var(--warn-text);
}

.order-status--paid {
    background: rgba(0,157,174,.12);
    border-color: rgba(0,157,174,.45);
    color: var(--brand-light);
}

.order-status--preparing {
    background: rgba(150,110,230,.12);
    border-color: rgba(150,110,230,.45);
    color: var(--accent-purple);
}

.order-status--delivering {
    background: rgba(70,150,230,.12);
    border-color: rgba(70,150,230,.45);
    color: var(--info-text);
}

.order-status--completed {
    background: rgba(45,180,130,.12);
    border-color: rgba(45,180,130,.45);
    color: var(--success-text);
}

.order-status--canceled {
    background: var(--surface-1);
    border-color: var(--surface-2);
    color: var(--text-muted);
}

.order-status--failed {
    background: rgba(220,70,70,.12);
    border-color: rgba(220,70,70,.45);
    color: var(--danger-text);
}

.order-card {
    border: 1px solid var(--surface-2);
    border-radius: 16px;
    padding: 18px;
    background: var(--surface-1);
    display: grid;
    gap: 12px;
}

    .order-card + .order-card {
        margin-top: 14px;
    }

.order-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.order-card__number {
    font-weight: 800;
    direction: ltr;
    unicode-bidi: embed;
}

.order-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-muted);
    font-size: .84rem;
}

.order-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.order-stat {
    border: 1px solid rgba(0,157,174,.22);
    border-radius: 16px;
    padding: 16px 18px;
    background: rgba(0,157,174,.05);
}

.order-stat__label {
    color: var(--text-muted);
    font-size: .8rem;
    margin-bottom: 6px;
}

.order-stat__value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand-light);
}

.order-items {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

    .order-items th,
    .order-items td {
        padding: 11px 8px;
        text-align: right;
        border-bottom: 1px solid var(--surface-2);
    }

    .order-items th {
        color: var(--text-muted);
        font-weight: 600;
        font-size: .8rem;
    }

    .order-items tbody tr:last-child td {
        border-bottom: none;
    }

.order-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
}

    .order-filters .shop-field {
        margin-bottom: 0;
        min-width: 150px;
    }

/* ---------- نتیجه‌ی پرداخت ---------- */
.pay-result {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
}

.pay-result__icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    border: 2px solid;
}

.pay-result__icon--ok {
    background: rgba(45,180,130,.12);
    border-color: rgba(45,180,130,.5);
}

.pay-result__icon--fail {
    background: rgba(220,70,70,.12);
    border-color: rgba(220,70,70,.5);
}

.pay-result__rows {
    text-align: right;
    margin: 22px 0;
}

/* توضیح تکمیلی زیر پیام نتیجه (مثلاً هماهنگی تلفنی پرداخت) */
.pay-result__hint {
    max-width: 46ch;
    margin: 14px auto 0;
    padding: 12px 14px;
    border: 1px dashed rgba(0,157,174,.35);
    border-radius: 12px;
    background: var(--surface-1);
    color: var(--text-soft);
    font-size: .9rem;
    line-height: 1.9;
}

/* ---------- بَج سبد در نوبار ---------- */
.cart-link {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -8px;
    inset-inline-start: -10px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 50px;
    background: var(--brand);
    color: var(--on-brand);
    font-size: .7rem;
    font-weight: 800;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

    .cart-badge.is-visible {
        display: inline-flex;
    }

/* ---------- دکمه‌ی افزودن در کارت منو ---------- */
.menu-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    color: var(--on-brand);
    font-family: inherit;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease;
}

    .menu-add-btn:hover {
        transform: translateY(-2px);
    }

    .menu-add-btn:disabled {
        opacity: .6;
        cursor: wait;
    }

.menu-variant-select {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 11px;
    background: var(--surface-1);
    border: 1px solid rgba(0,157,174,.25);
    color: var(--text-light);
    font-family: inherit;
    font-size: .82rem;
}

    .menu-variant-select option {
        background: var(--bg-card);
    }

/* ---------- توست ---------- */
.shop-toast {
    position: fixed;
    inset-block-end: 24px;
    inset-inline-start: 24px;
    z-index: 9999;
    max-width: 320px;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--panel-solid);
    border: 1px solid rgba(0,157,174,.45);
    color: var(--text-light);
    font-size: .88rem;
    box-shadow: 0 12px 36px var(--panel-shadow);
    transform: translateY(20px);
    opacity: 0;
    transition: transform .25s ease, opacity .25s ease;
}

    .shop-toast.is-visible {
        transform: translateY(0);
        opacity: 1;
    }

.shop-toast--error {
    border-color: rgba(220,70,70,.5);
}

/* ---------- صفحه‌بندی ساده ---------- */
.shop-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 26px;
}

    .shop-pagination a,
    .shop-pagination span {
        min-width: 38px;
        padding: 8px 12px;
        border-radius: 11px;
        border: 1px solid rgba(0,157,174,.25);
        color: var(--text-muted);
        text-decoration: none;
        text-align: center;
        font-size: .85rem;
    }

        .shop-pagination a:hover {
            background: rgba(0,157,174,.14);
            color: var(--text-light);
        }

        .shop-pagination a.active {
            background: var(--brand);
            border-color: var(--brand);
            color: var(--on-brand);
            font-weight: 800;
        }

    .shop-pagination .is-disabled {
        opacity: .4;
        pointer-events: none;
    }

/* ============================================================
   موبایل
   ============================================================ */
@media (max-width: 900px) {
    .shop-layout {
        grid-template-columns: 1fr;
    }

    .shop-aside {
        position: static;
    }
}

@media (max-width: 560px) {
    .shop-page {
        padding-top: calc(var(--nav-h) + 24px);
    }

    .cart-item {
        grid-template-columns: 60px minmax(0, 1fr);
        row-gap: 10px;
    }

    .cart-item__thumb {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }

    .cart-item__side {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .shop-grid-2 {
        grid-template-columns: 1fr;
    }

    .shop-card {
        padding: 18px 16px;
    }

    .order-items th:nth-child(2),
    .order-items td:nth-child(2) {
        display: none;
    }
}

/* ============================================================
   کپچا (DNTCaptcha)
   ============================================================ */

/*
   ساختاری که تگ‌هلپر تولید می‌کند به‌ترتیب: تصویر، دکمهٔ تازه‌سازی، اینپوت
   مخفی، اینپوت متنی، پیام اعتبارسنجی. اینپوت‌های مخفی و اسکریپت display:none
   هستند و جای گرید نمی‌گیرند، پس چیدمان دو ردیفه می‌شود:

     ردیف ۱ →  [ تصویر (کش‌آمده) ][ ↻ ]
     ردیف ۲ →  [ کادر ورود کد، تمام‌عرض   ]

   قبلاً هر سه در یک ردیف بودند و تصویر آن‌قدر فشرده می‌شد که خوانده نمی‌شد.
*/
.captcha-field .dntCaptcha {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: stretch;
}

.captcha-field .dntCaptcha img {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    border: 1px solid rgba(0,157,174,.3);
    background: var(--bg-card);
    /* تصویر سمت سرور با فونت ۳۸ ساخته می‌شود؛ کشیدنش تا عرض کارت کمی
       بزرگ‌نمایی دارد و درون‌یابی نرم از پیکسلی‌شدن جلوگیری می‌کند. */
    image-rendering: auto;
}

.captcha-refresh {
    grid-column: 2;
    grid-row: 1;
    width: 48px;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(0,157,174,.35);
    background: rgba(0,157,174,.08);
    color: var(--brand-light);
    text-decoration: none;
    font-size: 1.3rem;
    line-height: 1;
}

    /* دکمهٔ کتابخانه محتوای متنی ندارد و روی آیکون‌فونت بوت‌استرپ ۳ حساب
       می‌کند که در این پروژه نیست؛ پس نماد را خودمان می‌گذاریم. */
    .captcha-refresh::after {
        content: "↻";
    }

    .captcha-refresh:hover {
        background: rgba(0,157,174,.2);
    }

    .captcha-refresh:active {
        transform: scale(.94);
    }

    .captcha-refresh.is-busy {
        opacity: .5;
        pointer-events: none;
    }

.captcha-field .captcha-input {
    grid-column: 1 / -1;
    text-align: center;
    letter-spacing: 6px;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

    .captcha-field .captcha-input::placeholder {
        letter-spacing: normal;
        font-size: .9rem;
    }

.captcha-field [data-valmsg-for] {
    grid-column: 1 / -1;
    display: block;
}
