/* Cart Sidebar Styles - Стили для боковой панели корзины */

/* Панель корзины */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    height: 100dvh; /* Динамический viewport height для мобильных */
    background-color: #ffffff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.cart-sidebar.active {
    transform: translateX(0);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.cart-title {
    font-size: 1rem;
    font-weight: 400;
    color: #000;
    margin: 0;
    font-family: inherit;
}

.cart-close {
    background: none;
    border: none;
    font-size: 2rem;
    font-weight: 100;
    line-height: 1;
    color: #000;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.cart-close:hover {
    opacity: 0.6;
}

.cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.cart-items {
    padding: 0;
}

.cart-item {
    display: flex;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    gap: 16px;
    align-items: flex-start;
    position: relative;
}

.cart-item-image-wrapper {
    width: 25%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cart-item-image {
    width: 100%;
    aspect-ratio: 3 / 4;
    align-self: flex-start;
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-category {
    font-size: 0.75rem;
    color: #666;
    margin: 0;
    text-transform: capitalize;
}

.cart-item-name {
    font-size: 0.9rem;
    color: #000;
    margin: 0;
    font-weight: 400;
    margin-bottom: 10px;
}

.cart-item-color {
    font-size: 0.75rem;
    font-weight: 300;
    color: #666;
    margin: 0;
}

.cart-item-size {
    font-size: 0.75rem;
    font-weight: 300;
    color: #666;
    margin: 0;
}

.cart-item-price {
    font-size: 0.9rem;
    color: #000;
    margin: 15px 0 0 0;
    font-weight: 400;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    width: 100%;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-quantity-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    color: #000;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    font-family: inherit;
    min-width: 24px;
    min-height: 24px;
}

.cart-quantity-btn .cart-icon {
    width: 18px;
    height: 18px;
    stroke: #000;
    fill: none;
}

/* При количестве = 1: кнопка удаления вместо знака "-" */
.cart-item[data-quantity="1"] .cart-quantity-decrease {
    padding: 4px;
}

.cart-item[data-quantity="1"] .cart-quantity-decrease .cart-icon {
    width: 18px;
    height: 18px;
    stroke: #666;
    fill: none;
}

.cart-quantity-btn:hover:not(:disabled) {
    opacity: 0.6;
}

.cart-quantity-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cart-quantity-btn .cart-icon {
    display: block;
}

.cart-quantity-value {
    font-size: 0.9rem;
    color: #000;
    min-width: 24px;
    text-align: center;
}

.cart-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

/* При количестве > 1: корзинка в правом нижнем углу под сердечком */
.cart-item[data-quantity]:not([data-quantity="1"]) .cart-item-remove {
    position: absolute;
    bottom: 20px;
    right: 24px;
    z-index: 1;
}

/* При количестве = 1: кнопка удаления не отображается отдельно (она в кнопке decrease) */
.cart-item[data-quantity="1"] .cart-item-remove {
    display: none;
}

.cart-item-remove svg,
.cart-item-remove .cart-icon {
    width: 18px;
    height: 18px;
    stroke: #666;
    fill: none;
}

.cart-item-remove:hover {
    opacity: 0.6;
}

.cart-item-wishlist {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    z-index: 1;
}

.cart-item-wishlist .wishlist-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) saturate(100%);
}

.cart-item-wishlist:hover {
    opacity: 0.6;
}

.cart-item-wishlist.active .wishlist-icon {
    filter: brightness(0) saturate(100%) invert(27%) sepia(100%) saturate(7500%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.cart-empty {
    display: none;
    padding: 60px 24px;
    text-align: center;
    color: #666;
}

.cart-empty.active {
    display: block;
}

.cart-footer {
    padding: 20px 24px;
    border-top: 1px solid #e0e0e0;
    background-color: #ffffff;
    flex-shrink: 0; /* Предотвращаем сжатие footer */
    position: relative; /* Для правильного позиционирования */
    z-index: 1; /* Чтобы footer был поверх контента при скролле */
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0; 
}

.cart-total-label {
    font-size: 0.9rem;
    color: #000;
}

.cart-total-amount {
    font-size: 1rem;
    color: #000;
    font-weight: 400;
}

.btn-view-cart {
    width: 100%;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .cart-sidebar {
        max-width: 100%;
        height: 100dvh; /* Используем динамический viewport height */
    }
    
    .cart-footer {
        padding: 16px 20px;
        /* Добавляем безопасную зону для iOS */
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
    
    .cart-item {
        padding: 16px 20px;
    }
    
    .cart-item-image-wrapper {
        width: 100%;
        max-width: 25%;     
    }
    
    .cart-item-image {
        width: 100%;
    }
}

