/* ==========================================================================
   КОРЗИНА (.cart-list, .cart-item, .cart-summary)
   ========================================================================== */
.cart-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.cart-item {
    display: flex;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.cart-item__photo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid var(--border);
}

.cart-item__photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-item__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: var(--surface-muted);
}

.cart-item__body {
    flex: 1;
    min-width: 0;
}

.cart-item__title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
}

.cart-item__meta {
    font-size: 0.8rem;
    color: var(--hint);
    margin-top: 2px;
}

.cart-item__right {
    text-align: right;
    flex-shrink: 0;
}

.cart-item__subtotal {
    font-weight: 800;
    font-size: 1rem;
}

.cart-item__remove {
    border: none;
    background: transparent;
    color: #ff3b30;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 0 0;
}

.cart-qty {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
}

.cart-qty__btn {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1.1rem;
    width: 24px;
    height: 24px;
    line-height: 1;
    cursor: pointer;
}

.cart-qty__value {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.cart-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    position: sticky;
    bottom: calc(var(--tabbar-h-mobile) + 10px + env(safe-area-inset-bottom));
    z-index: 50;
    box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
    html:not(.is-tg-webapp) .cart-summary {
        bottom: 20px;
    }
}

.cart-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 1.05rem;
}

.cart-summary__total {
    font-weight: 800;
    font-size: 1.2rem;
}

/* ==========================================================================
   ИСТОРИЯ ЗАКАЗОВ (.order-list, .order-card)
   ========================================================================== */
.order-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 1024px) {
    html:not(.is-tg-webapp) .order-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
        align-items: start;
    }
}

.order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.order-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.order-card__id {
    font-weight: 800;
    font-size: 1rem;
}

.order-card__status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 8px;
    background: rgba(128, 128, 128, 0.16);
}

.order-card__status.status--paid,
.order-card__status.status--delivered {
    background: rgba(52, 199, 89, 0.16);
    color: #16a34a;
}

.order-card__status.status--pending {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}

.order-card__status.status--refunded {
    background: rgba(255, 59, 48, 0.16);
    color: #dc2626;
}

.order-card__date {
    font-size: 0.8rem;
    color: var(--hint);
    margin: 6px 0 12px;
}

.order-card__items {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.order-card__items li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.order-card__items li > span:first-child {
    min-width: 0;
    word-break: break-word;
}

.order-card__items li > span:last-child {
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 600;
}

.order-card__total {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-weight: 800;
    font-size: 1.05rem;
    text-align: right;
}

.order-refund-btn {
    margin-top: 12px;
    width: 100%;
    border: 1px solid #ff3b30;
    background: transparent;
    color: #ff3b30;
    border-radius: var(--radius-sm);
    padding: 9px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.order-refund-btn:disabled {
    opacity: 0.5;
}

.checkout-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.checkout-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 12px;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 768px) {
    html:not(.is-tg-webapp) .checkout-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    html:not(.is-tg-webapp) .checkout-grid__full {
        grid-column: 1 / -1;
    }
}

.store-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
}

.store-input:focus {
    outline: none;
    border-color: var(--accent);
}

.store-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.store-modal.is-open {
    display: flex;
}

.store-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

.store-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-md);
    z-index: 1;
}

@media (min-width: 768px) {
    html:not(.is-tg-webapp) .store-modal {
        align-items: center;
        padding: 16px;
    }
    html:not(.is-tg-webapp) .store-modal__dialog {
        border-radius: var(--radius-lg);
        padding-bottom: 24px;
    }
}

.store-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.store-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.store-modal__close {
    border: none;
    background: var(--surface);
    color: var(--hint);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
}

.store-modal__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-card__delivery {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    font-size: 0.82rem;
    color: var(--hint);
    line-height: 1.4;
}