/* Стили для страницы корзины */

/* Основная структура страницы */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.b-main {
    flex: 1 0 auto;
    padding-bottom: 0;
}

.b-cart-layout {
    display: grid;
    gap: 24px;
    margin-top: 20px;
    min-height: 400px;
    align-items: start;
}

.b-cart-layout__main {
    min-width: 0;
}

/* Список товаров корзины */
.b-cart-items {
    display: flex;
    flex-direction: column;
    margin-top: 20px;
    background: white;
    border: 2px solid #2C2E29;
    border-radius: 10px;
    overflow: hidden;
}

.b-cart-layout .b-cart-items {
    margin-top: 0;
}

.b-cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 25px;
    border-bottom: 1px solid #e9ecef;
}

.b-cart-item:last-child {
    border-bottom: none;
}

.b-cart-item__image {
    width: 256px;
    overflow: hidden;
    border-radius: 5px;
}

.b-cart-item__image a {
    border-bottom: none;
}

.b-cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.b-cart-item__content {
    width: 100%;
}

.b-cart-item__info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.b-cart-item__title {
    margin: 0;
    font-size: 18px;
}


.b-cart-item__code {
    font-size: 14px;
    color: #888;
}

.b-cart-item__price {
    font-size: 16px;
    font-weight: 500;
}

.b-cart-item__quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.b-cart-item__qty-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #2C2E29;
    background: white;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.b-cart-item__qty-btn:hover {
    background: #FFBE0F;
}

.b-cart-item__qty {
    min-width: 30px;
    text-align: center;
    font-size: 18px;
}

.b-cart-item__total {
    font-size: 18px;
    font-weight: 600;
    text-align: right;
    padding: 0;
}

.b-cart-item__total .t-price {
    align-items: flex-end;
}

.b-cart-item__total .t-price__primary {
    display: inline-block;
    padding: 0 5px;
    background-color: #ffe6a2;
    border-radius: 5px;
}

.b-cart-item__total .t-price__secondary {
    margin-top: 2px;
}

span.b-cart-item__inactive {
    font-size: 18px;
    font-weight: 600;
    text-align: right;
}

.b-cart-item__remove-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #e74c3c;
    background: white;
    color: #e74c3c;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.b-cart-item__remove-btn:hover {
    background: #e74c3c;
    color: white;
}

.b-cart-item__right {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    min-width: 138px;
}

/* мобильный адаптив карточки в корзине */
@media (max-width: 540px) {
    .b-cart-item {
        padding: 15px 10px;
    }

    .b-cart-item__image {
        order: 0;
    }

    .b-cart-item__right {
        flex-direction: column;
    }

    .b-cart-item__total {
        order: 1;
        align-self: start;
        margin-bottom: 10px;
    }

    .b-cart-item__total .t-price {
        align-items: flex-start;
    }

    span.b-cart-item__inactive {
        text-align: left;
        align-self: start;
        margin-bottom: 10px;
    }

    .b-cart-item__content {
        order: 2;
        width: 100%;
    }

    .b-cart-item .b-cart-item__actions {
        gap: 8px;
    }
    .b-cart-item .b-cart-item__quantity {
        gap: 5px;
    }

    .b-cart-summary {
        padding: 15px 10px !important;
    }
}

@media (min-width: 768px) {
    span.b-cart-item__inactive {
        white-space: nowrap;
    }
}








/* Блок с итоговыми расчетами */
.b-cart-summary {
    margin-top: 40px;
    padding: 25px;
    background: white;
    border: 2px solid #2C2E29;
    border-radius: 10px;
    box-sizing: border-box;
}

.b-cart-layout .b-cart-summary {
    margin-top: 0;
}

.b-cart-summary__title {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: #2C2E29;
}

.b-cart-summary__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.b-cart-summary__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 5px;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}

.b-cart-summary__item--meta {
    padding: 0;
    background: transparent;
    font-size: 14px;
}

.b-cart-summary__item--total {
    background: #ffe6a2;
    color: #2C2E29;
    font-weight: 600;
    font-size: 18px;
}

.b-cart-summary__label {
    font-weight: 500;
}

.b-cart-summary__value {
    font-weight: 600;
    text-align: right;
}

.b-cart-summary__actions {
    text-align: center;
}

.b-cart-summary__total-placeholder {
    display: none;
}

@media (max-width: 768px) {
    .b-cart-summary__total-placeholder.is-active {
        display: block;
    }

    .b-cart-summary__item--total.is-mobile-stuck {
        position: fixed;
        top: var(--cart-total-sticky-top, 0);
        left: var(--cart-total-sticky-left, 10px);
        width: var(--cart-total-sticky-width, calc(100vw - 20px));
        margin: 0;
        z-index: 900;
        box-shadow: 0 4px 16px rgba(44, 46, 41, 0.18);
    }
}

@media (min-width: 1100px) {
    :root {
        --cart-summary-width: clamp(320px, 27vw, 360px);
        --cart-summary-gap: 24px;
        --cart-summary-side-offset: max(20px, calc((100vw - 1320px) / 2 + 20px));
        --cart-summary-top: 120px;
    }

    .b-cart-layout {
        grid-template-columns: minmax(0, 1fr) var(--cart-summary-width);
    }

    .b-cart-layout .b-cart-summary {
        position: fixed;
        top: var(--cart-summary-top);
        right: var(--cart-summary-side-offset);
        width: var(--cart-summary-width);
        max-height: calc(100vh - var(--cart-summary-top) - 20px);
        overflow-y: auto;
        z-index: 40;
    }
}

@media (max-width: 1099px) {
    .b-cart-layout .b-cart-summary {
        margin-top: 0;
    }
}


/* Форма оформления заказа */
.b-order-section {
    width: 100%;
    background: #f8f9fa;
    padding: 40px 0;
}

.b-order-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    box-sizing: border-box;
}

@media (min-width: 1100px) {
    .b-order-section {
        padding-left: var(--cart-summary-side-offset);
        padding-right: calc(var(--cart-summary-side-offset) + var(--cart-summary-width) + var(--cart-summary-gap));
        box-sizing: border-box;
    }
}

.b-order-form__title {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: #2C2E29;
    text-align: center;
}

.b-order-form__description {
    margin: 0 0 25px 0;
    color: #666;
    line-height: 1.5;
    text-align: center;
}

.b-order-form__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.b-order-form__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.b-order-form__address-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.b-order-form__shipping-block {
    gap: 12px;
    padding: 18px;
    border: 1px solid #e6e8eb;
    border-radius: 5px;
    background: #f8f9fa;
}

.b-order-form__billing-block {
    gap: 12px;
    padding: 18px;
    border: 1px solid #e6e8eb;
    border-radius: 5px;
    background: #f8f9fa;
}

.b-order-form__region-note {
    padding: 14px 16px;
    border: 1px solid #ffbe0f;
    border-radius: 5px;
    background: #fff7df;
    color: #5c4a11;
    line-height: 1.5;
}

.b-order-form__region-note[hidden] {
    display: none !important;
}

.b-order-form__shipping-fields,
.b-order-form__billing-fields {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.b-order-form__shipping-fields .b-order-form__input,
.b-order-form__billing-fields .b-order-form__input {
    width: 100%;
}

.b-order-form__shipping-fields .b-order-form__input + .b-order-form__input,
.b-order-form__billing-fields .b-order-form__input + .b-order-form__input {
    border-top: 0;
}

.b-order-form__readonly-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #000;
    cursor: default;
    user-select: text;
}

.b-order-form__readonly-label {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    color: #78828c;
}

.b-order-form__readonly-value {
    line-height: 1.35;
    color: #2C2E29;
}

.b-order-form__billing-body.is-disabled .b-order-form__readonly-field {
    border-color: #BCBCBC;
    background: #e7eaee;
    cursor: default;
}

.b-order-form__billing-body.is-disabled .b-order-form__readonly-label,
.b-order-form__billing-body.is-disabled .b-order-form__readonly-value {
    color: #78828c;
}

.b-order-form__billing-body {
    --billing-state-transition: 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity var(--billing-state-transition);
}

.b-order-form__billing-body .b-order-form__input {
    transition:
        background-color var(--billing-state-transition),
        border-color var(--billing-state-transition),
        color var(--billing-state-transition);
}

.b-order-form__billing-body .b-order-form__readonly-label,
.b-order-form__billing-body .b-order-form__readonly-value {
    transition: color var(--billing-state-transition);
}

.b-order-form__billing-body.is-disabled {
    opacity: 0.55;
}

.b-order-form__billing-body.is-disabled .b-order-form__input {
    background: #e7eaee;
    color: #78828c;
    cursor: not-allowed;
}

.b-order-form__billing-body .b-order-form__input:disabled {
    background: #e7eaee;
    color: #78828c;
    -webkit-text-fill-color: #78828c;
    cursor: not-allowed;
}

.b-order-form__fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .b-order-form__fields-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .b-order-form__address-columns {
        grid-template-columns: 1fr;
    }
}

.b-order-form__field--checkbox {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    padding: 15px;
}

.b-order-form__checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.b-order-form__label {
    font-weight: 500;
    color: #2C2E29;
}

.b-order-form__input,
.b-order-form__textarea {
    box-sizing: border-box;
    padding: 15px 16px;
    font-size: 16px;
    background: white;
    transition: all 0.3s ease;
    font-family: inherit;
}

.b-order-form__shipping-block .b-order-form__input::placeholder,
.b-order-form__billing-block .b-order-form__input::placeholder {
    color: #999;
    opacity: 1;
}

.b-order-form__select {
    cursor: pointer;
    line-height: 1.3;
}

.b-order-form__textarea {
    resize: none;
    min-height: 120px;
}

.b-order-form__checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
    border: 2px solid #2C2E29;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    transition: all 0.15s ease;
}

.b-order-form__checkbox:checked {
    background: #FFBE0F;
    border-color: #FFBE0F;
}

.b-order-form__checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #2C2E29;
    font-size: 14px;
    font-weight: bold;
}


.b-order-form__checkbox-label {
    font-size: 14px;
    line-height: 1.5;
    color: #2C2E29;
    margin: 0;
    cursor: pointer;
    flex: 1;
}

.b-order-form__actions {
    margin-top: 20px;
    text-align: center;
}

.b-order-form__submit-btn {
    min-width: 220px;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.b-order-form__submit-btn:disabled {
    background: #cccccc;
    border-color: #cccccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.b-order-form__submit-btn.is-loading,
.b-order-form__submit-btn.is-loading:disabled {
    background: #FFBE0F;
    border-color: #FFBE0F;
    color: transparent;
    opacity: 0.9;
}

.b-order-form__submit-btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(44, 46, 41, 0.25);
    border-top-color: #2C2E29;
    border-radius: 50%;
    animation: tesseract-order-spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes tesseract-order-spin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}


/* выбор страны для маски номера */

.b-country-item{
    display:flex;
    align-items:center;
    gap: 10px;
}

.b-country-flag{
    width: 22px;
    height: 16px;
    object-fit: cover;
}

.b-order-form__phone{
    display:flex;
    align-items:stretch;
    width:100%;

    background: #fff;
    border: 1px solid #000;

    overflow: hidden;
}

.b-order-form__phone #order-phone{
    border:0 !important;
    width: 100%;
}

.b-order-form__phone #order-phone:focus{
    outline: none;
    box-shadow: none;
}

#phone-country + .select2-container{
    width:56px !important;
    min-width:56px !important;
    flex: 0 0 56px;
}

#phone-country + .select2-container .select2-selection--single{
    height:100% !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;

    display:flex;
    align-items:center;
}

#phone-country + .select2-container .select2-selection--single{
    border-right:1px solid #ddd !important;
}

#phone-country + .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left:10px !important;
    padding-right:24px !important;
    line-height:44px !important;
    display:flex;
    align-items:center;
}

#phone-country + .select2-container--default .select2-selection--single .select2-selection__arrow {
    height:100% !important;
    right:6px !important;
}

#phone-country .select2-dropdown {
    border-radius: 0 !important;
}

.select2-container--open .select2-dropdown {
    min-width: 240px !important;
    width: auto !important;
}

.select2-container .select2-results__options > .select2-results__option::after,
.select2-container .select2-results__options > .select2-results__option::before{
    content: none !important;
    display: none !important;
}

/* hover по пункту в списке */
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable{
    background: #FFBE0F !important;
    color: #000 !important;
}

/* выбранный пункт в списке */
.select2-container--default .select2-results__option--selected{
    background: #ffeec1 !important;
    color: #000 !important;
}


/* Футер всегда внизу */
footer {
    flex-shrink: 0;
    margin-top: auto;
}

.b-cart-item__actions {
    display: inline-flex; gap: 20px; align-content: center;
}

/*------ Пустая корзина ------*/
.b-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    margin-top: 20px;
    min-height: 400px;
}

.b-cart-empty__icon {
    color: #2C2E29;
    margin-bottom: 30px;
    opacity: 0.6;
}

.b-cart-empty__icon svg {
    display: block;
    margin: 0 auto;
}

.b-cart-empty__title {
    font-size: 28px;
    font-weight: 600;
    color: #2C2E29;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.b-cart-empty__description {
    font-size: 16px;
    color: #666;
    margin: 0 0 30px 0;
    max-width: 400px;
    line-height: 1.5;
}

.b-cart-empty__button {
    display: inline-block;
    padding: 15px 30px;
    background: #2C2E29;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.3s ease;
    border: 2px solid #2C2E29;
}

.b-cart-empty__button:hover {
    background: transparent;
    color: #2C2E29;
    text-decoration: none;
}
