.basket-page {
    padding-block: clamp(38px, 6vw, 80px);
    direction: rtl;
}

.basket-page__header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.basket-page__title {
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
}

.basket-page__status {
    margin-bottom: 18px;
    padding: 12px 16px;
    color: #174c2d;
    background: #eaf7ef;
    border-radius: 12px;
}

.basket-page__status[data-state='error'] {
    color: #8a1c13;
    background: #fff0ee;
}

.basket-table-wrapper {
    overflow-x: auto;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
}

.basket-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.basket-table th,
.basket-table td {
    padding: 16px;
    text-align: right;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.basket-table th {
    background: #f7f7f7;
    font-weight: 700;
}

.basket-table tr:last-child td {
    border-bottom: 0;
}

.basket-row {
    transition: opacity 180ms ease, transform 180ms ease;
}

.basket-row.is-removing {
    opacity: 0;
    transform: translateY(-6px);
}

.basket-row[data-stock-conflict='true'] {
    background: #fff8f1;
}

.basket-product {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 230px;
}

.basket-product__image {
    width: 72px;
    height: 72px;
    object-fit: cover;
    background: #f4f4f4;
    border-radius: 12px;
}

.basket-product__title {
    display: block;
    color: inherit;
    font-weight: 700;
}

.basket-product__meta {
    margin-top: 5px;
    color: #666;
    font-size: 13px;
}

.basket-quantity-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.basket-quantity-form button,
.basket-remove-button,
.basket-clear-button {
    display: inline-grid;
    place-items: center;
    min-width: 38px;
    min-height: 38px;
    padding: 8px 12px;
    color: #222;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 150ms ease, background-color 150ms ease;
}

.basket-quantity-form button:hover:not(:disabled),
.basket-remove-button:hover:not(:disabled),
.basket-clear-button:hover:not(:disabled) {
    background: #f3f3f3;
    transform: translateY(-1px);
}

.basket-quantity-form button:disabled,
.basket-remove-button:disabled,
.basket-clear-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.basket-quantity-value {
    min-width: 30px;
    text-align: center;
    font-weight: 700;
}

.basket-remove-button svg {
    width: 20px;
    height: 20px;
}

.basket-page__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
}

.basket-page__link,
.basket-page__primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 18px;
    border-radius: 12px;
    text-decoration: none;
}

.basket-page__link {
    color: #222;
    background: #f1f1f1;
}

.basket-page__primary {
    color: #fff;
    background: #168a52;
}

.basket-summary {
    display: grid;
    gap: 14px;
    max-width: 420px;
    margin-top: 28px;
    margin-right: auto;
    padding: 22px;
    background: #f7f7f7;
    border-radius: 18px;
}

.basket-summary__row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.basket-summary__notice {
    margin: 0;
    color: #76511a;
    line-height: 1.8;
}

.basket-summary__checkout[aria-disabled='true'] {
    opacity: 0.5;
    pointer-events: none;
}

.basket-empty {
    padding: 48px 24px;
    text-align: center;
    background: #f7f7f7;
    border-radius: 18px;
}

@media (max-width: 640px) {
    .basket-page__header,
    .basket-page__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .basket-summary {
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .basket-row,
    .basket-quantity-form button,
    .basket-remove-button,
    .basket-clear-button {
        transition: none;
    }
}

.checkout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 28px;
    align-items: start;
}

.checkout-card,
.payment-result-card {
    padding: 24px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
}

.checkout-card h2,
.checkout-summary h2,
.payment-result-card h1 {
    margin-top: 0;
}

.checkout-form {
    display: grid;
    gap: 16px;
}

.checkout-form textarea,
.checkout-form input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: 10px;
}

.checkout-form textarea {
    min-height: 130px;
    resize: vertical;
}

.checkout-security-note,
.payment-result-warning {
    margin: 0;
    color: #76511a;
    line-height: 1.8;
}

.checkout-submit {
    border: 0;
    cursor: pointer;
}

.checkout-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkout-summary {
    margin-top: 0;
}

.payment-result-page {
    min-height: 55vh;
}

.payment-result-card {
    max-width: 680px;
    margin-inline: auto;
    text-align: center;
}

.payment-result-card[data-state='success'] {
    border-color: rgba(22, 138, 82, 0.35);
}

.payment-result-card[data-state='error'] {
    border-color: rgba(138, 28, 19, 0.25);
}

.payment-result-reference {
    display: grid;
    gap: 6px;
    margin: 24px 0;
}

.payment-result-reference dt {
    color: #666;
}

.payment-result-reference dd {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.payment-result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

@media (max-width: 760px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }

    .payment-result-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

/* NILERA_BASKET_CHECKOUT_PHONE_CLOSURE_V1_START */
.basket-page,
.basket-page .container,
.checkout-grid,
.checkout-card,
.checkout-summary,
.basket-summary {
    min-width: 0;
}

.basket-product__title,
.basket-product__meta,
.basket-summary__notice,
.checkout-security-note,
.payment-result-warning {
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    .basket-page {
        padding-block: 24px 38px;
    }

    .basket-page__header {
        gap: 14px;
        margin-bottom: 20px;
    }

    .basket-page__title {
        font-size: clamp(27px, 8vw, 34px);
    }

    .basket-table-wrapper {
        overflow: visible;
        border: 0;
        border-radius: 0;
    }

    .basket-table,
    .basket-table tbody,
    .basket-table tr,
    .basket-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .basket-table {
        min-width: 0;
    }

    .basket-table thead {
        display: none;
    }

    .basket-table tbody {
        display: grid;
        gap: 14px;
    }

    .basket-table tr {
        padding: 14px;
        overflow: hidden;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 16px;
        background: #fff;
    }

    .basket-table td {
        padding: 10px 0;
        border: 0;
    }

    .basket-table td + td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        border-top: 1px solid rgba(0, 0, 0, 0.07);
    }

    .basket-table td:nth-child(2)::before {
        content: 'قیمت';
    }

    .basket-table td:nth-child(3)::before {
        content: 'تعداد';
    }

    .basket-table td:nth-child(4)::before {
        content: 'جمع';
    }

    .basket-table td:nth-child(5)::before {
        content: 'حذف';
    }

    .basket-table td + td::before {
        flex: 0 0 auto;
        color: #666;
        font-size: 13px;
        font-weight: 700;
    }

    .basket-product {
        width: 100%;
        min-width: 0;
        align-items: flex-start;
    }

    .basket-product__image {
        width: 68px;
        height: 68px;
        flex: 0 0 68px;
    }

    .basket-product > div {
        min-width: 0;
    }

    .basket-quantity-form {
        margin-inline-start: auto;
    }

    .basket-quantity-form button,
    .basket-remove-button,
    .basket-clear-button {
        min-width: 44px;
        min-height: 44px;
    }

    .basket-page__actions {
        gap: 10px;
    }

    .basket-page__actions > *,
    .basket-page__actions form,
    .basket-page__actions button,
    .basket-page__actions a {
        width: 100%;
    }

    .basket-page__link,
    .basket-page__primary,
    .basket-clear-button {
        min-height: 48px;
        justify-content: center;
        text-align: center;
    }

    .basket-summary {
        margin-top: 20px;
        padding: 18px;
        border-radius: 16px;
    }

    .basket-summary__row {
        gap: 12px;
    }

    .checkout-grid {
        gap: 18px;
    }

    .checkout-card,
    .payment-result-card {
        padding: 18px;
        border-radius: 16px;
    }

    .checkout-form textarea,
    .checkout-form input {
        min-height: 50px;
        font-size: 16px;
    }

    .checkout-submit {
        width: 100%;
        min-height: 50px;
    }

    .payment-result-reference dd {
        font-size: 18px;
        overflow-wrap: anywhere;
    }
}
/* NILERA_BASKET_CHECKOUT_PHONE_CLOSURE_V1_END */
