/**
 * Стили для кастомной корзины
 */

/* Общие стили для корзины */
.custom-cart-container {
    max-width: 1600px;
    margin: 0 auto;
    padding-bottom: 150px;
    padding-top: 20px;
    font-family: 'Poppins', sans-serif;
}

.woocommerce-mini-cart__buttons .button.checkout {
    background: linear-gradient(135deg, #174982, #1a5aa0) !important;
    color: #ffffff !important;
    border: 1px solid #174982 !important;
    box-shadow: 0 4px 15px rgba(23, 73, 130, 0.3);
}

.woocommerce-mini-cart__buttons .button.checkout:hover,
.woocommerce-mini-cart__buttons .button.checkout:focus {
    background: linear-gradient(135deg, #1a5aa0, #2c6eb8) !important;
    color: #ffffff !important;
    border-color: #1a5aa0 !important;
    box-shadow: 0 6px 20px rgba(23, 73, 130, 0.4);
}

.custom-cart-header h2 {
    font-size: 28px;
    margin-bottom: 30px;
    font-weight: 600;
    color: #174982;
    text-align: center;
    font-family: 'Poppins', sans-serif;
}

.custom-cart-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.custom-cart-items {
    flex: 1 1 65%;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.custom-cart-sidebar {
    flex: 1 1 30%;
    min-width: 280px;
}

/* Заголовок таблицы корзины */
.cart-items-header {
    display: grid;
    grid-template-columns: 3fr 1fr 1.5fr 1fr 0.5fr;
    padding: 15px;
    background-color: #f7f7f7;
    font-weight: 600;
    font-size: 14px;
    color: #555;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.cart-items-header .cart-item-product {
    padding-left: 95px; /* Отступ для выравнивания с изображением товара */
}

.cart-items-header .cart-item-price,
.cart-items-header .cart-item-quantity,
.cart-items-header .cart-item-subtotal {
    display: flex;
    justify-content: center;
}

/* Элементы корзины */
.cart-items-body {
    padding: 0;
}

.cart-item {
    display: grid;
    grid-template-columns: 3fr 1fr 1.5fr 1fr 0.5fr;
    padding: 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-product {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cart-item-name {
    font-weight: 500;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.cart-item-name a {
    color: #174982;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cart-item-name a:hover {
    color: #0095EB;
    text-decoration: underline;
}

.cart-item-sku {
    font-size: 12px;
    color: #777;
}

.cart-item-price,
.cart-item-subtotal {
    font-weight: 500;
    color: #333;
    text-align: center;
}

.cart-item-quantity {
    display: flex;
    justify-content: center;
}

/* Отображение информации о налоге */
.tax-note {
    display: inline-block;
    font-size: 12px;
    color: #777;
    margin-left: 5px;
    font-weight: normal;
}

/* Контроль количества */
.quantity-control {
    display: flex;
    align-items: center;
    max-width: 200px;
    overflow: visible;
    background-color: #fff;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    background-color: #174982;
    border: 1px solid #174982;
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    user-select: none;
    box-shadow: 0 4px 10px rgba(23, 73, 130, 0.25);
}

/* Специальные стили для кнопок количества */
.plus-btn,
.minus-btn {
    background-color: #174982;
    color: #ffffff;
    border-color: #174982;
    z-index: 10;
    outline: none;
}

.quantity-btn:hover,
.quantity-btn:focus-visible {
    background-color: #0f3566;
    color: #ffffff;
    border-color: #0f3566;
    box-shadow: 0 6px 16px rgba(23, 73, 130, 0.3);
}

.quantity-input {
    width: 80px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 16px;
    color: #333;
    -moz-appearance: textfield;
    appearance: textfield;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    padding: 0 5px;
    min-width: 80px;
    cursor: text;
}

/* Отключаем все стандартные стили браузера для number input */
.quantity-input[type="number"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.quantity-input[type="number"]::-webkit-inner-spin-button,
.quantity-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Отключаем всплывающие подсказки */
.quantity-input::-webkit-input-placeholder {
    color: transparent;
}

.quantity-input::-moz-placeholder {
    color: transparent;
}

.quantity-input:-ms-input-placeholder {
    color: transparent;
}

/* Стили для наведения и фокуса */
.quantity-input:hover {
    border-color: #0073aa;
}

.quantity-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Дополнительные правила для отключения всплывающих подсказок */
.quantity-input::-webkit-validation-bubble-message {
    display: none;
}

.quantity-input:invalid {
    box-shadow: none;
}

.quantity-input:focus:invalid {
    box-shadow: 0 0 0 1px #0073aa;
}

/* Кнопка удаления товара */
.remove-item-btn {
    border: none;
    background: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.remove-item-btn:hover {
    background-color: #f5f5f5;
    color: #ff6b6b;
}

.remove-icon {
    line-height: 1;
}

/* Сайдбар с итогами */
.cart-summary {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.cart-summary h3 {
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
    color: #333;
    font-family: 'Poppins', sans-serif;
}

.cart-subtotal,
.cart-tax,
.cart-shipping,
.cart-total {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    color: #333;
}

.cart-total {
    font-weight: 600;
    font-size: 18px;
    margin-top: 10px;
    border-bottom: none;
}

.cart-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkout-btn,
.continue-shopping-btn {
    width: 100%;
    padding: 15px 20px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 16px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    display: block;
    font-family: 'Poppins', sans-serif;
}

.checkout-btn {
    background-color: #174982;
    color: #ffffff !important;
    border: 1px solid #174982;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(23, 73, 130, 0.25);
}

.checkout-btn:hover {
    background-color: #0f3566;
    color: #ffffff !important;
    border-color: #0f3566;
    box-shadow: 0 6px 18px rgba(23, 73, 130, 0.35);
}

.continue-shopping-btn {
    background-color: #174982;
    border: 1px solid #174982;
    color: #ffffff !important;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(23, 73, 130, 0.18);
}

.continue-shopping-btn:hover {
    background-color: #0f3566;
    color: #ffffff !important;
    border-color: #0f3566;
    box-shadow: 0 6px 16px rgba(23, 73, 130, 0.26);
}

/* Скрываем кнопки, которые не нужны */
.update-cart-btn,
.empty-cart-btn {
    display: none;
}

/* Пустая корзина */
.custom-cart-container.empty-cart {
    font-family: 'Poppins', sans-serif;
}

.custom-cart-container.empty-cart h2 {
    font-size: 28px;
    margin-bottom: 30px;
    font-weight: 600;
    color: #333;
    text-align: center;
    font-family: 'Poppins', sans-serif;
}

.custom-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 40px 20px;
    text-align: center;
}

.empty-cart-icon {
    margin-bottom: 20px;
}

.custom-cart-empty h3 {
    font-size: 22px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-family: 'Poppins', sans-serif;
}

.custom-cart-empty p {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
    font-family: 'Poppins', sans-serif;
}

.custom-cart-empty .continue-shopping-btn {
    padding: 15px 30px;
    background-color: #0095EB;
    color: #ffffff !important;
    border: none;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 149, 235, 0.2);
    text-decoration: none;
    border-radius: 4px;
    font-family: 'Poppins', sans-serif;
    display: inline-block;
    transition: all 0.2s;
}

.custom-cart-empty .continue-shopping-btn:hover {
    background-color: #0082CC;
    box-shadow: 0 4px 8px rgba(0, 149, 235, 0.3);
    text-decoration: none;
}

/* Уведомления */
.custom-cart-notification {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.notification-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 20px 25px;
    max-width: 400px;
    width: 90%;
    position: relative;
    text-align: center;
}

.notification-message {
    font-size: 16px;
    color: #333;
    font-family: 'Poppins', sans-serif;
    margin-bottom: 15px;
    font-weight: 500;
}

.notification-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: #666;
}

/* Адаптив для мобильных устройств */
@media (max-width: 768px) {
    .cart-items-header {
        display: none;
    }
    
    .cart-item {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 15px;
        position: relative;
    }
    
    .cart-item-product {
        grid-column: 1;
    }
    
    .cart-item-price,
    .cart-item-quantity,
    .cart-item-subtotal {
        grid-column: 1;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-left: 95px;
    }
    
    /* Используем атрибут data-label для отображения локализованных подписей на мобильных устройствах */
    .cart-item-price::before,
    .cart-item-quantity::before,
    .cart-item-subtotal::before {
        content: attr(data-label) ":";
        font-weight: normal;
        color: #777;
    }
    
    .cart-item-remove {
        position: absolute;
        top: 15px;
        right: 15px;
    }
    
    .custom-cart-content {
        flex-direction: column;
    }
    
    .custom-cart-sidebar {
        width: 100%;
    }
    
    .quantity-control {
        max-width: 100%;
        justify-content: flex-end;
        margin-right: 10px;
    }
    
    .quantity-input {
        width: 50px;
        min-width: 50px;
        max-width: 150px;
    }
    
    .quantity-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Дополнительные стили для iPhone и других мобильных устройств */
@media (max-width: 428px) {
    .cart-item {
        padding: 12px;
    }
    
    .cart-item-image {
        width: 70px;
        height: 70px;
    }
    
    .cart-item-price,
    .cart-item-quantity,
    .cart-item-subtotal {
        padding-left: 85px;
    }
    
    .quantity-control {
        margin-right: 5px;
        margin-left: 5px;
    }
    
    .quantity-input {
        width: 45px;
        min-width: 45px;
        font-size: 14px;
    }
    
    .quantity-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .cart-item-name {
        font-size: 14px;
    }
    
    .cart-item-sku {
        font-size: 11px;
    }
}

/* Стили для очень маленьких экранов */
@media (max-width: 360px) {
    .cart-item {
        padding: 10px;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
    }
    
    .cart-item-price,
    .cart-item-quantity,
    .cart-item-subtotal {
        padding-left: 75px;
    }
    
    .quantity-input {
        width: 40px;
        min-width: 40px;
    }
    
    .quantity-btn {
        width: 30px;
        height: 30px;
    }
}

/* Уведомления об ошибках валидации количества */
.custom-cart-quantity-error {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    left: 20px !important;
    background: #ff4757 !important;
    color: white !important;
    padding: 15px 20px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    z-index: 999999 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
    border: 3px solid #ff3742 !important;
    text-align: center !important;
    animation: slide-down 0.3s ease !important;
    max-width: 500px !important;
    margin: 0 auto !important;
    font-family: 'Poppins', sans-serif;
    line-height: 1.4;
}

@keyframes slide-down {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Стили для анимации изменения цен */
.price-updating {
    transition: all 0.3s ease;
    opacity: 0.7;
}

.price-updated {
    animation: price-flash 0.5s ease;
}

@keyframes price-flash {
    0% { background-color: transparent; }
    50% { background-color: rgba(0, 149, 235, 0.2); }
    100% { background-color: transparent; }
}

/* Стили для индикации активного состояния кнопок */
.quantity-btn.processing {
    opacity: 0.6;
    pointer-events: none;
}

.quantity-input.processing {
    opacity: 0.6;
    pointer-events: none;
}

/* Стили для мобильных уведомлений */
@media (max-width: 768px) {
    .custom-cart-quantity-error {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        font-size: 13px !important;
        padding: 12px 15px !important;
    }
}

@media (max-width: 428px) {
    .custom-cart-quantity-error {
        font-size: 12px !important;
        padding: 10px 12px !important;
    }
}

/* Шрифт Manrope только для русской версии */
html[lang*="ru"] .custom-cart-container,
html[lang*="ru"] .custom-cart-container *,
body.translatepress-ru_RU .custom-cart-container,
body.translatepress-ru_RU .custom-cart-container *,
.custom-cart-container [data-trp-translate-lang="ru_RU"],
.custom-cart-container [data-trp-translate-lang="ru_RU"] * {
  font-family: 'Manrope', 'Poppins', sans-serif !important;
}

/* Для латышской версии принудительно используем Poppins */
html[lang*="lv"] .custom-cart-container,
html[lang*="lv"] .custom-cart-container *,
body.translatepress-lv .custom-cart-container,
body.translatepress-lv .custom-cart-container *,
.custom-cart-container [data-trp-translate-lang="lv"],
.custom-cart-container [data-trp-translate-lang="lv"] * {
  font-family: 'Poppins', 'Manrope', sans-serif !important;
}
