/* Стили для таблицы корзины с колонкой "Итого" */

/* Основные стили для таблицы корзины */
.busket__table {
    table-layout: fixed;
}

/* Настройка ширины колонок */
.busket__table thead tr td:nth-child(1) {
    width: 40%; /* Наименование */
}

.busket__table thead tr td:nth-child(2) {
    width: 15%; /* Цена */
}

.busket__table thead tr td:nth-child(3) {
    width: 15%; /* Количество */
}

.busket__table thead tr td:nth-child(4) {
    width: 20%; /* Итого */
}

.busket__table thead tr td:nth-child(5) {
    width: 10%; /* Кнопка удаления */
}

/* Стили для колонки "Итого" */
.cart-item-total {
    text-align: center;
    font-weight: bold;
    color: #4f73a6;
}

.cart-item-total strong {
    font-size: 1.1em;
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 767px) {
    /* На мобильных устройствах таблица становится вертикальной */
    .busket__table thead tr td:nth-child(1),
    .busket__table thead tr td:nth-child(2),
    .busket__table thead tr td:nth-child(3),
    .busket__table thead tr td:nth-child(4),
    .busket__table thead tr td:nth-child(5) {
        width: auto;
    }
    
    /* Стили для мобильного отображения колонки "Итого" */
    .busket__table tbody td[data-before="Итого:"] {
        background-color: #f8f9fa;
        border-left: 3px solid #4f73a6;
    }
    
    .busket__table tbody td[data-before="Итого:"] .cart-item-total {
        text-align: left;
        padding: 10px 0;
    }
    
    .busket__table tbody td[data-before="Итого:"] .cart-item-total strong {
        font-size: 1.2em;
        color: #4f73a6;
    }
}

/* Дополнительные стили для улучшения внешнего вида */
.busket__table tbody td {
    vertical-align: middle;
}

/* Выравнивание текста в колонках */
.busket__table tbody td:nth-child(2), /* Цена */
.busket__table tbody td:nth-child(4) { /* Итого */
    text-align: center;
}

.busket__table tbody td:nth-child(3) { /* Количество */
    text-align: center;
}

.busket__table tbody td:nth-child(5) { /* Кнопка удаления */
    text-align: center;
}

/* Стили для общей суммы */
.busket__total {
    margin-top: 20px;
    padding: 15px 20px;
    background-color: #f1f8ff;
    border: 2px solid #4f73a6;
    border-radius: 5px;
    text-align: right;
    font-size: 1.2em;
    font-weight: bold;
    color: #4f73a6;
}

.busket__total span {
    font-size: 1.3em;
    color: #2c5282;
}

/* Анимация при обновлении итого по позициям */
.cart-item-total.cart-animating {
    position: relative;
    overflow: hidden;
}

.cart-item-total.cart-animating::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(79, 115, 166, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

.cart-item-total.cart-updated {
    background-color: #e8f5e8;
    border-radius: 4px;
    transition: background-color 0.5s ease;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* Анимация для общей суммы корзины */
.busket__total #cart-total.cart-total-animating {
    position: relative;
    overflow: hidden;
}

.busket__total #cart-total.cart-total-animating::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(79, 115, 166, 0.4), transparent);
    animation: shimmer 1.8s infinite;
}

.busket__total #cart-total.cart-total-updated {
    background-color: #e3f2fd;
    border-radius: 4px;
    padding: 2px 6px;
    transition: all 0.5s ease;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.4);
    transform: scale(1.05);
}

/* Анимация мерцания */
@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Дополнительные эффекты для чисел */
.cart-item-total strong,
.busket__total #cart-total {
    transition: color 0.3s ease;
}

.cart-item-total.cart-animating strong {
    color: #4f73a6;
    font-weight: bold;
}

.busket__total #cart-total.cart-total-animating {
    color: #1976d2;
    font-weight: bold;
}

/* Стили для пустой корзины */
.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.cart-empty h2 {
    margin-bottom: 10px;
    color: #666;
}

.cart-empty p {
    margin-bottom: 30px;
    color: #999;
}

/* Стили для ссылок на товары в корзине */
.cart-product-link {
    color: #4f73a6;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.cart-product-link:hover {
    color: #2c5282;
    text-decoration: none;
    border-bottom: 1px solid #4f73a6;
    transform: translateY(-1px);
}

.cart-product-link:focus {
    outline: 2px solid #4f73a6;
    outline-offset: 2px;
    border-radius: 2px;
}

.cart-product-link:active {
    color: #1a365d;
    transform: translateY(0);
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 767px) {
    .cart-product-link {
        font-size: 0.95em;
        line-height: 1.4;
    }
    
    .cart-product-link:hover {
        transform: none; /* Убираем эффект поднятия на мобильных */
    }
}
