/* ===== Иконка корзины в header ===== */
.cart-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-icon {
    width: 24px;
    height: 24px;
    color: inherit;
    transition: transform 0.2s ease;
}

.cart-icon-wrapper:hover .cart-icon {
    transform: scale(1.1);
}

#cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #1a1a1a;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ===== Уведомление о добавлении в корзину ===== */
.cart-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: calc(100vw - 40px);
    width: 360px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cart-notification--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.cart-notification__content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-notification__icon {
    flex-shrink: 0;
    color: #10B981;
}

.cart-notification__text {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

.cart-notification__text strong {
    font-weight: 600;
}

.cart-notification__link {
    display: block;
    text-align: center;
    padding: 10px 16px;
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.cart-notification__link:hover {
    background: #333;
}

/* ===== Кнопка "В корзину" ===== */
.add-to-cart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.add-to-cart-button:hover {
    background: #333;
}

.add-to-cart-button:active {
    transform: scale(0.98);
}

.add-to-cart-button svg {
    width: 18px;
    height: 18px;
}

/* ===== Страница корзины ===== */
.cart-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 1rem;
    padding-bottom: calc(var(--cart-summary-height, 180px) + 24px);
}

.cart-page__title {
    display: none;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
}

.cart-empty__icon {
    width: 64px;
    height: 64px;
    color: #ccc;
    margin-bottom: 16px;
}

.cart-empty__title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.cart-empty__text {
    font-size: 15px;
    color: #666;
    margin-bottom: 24px;
}

.cart-empty__button {
    display: inline-block;
    padding: 12px 32px;
    background: #1a1a1a;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.cart-empty__button:hover {
    background: #333;
}

/* ===== Список товаров ===== */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Карточка товара (горизонтальная) ===== */
.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    position: relative;
}

.cart-item__image {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item__details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding-right: 28px; /* Место для крестика */
}

.cart-item__name {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    line-height: 1.3;
}

.cart-item__name:hover {
    text-decoration: underline;
}

.cart-item__options {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}

.cart-item__option {
    font-size: 12px;
    color: #888;
    line-height: 1.3;
}

.cart-item__price {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-top: auto;
}

/* Крестик удаления — справа вверху */
.cart-item__remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #bbb;
    border-radius: 50%;
    transition: color 0.2s ease, background 0.2s ease;
}

.cart-item__remove:hover {
    color: #e53935;
    background: rgba(229, 57, 53, 0.08);
}

.cart-item__remove svg {
    width: 18px;
    height: 18px;
}

/* ===== Фиксированный блок "Итого" ===== */
.cart-summary {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 16px 1rem;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.cart-summary__inner {
    max-width: 600px;
    margin: 0 auto;
}

.cart-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.cart-summary__row--total {
    border-top: 1px solid #eee;
    margin-top: 6px;
    padding-top: 12px;
    font-size: 17px;
    font-weight: 600;
}

.cart-summary__label {
    color: #666;
}

.cart-summary__value {
    font-weight: 500;
}

.cart-checkout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 15px 24px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.cart-checkout-button__icon {
    display: inline-flex;
    flex-shrink: 0;
}

.cart-checkout-button__icon[hidden] {
    display: none;
}

.cart-checkout-button__label {
    line-height: 1.2;
}

.cart-checkout-button--loading,
.cart-checkout-button--success-state {
    cursor: default;
}

.cart-checkout-button:hover {
    background: #333;
}

.cart-checkout-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cart-checkout-button:disabled .cart-checkout-button__label {
    color: #fff;
}

.cart-checkout-button--success-state:disabled {
    background: #3a3a3a;
    color: #fff;
    opacity: 1;
}

.cart-checkout-button svg {
    width: 20px;
    height: 20px;
}

.hidden {
    display: none !important;
}

/* Способ получения */
.cart-delivery-fieldset {
    border: none;
    margin: 16px 0 0;
    padding: 0;
    min-width: 0;
}

.cart-delivery-legend {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #1a1a1a;
    margin: 0 0 12px;
    padding: 0;
}

.cart-delivery-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-delivery-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 14px 14px 14px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cart-delivery-card:hover {
    border-color: #d0d0d0;
}

.cart-delivery-card--selected {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 1px #1a1a1a;
    background: #fafafa;
}

.cart-delivery-card__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cart-delivery-card__indicator {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border: 2px solid #cfcfcf;
    border-radius: 50%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.cart-delivery-card__input:checked + .cart-delivery-card__indicator {
    border-color: #1a1a1a;
    background: #1a1a1a;
    box-shadow: inset 0 0 0 4px #fff;
}

.cart-delivery-card__input:focus-visible + .cart-delivery-card__indicator {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

.cart-delivery-card__copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-delivery-card__title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.25;
}

.cart-delivery-card__sub {
    font-size: 13px;
    font-weight: 400;
    color: #757575;
    line-height: 1.35;
}

/* Inline-форма самовывоза */
.cart-pickup-panel {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
    margin-top: 0;
}

.cart-pickup-panel.is-open {
    max-height: 480px;
    opacity: 1;
    margin-top: 14px;
    pointer-events: auto;
}

.cart-pickup-panel__inner {
    padding-bottom: 4px;
}

.cart-pickup-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cart-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart-field__label {
    font-size: 12px;
    font-weight: 500;
    color: #1a1a1a;
    letter-spacing: 0.01em;
}

.cart-field__hint {
    font-weight: 400;
    color: #999;
}

.cart-field__input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 0 8px;
    font-size: 15px;
    font-family: inherit;
    color: #1a1a1a;
    background: transparent;
    border: none;
    border-bottom: 1px solid #d8d8d8;
    border-radius: 0;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cart-field__input::placeholder {
    color: #b0b0b0;
}

.cart-field__input:hover {
    border-bottom-color: #b0b0b0;
}

.cart-field__input:focus {
    border-bottom-color: #1a1a1a;
    box-shadow: 0 1px 0 0 #1a1a1a;
}

.cart-field--invalid .cart-field__input {
    border-bottom-color: #c62828;
    box-shadow: 0 1px 0 0 #c62828;
}

.cart-field__error {
    font-size: 12px;
    color: #c62828;
    line-height: 1.3;
}

.cart-field__error[hidden] {
    display: none !important;
}

.cart-pickup-success {
    padding: 8px 0 4px;
}

.cart-pickup-success__title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.cart-pickup-success__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #666;
}

/* ===== Wizard checkout ===== */
.cart-checkout-flow {
    margin-top: 18px;
}

.cart-flow-stage,
.cart-flow-stage--details {
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease, margin 0.25s ease;
}

.cart-flow-stage {
    max-height: 420px;
    opacity: 1;
}

.cart-flow-stage:not(.is-visible) {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    margin: 0;
}

.cart-flow-stage--details {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
}

.cart-flow-stage--details.is-visible {
    max-height: 1600px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    margin-top: 2px;
}

.cart-flow-title {
    margin: 14px 14px 14px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    color: #1a1a1a;
}

.cart-flow-methods,
.cart-radio-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-flow-card,
.cart-radio-card {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 14px;
    background: #fff;
    text-align: left;
    color: #1a1a1a;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.cart-flow-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: 'Manrope', sans-serif;
    font-style: normal;
    cursor: pointer;
}

.cart-flow-card:hover,
.cart-radio-card:hover {
    border-color: #cfcfcf;
}

.cart-flow-card:active {
    transform: scale(0.995);
}

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

.cart-flow-card__title,
.cart-radio-card__title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.cart-flow-card__sub,
.cart-radio-card__sub {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.4;
    color: #787878;
}

.cart-flow-card__chevron {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f4f4f4;
    color: #1a1a1a;
    box-shadow: inset 0 0 0 1px #e3e3e3;
}

.cart-flow-card__chevron svg {
    display: block;
}

.cart-flow-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fafafa;
    border: 1px solid #efefef;
}

.cart-flow-summary__main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.cart-flow-summary__check {
    color: #1a1a1a;
    font-size: 16px;
    line-height: 1.2;
}

.cart-flow-summary__copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.cart-flow-summary__title {
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.25;
}

.cart-flow-summary__sub {
    font-size: 12px;
    color: #777;
}

.cart-flow-summary__change {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cart-flow-details {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}

.cart-flow-details.is-visible {
    max-height: 1400px;
    opacity: 1;
}

.cart-flow-section {
    margin-bottom: 16px;
    padding: 18px 16px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #efefef;
}

.cart-flow-section:last-child {
    margin-bottom: 0;
}

.cart-flow-section__header {
    margin-bottom: 14px;
}

.cart-flow-section__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.cart-flow-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cart-radio-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.cart-radio-card--selected {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 1px #1a1a1a;
    background: #fafafa;
}

.cart-radio-card__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cart-radio-card__indicator {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    border: 2px solid #cfcfcf;
    border-radius: 50%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.cart-radio-card__input:checked + .cart-radio-card__indicator {
    border-color: #1a1a1a;
    background: #1a1a1a;
    box-shadow: inset 0 0 0 4px #fff;
}

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

.cart-radio-card__price {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}


.cart-flow-static {
    margin: 0;
    font-size: 15px;
    color: #1a1a1a;
}

.cart-flow-static--muted {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
    color: #777;
}

.cart-field__input--textarea {
    min-height: 96px;
    resize: vertical;
    padding-top: 12px;
}

.cart-flow-success {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

.cart-flow-success__title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.cart-flow-success__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #666;
}

.cart-summary {
    padding-top: 14px;
}

.cart-summary__row--total {
    font-size: 16px;
}

.cart-summary__note {
    margin: 10px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: #666;
}

.cart-checkout-button {
    min-height: 52px;
}

/* ===== Мобильная адаптация ===== */
@media (max-width: 480px) {
    .cart-page {
        padding-bottom: calc(var(--cart-summary-height, 180px) + 16px);
    }
    
    .cart-item__image {
        width: 80px;
        height: 80px;
    }
    
    .cart-item__name {
        font-size: 14px;
    }
    
    .cart-item__price {
        font-size: 14px;
    }
    
    .cart-notification {
        bottom: 10px;
        width: calc(100vw - 20px);
    }

    .cart-flow-card,
    .cart-radio-card,
    .cart-flow-section,
    .cart-flow-summary {
        padding-left: 14px;
        padding-right: 14px;
    }

    .cart-radio-card {
        align-items: center;
    }

    .cart-radio-card__price {
        font-size: 13px;
    }
}

/* Тестовая плашка */
.cart-test-banner {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 16px auto 0;
    max-width: 600px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cart-test-banner__icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: #856404;
}

.cart-test-banner__content {
    flex: 1;
}

.cart-test-banner__title {
    font-size: 14px;
    font-weight: 500;
    color: #856404;
    margin: 0 0 6px;
}

.cart-test-banner__text {
    font-size: 13px;
    color: #664d03;
    margin: 0;
    line-height: 1.5;
}

.cart-test-banner__link {
    color: #533f03;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cart-test-banner__link:hover {
    color: #1a1a1a;
}

@media (max-width: 767px) {
    .cart-test-banner {
        margin: 24px 24px 0;
        max-width: calc(100% - 48px);
        padding: 14px 16px;
    }
    
    .cart-test-banner__title {
        font-size: 13px;
    }
    
    .cart-test-banner__text {
        font-size: 12px;
    }
}

/* Модальное окно для недоступных товаров */
.cart-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cart-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.cart-modal__content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalAppear 0.2s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cart-modal__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: #b91c1c;
}

.cart-modal__text {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 1rem;
}

.cart-modal__list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.cart-modal__item {
    padding: 0.75rem;
    background: #fef2f2;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    border-left: 3px solid #ef4444;
}

.cart-modal__item:last-child {
    margin-bottom: 0;
}

.cart-modal__item small {
    color: #666;
}

.cart-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cart-modal__button {
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-align: center;
}

.cart-modal__button--primary {
    background: #1a1a1a;
    color: #fff;
}

.cart-modal__button--primary:hover {
    background: #333;
}

.cart-modal__button--secondary {
    background: #f5f5f5;
    color: #333;
}

.cart-modal__button--secondary:hover {
    background: #e5e5e5;
}