/* ===== ИКОНКА КОРЗИНЫ В ШАПКЕ ===== */
.cart-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(230, 126, 34, 0.08);
    padding: 10px 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 20px;
    border: 1.5px solid rgba(230, 126, 34, 0.15);
    position: relative;
}

.cart-icon:hover {
    background: rgba(230, 126, 34, 0.15);
    transform: scale(1.05);
    border-color: #e67e22;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.2);
}

.cart-icon__emoji {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.cart-icon:hover .cart-icon__emoji {
    transform: rotate(-5deg) scale(1.1);
}

.cart-icon__count {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
    display: inline-block;
}

.cart-icon__count:empty {
    display: none;
}

/* ===== ОВЕРЛЕЙ ===== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    backdrop-filter: blur(4px);
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== ВЫЕЗЖАЮЩАЯ КОРЗИНА ===== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -480px;
    width: 100%;
    max-width: 440px;
    height: 100vh;
    background: #ffffff;
    z-index: 1000;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

/* ===== ЗАГОЛОВОК ===== */
.cart-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px;
    background: linear-gradient(135deg, #1a252f, #2c3e50);
    color: white;
}

.cart-sidebar__header h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-sidebar__header h3::before {
    content: '🛒';
    font-size: 24px;
}

.cart-sidebar__close {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cart-sidebar__close:hover {
    background: #e74c3c;
    border-color: #e74c3c;
    transform: rotate(90deg);
}



/* ===== ТЕЛО КОРЗИНЫ ===== */
.cart-sidebar__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.cart-sidebar__body::-webkit-scrollbar {
    width: 6px;
}

.cart-sidebar__body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

/* ===== ПУСТАЯ КОРЗИНА ===== */
.cart-empty-sidebar {
    text-align: center;
    padding: 60px 30px;
    animation: fadeIn 0.5s ease;
}

.cart-empty__icon {
    font-size: 80px;
    margin-bottom: 25px;
    opacity: 0.3;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.cart-empty-sidebar p {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 18px;
    font-weight: 500;
}

/* ===== ТОВАРЫ В КОРЗИНЕ ===== */
.cart-items-sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item-sidebar {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
    animation: slideLeft 0.4s ease;
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.cart-item-sidebar:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: rgba(230, 126, 34, 0.2);
}

.cart-item-sidebar__info {
    flex: 1;
}

.cart-item-sidebar__name {
    font-size: 16px;
    font-weight: 600;
    color: #1a252f;
    margin-bottom: 8px;
    padding-right: 30px;
    line-height: 1.3;
}

.cart-item-sidebar__price {
    font-size: 20px;
    font-weight: 700;
    color: #e67e22;
    margin-bottom: 15px;
}

/* ===== КОНТРОЛЫ КОЛИЧЕСТВА ===== */
.cart-item-sidebar__quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 6px;
    border-radius: 12px;
    width: fit-content;
}

.quantity-btn-sidebar {
    width: 34px;
    height: 34px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #1a252f;
}

.quantity-btn-sidebar:hover {
    background: #e67e22;
    color: white;
    border-color: #e67e22;
    transform: scale(1.05);
}

.quantity-btn-sidebar:active {
    transform: scale(0.95);
}

.quantity-input-sidebar {
    width: 50px;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 8px 5px;
    font-size: 15px;
    font-weight: 600;
    color: #1a252f;
    background: white;
    transition: border-color 0.2s ease;
}

.quantity-input-sidebar:focus {
    outline: none;
    border-color: #e67e22;
}

/* ===== КНОПКА УДАЛЕНИЯ ===== */
.cart-item-sidebar__remove {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: rgba(231, 76, 60, 0.1);
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #e74c3c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cart-item-sidebar__remove:hover {
    background: #e74c3c;
    color: white;
    transform: scale(1.1);
}

/* ===== ФУТЕР КОРЗИНЫ ===== */
.cart-sidebar__footer {
    padding: 25px;
    background: #ffffff;
    border-top: 1px solid #eee;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

.cart-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    color: #666;
}

.cart-summary__total {
    font-size: 22px;
    font-weight: 700;
    color: #1a252f;
    padding-top: 15px;
    margin-top: 15px;
    border-top: 2px dashed #e0e0e0;
}

.cart-summary__total span:last-child {
    color: #e67e22;
}

/* ===== КНОПКИ В КОРЗИНЕ ===== */
.btn--block {
    width: 100%;
    margin-top: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 14px;
    transition: all 0.3s ease;
}

.btn--primary {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.3);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(230, 126, 34, 0.4);
}

.btn--outline {
    background: transparent;
    border: 2px solid #e0e0e0;
    color: #666;
}

.btn--outline:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn--small {
    padding: 12px 20px;
    font-size: 14px;
}

/* ===== КНОПКА "В КОРЗИНУ" В КАТАЛОГЕ ===== */
.catalog-card__add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    width: 100%;
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.catalog-card__add-to-cart::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.catalog-card__add-to-cart:hover {
    background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
    transform: translateY(-3px);    
    box-shadow: 0 8px 25px rgba(230, 126, 34, 0.35);
}

.catalog-card__add-to-cart:hover::before {
    left: 100%;
}

.catalog-card__add-to-cart:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

/* Состояние "Добавлено" */
.catalog-card__add-to-cart.added {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    pointer-events: none;
    gap: 8px;
}

.catalog-card__add-to-cart.added::after {
    content: ' ✓';
    font-size: 18px;
    font-weight: bold;
    animation: checkmark 0.4s ease;
}

@keyframes checkmark {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.catalog-card__add-to-cart .cart-icon-small {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.catalog-card__add-to-cart:hover .cart-icon-small {
    transform: rotate(-5deg) scale(1.1);
}

/* ===== УВЕДОМЛЕНИЕ ===== */
.cart-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #1a252f, #2c3e50);
    color: white;
    padding: 16px 28px;
    border-radius: 16px;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-notification::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #27ae60;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
}

/* ===== УВЕДОМЛЕНИЕ КОРЗИНЫ ===== */
.cart-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1a252f;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    z-index: 2000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

/* Сообщения формы */
.form-message {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.form-message--success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message--error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Анимации */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== БЛОКИРОВКА СКРОЛЛА ===== */
body {
    overflow-x: hidden;
}

body.cart-open {
    overflow: hidden !important;
    touch-action: none;          /* предотвращает жесты сдвига */
    position: fixed;            /* фиксирует вьюпорт, убирая скролл */
    width: 100%;
}

/* ===== АДАПТИВНОСТЬ КОРЗИНЫ ===== */
@media (max-width: 900px) {
    .cart-icon {
        padding: 8px 14px;
        margin-left: 0;
    }

    .cart-sidebar {
        width: 100vw;                 /* ← принудительно = ширина экрана */
        max-width: 100vw;            /* ← снимает ограничение в 440px */
        right: -100vw;               /* ← скрыта за пределами ширины */
        box-sizing: border-box;      /* ← гарантирует учёт паддингов */
    }

    /* уменьшаем шапку */
    .cart-sidebar__header {
        padding: 15px 18px;
    }
    .cart-sidebar__header h3 {
        font-size: 17px;
    }

    /* тело корзины – меньше отступы */
    .cart-sidebar__body {
        padding: 12px 14px;
    }

    /* карточка товара */
    .cart-item-sidebar {
        padding: 12px 12px 12px 0;
    }
    .cart-item-sidebar__name {
        font-size: 13px;
        padding-right: 24px;
    }
    .cart-item-sidebar__price {
        font-size: 16px;
        margin-bottom: 10px;
    }

    /* кнопки количества */
    .quantity-btn-sidebar {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    .quantity-input-sidebar {
        width: 36px;
        padding: 6px 4px;
        font-size: 13px;
    }

    /* кнопка удаления */
    .cart-item-sidebar__remove {
        top: 10px;
        right: 10px;
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    /* футер корзины */
    .cart-sidebar__footer {
        padding: 16px 18px;
    }
    .cart-summary__row {
        font-size: 14px;
    }
    .cart-summary__total {
        font-size: 18px;
    }

    /* кнопки в футере */
    .btn--block {
        padding: 12px;
        font-size: 14px;
    }

    /* иконка и счётчик */
    .cart-icon__emoji {
        font-size: 18px;
    }
    .cart-icon__count {
        font-size: 10px;
        padding: 2px 6px;
        min-width: 18px;
    }

    /* уведомление */
    .cart-notification {
        bottom: 15px;
        right: 15px;
        left: 15px;
        max-width: calc(100% - 30px);
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .cart-sidebar {
        max-width: 100%;
    }

    .cart-item-sidebar__name {
        font-size: 13px;
    }

    .cart-item-sidebar__price {
        font-size: 16px;
    }

    .quantity-btn-sidebar {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .quantity-input-sidebar {
        width: 40px;
        padding: 6px 4px;
        font-size: 14px;
    }

    .cart-summary__total {
        font-size: 18px;
    }
}

@media (max-width: 400px) {
    .cart-sidebar__header h3 {
        font-size: 15px;
    }
    .cart-sidebar__close {
        width: 32px;
        height: 32px;
    }
    .cart-item-sidebar__name {
        font-size: 12px;
    }
    .cart-item-sidebar__price {
        font-size: 14px;
    }
    .quantity-btn-sidebar {
        width: 24px;
        height: 24px;
    }
    .quantity-input-sidebar {
        width: 30px;
        padding: 4px 2px;
        font-size: 12px;
    }
    .cart-summary__total {
        font-size: 16px;
    }
}