/* Модальное окно корзины в стиле foton61.ru */

/* CSS переменные */
:root {
    --color-blue: #7861FF;
    --color-dark-blue: #4732bc;
    --color-light-blue: #B2A5FF;
    --color-gray: #6E6E6E;
    --color-dark-gray: #2C2C2C;
}

/* Анимации */
@keyframes open-cart {
    0% { display: none; opacity: 0; }
    1% { display: flex; opacity: 0; }
    100% { opacity: 1; display: flex; }
}

@keyframes close-cart {
    0% { opacity: 1; }
    1% { display: flex; opacity: 1; }
    100% { opacity: 0; display: none; }
}

/* Overlay */
.cart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 2% 10px 0 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-modal-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* Модальное окно */
.cart-modal {
    position: relative;
    background: #fff;
    border-radius: 10px;
    width: 80%;
    max-width: 70%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 2vh;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateY(0);
    opacity: 1;
}

/* Заголовок */
.cart-modal-header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding-bottom: 1vh;
    z-index: 1;
}

.cart-modal-header h2 {
    margin: 0;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    font-size: 4vh;
    color: #000;
}

.cart-modal-close {
    background: none;
    border: none;
    font-size: 3vh;
    color: #000;
    cursor: pointer;
    padding: 1vh;
    transition: color 0.2s ease;
}

.cart-modal-close:hover {
    color: var(--color-gray);
}

/* Разделитель */
.cart-modal-body {
    padding: 0;
}

.cart-modal-body hr,
.cart-divider {
    border: none;
    border-top: 0.2vh solid var(--color-gray);
    margin: 2vh 0;
}

/* Список товаров */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 2vh;
    padding: 1vh;
    margin: 0.5vh 0;
}

.cart-items::before {
    content: '';
    display: block;
    border-top: 0.2vh solid var(--color-gray);
    margin-bottom: 1vh;
}

.cart-item {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    user-select: none;
}

.cart-item-image {
    width: 6%;
    height: auto;
    align-self: center;
    object-fit: contain;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    padding: 1vh;
    gap: 1vh;
    width: 100%;
    margin-left: 3%;
}

.cart-item-name {
    font-size: 2.4vh;
    font-weight: 600;
    color: #000;
    width: 100%;
    margin: 0;
}

.cart-item-controls {
    display: flex;
    justify-content: flex-start;
    gap: 0.4vh;
    align-items: center;
}

.cart-item-qty-btn {
    padding: 2vh 3vh;
    background: transparent;
    border: none;
    font-size: 3vh;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #000;
}

.cart-item-qty-btn:hover {
    color: #fff;
    background: var(--color-blue);
}

.cart-item-qty-btn:active {
    background: var(--color-dark-blue);
}

.cart-item-qty {
    width: 15%;
    text-align: center;
    font-size: 3vh;
    border: none;
    background: transparent;
}

.cart-item-price {
    font-size: 3vh;
    color: #000;
    padding: 0 2vh;
    white-space: nowrap;
}

.cart-item-remove {
    align-self: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 3vh;
    padding: 2vh 3vh;
    background: transparent;
    border: none;
    color: #000;
}

.cart-item-remove:hover {
    color: #fff;
    background: #ff4444;
    transition: 0.2s;
}

.cart-item-remove:active {
    background: #be0000;
    transition: 0.1s;
}

/* Разделитель перед суммой */
.cart-items + hr,
.cart-divider {
    border: none;
    border-top: 0.2vh solid var(--color-gray);
    margin: 1vh 0;
}

/* Сумма */
.cart-total,
.cart-total-bottom {
    align-self: flex-end;
    font-size: 3vh;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    margin-top: 1.5vh;
    display: flex;
    gap: 1vh;
}

/* Кнопка продолжить покупки */
.cart-continue-btn {
    display: block;
    width: 100%;
    padding: 2%;
    background: var(--color-blue);
    color: #fff;
    border: none;
    border-radius: 1vh;
    font-size: 2.5vh;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1.5vh;
    text-align: center;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.cart-continue-btn:hover {
    background: var(--color-dark-blue);
}

.cart-continue-btn:active {
    background: var(--color-light-blue);
    transform: scale(1.01);
}

/* Форма оформления */
.cart-checkout-form {
    margin-top: 1.5vh;
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 2.7vh;
    color: #000;
    margin: 2vh 0;
    cursor: default;
}

.form-group input {
    width: 100%;
    padding: 2vh;
    border: 0.2vh solid var(--color-gray);
    border-radius: 0;
    font-size: 3vh;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-blue);
}

/* Кнопка оформить заказ */
.cart-checkout-btn {
    width: 100%;
    padding: 2%;
    background: var(--color-blue);
    color: #fff;
    border: none;
    border-radius: 1vh;
    font-size: 2.5vh;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1.5vh;
    text-align: center;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.cart-checkout-btn:hover {
    background: var(--color-dark-blue);
}

.cart-checkout-btn:active {
    background: var(--color-light-blue);
    transform: scale(1.01);
}

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

/* Пустая корзина */
.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.cart-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.cart-empty-text {
    font-size: 18px;
}

/* Счётчик товаров на иконке корзины - позиция снизу справа как у донора */
.cart-count {
	position: absolute;
    bottom: -3px;
    right: -3px;
    top: auto;
    left: auto;
    background: #ff4444;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    min-width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    font-family: 'Rubik', sans-serif;
}

/* Уведомление об успешном добавлении */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2ecc71;
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(150%);
    transition: transform 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.cart-notification.show {
    transform: translateX(0);
}

/* Успешное оформление заказа */
.order-success {
    text-align: center;
    padding: 40px 20px;
}

.order-success-icon {
    font-size: 64px;
    color: #2ecc71;
    margin-bottom: 20px;
}

.order-success-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.order-success-message {
    font-size: 16px;
    color: #666;
    line-height: 1.5;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .cart-modal-overlay {
        /* ИСПРАВЛЕНИЕ: Добавляем отступы по бокам для мобильных */
        padding: 2% 10px;
        box-sizing: border-box;
    }
    
    .cart-modal {
        width: 90%;
        max-width: calc(100% - 20px); /* ИСПРАВЛЕНИЕ: Отступ от краёв */
        margin: 0 auto;
        padding: 2vh;
    }
    
    .cart-modal-header h2 {
        font-size: 3vh;
    }
    
    .cart-modal-close {
        font-size: 2vh;
    }
    
    .cart-item {
        flex-wrap: wrap;
    }
    
    .cart-item-image {
        width: 10%;
    }
    
    .cart-item-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cart-item-name {
        width: 100%;
        font-size: 2vh;
    }
    
    .cart-item-controls {
        width: 100%;
        justify-content: flex-start;
        margin-top: 1vh;
    }
    
    .cart-item-qty-btn {
        padding: 1vh 1.3vh;
        font-size: 3vh;
    }
    
    .cart-item-qty {
        font-size: 2.5vh;
        width: 15%;
    }
    
    .cart-item-price {
        font-size: 2.5vh;
    }
    
    .cart-item-remove {
        font-size: 3vh;
        padding: 1vh 2vh;
    }
}

@media (max-width: 600px) {
    .cart-modal-overlay {
        /* ИСПРАВЛЕНИЕ: Добавляем отступы для маленьких экранов */
        padding: 2% 10px;
    }
    
    .cart-modal {
        width: calc(100% - 20px); /* ИСПРАВЛЕНИЕ: Гарантируем отступ 10px с каждой стороны */
        max-width: calc(100% - 20px);
        max-height: 95vh;
        margin: 0 auto;
    }
    
    .cart-item-controls {
        justify-content: space-between;
    }
    
    .cart-item-price {
        min-width: auto;
    }
}
