/* Page Title */
.page-title {
    text-align: center;
    margin: 2rem 0;
    font-size: 2rem;
    color: #2c3e50;
}

/* Container */
.products-container,
.cart-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.product-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 480px; /* Фиксированная минимальная высота */
}

.new-product {
    background: #20b2ab42;
    /* transform: translateY(-5px); */
    box-shadow: 0 0px 15px rgba(206, 33, 212, 0.342);
}


/* .product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
} */

.product-image {
    width: 100%;
    height: 250px;
    margin-bottom: 1rem;
    border-radius: 5px;
    overflow: hidden;
    background-color: #f8f9fa;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.new-product-image img {
    object-fit: contain;
} 

.img-contain img{
    object-fit: contain;
}

.product-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    min-height: 2.5rem;
    font-weight: 600;
}

.product-description {
    color: #7f8c8d;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    min-height: 3rem;
    flex-grow: 1; /* Занимает всё доступное пространство */
}

.product-price-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: center;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #e74c3c;
    flex-shrink: 0;
}

/* Quantity Selector */
.quantity-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    background-color: #20b2aa;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.quantity-btn:hover {
    background-color: #1a8d87;
}

.quantity-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.quantity-input {
    width: 50px;
    height: 36px;
    text-align: center;
    font-size: 1rem;
    border: 2px solid #20b2aa;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.3s;
}

.quantity-input:focus {
    border-color: #1a8d87;
}

/* Скрытие стрелок у поля ввода количества */
.quantity-input {
    -webkit-appearance: textfield; /* Для Safari и Chrome */
    -moz-appearance: textfield;    /* Для Firefox */
    appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Дополнительные стили для чистого вида */
.quantity-input {
    padding: 0;
    text-align: center;
    font-size: 1rem;
    height: 36px;
    line-height: 36px;
}

/* Product Actions */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: auto;
    flex-shrink: 0;
}

.btn-add-to-cart { 
    text-decoration: none;
    background-color: #20b2aa;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
}

.btn-add-to-cart:hover {
    background-color: #1a8d87;
    transform: translateY(-2px);
}

/* Стиль для кнопки "В корзине" */
.btn-add-to-cart.in-cart {
    background-color: #27ae60;
    cursor: default;
}

.btn-add-to-cart.in-cart:hover {
    background-color: #229954;
    transform: none;
}


/* Кнопка "Предзаказ" */
.btn-preorder {
    text-decoration: none;
    background-color: #cc65bed5;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
    text-align: center;
} 

.btn-link {
    text-decoration: none;
    color: white;
    text-align: center;
}

.btn-preorder:hover {
    background-color: #c534b2d5;
    transform: translateY(-2px);
}

/* Кнопка "Подробнее" */
.btn-details {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
    width: 100%;
}

.btn-details:hover {
    background-color: #2980b9;
}

/* Состояние товара в корзине - новый интерфейс */
.product-card.in-cart .quantity-selector {
    display: none;
}

.product-card.in-cart .btn-add-to-cart {
    display: none;
}

.product-card.in-cart .btn-details {
    margin-top: 0.5rem;
}

/* кнопка удаления из корзины */
.btn-remove-from-cart {
    width: 42px;
    height: 36px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    z-index: 100;
}

.btn-remove-from-cart:hover {
    background-color: #c0392b;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.btn-remove-can-icon {
    width: 20px;
    filter: brightness(0) invert(1) sepia(1) saturate(5) hue-rotate(280deg);
    pointer-events: none;
    object-fit: contain;
}

/* Контейнер для информации о товаре в корзине */
.cart-info-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8f9fa;
    padding: 0.4rem 1rem;
    border-radius: 5px;
    /* margin-bottom: 0.8rem; */
    border: 2px solid #20b2aa;
}

.cart-info-container .cart-info-text {
    font-weight: 600;
    color: #20b2aa;
    font-size: 0.95rem;
}

/* Кнопка удаления - маленькая квадратная с иконкой ведра */
.btn-remove-from-cart {
    width: 42px;
    height: 42px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.btn-remove-from-cart:hover {
    background-color: #c0392b;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.btn-remove-from-cart:active {
    transform: scale(0.95);
}

/* Product Details Popup */
.product-details-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 2rem;
}

.product-details-popup.active {
    display: flex;
}

.popup-content {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
}

.popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: #7f8c8d;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.popup-close:hover {
    background-color: #f8f9fa;
    color: #e74c3c;
}

.popup-content h4 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #20b2aa;
    padding-bottom: 0.5rem;
}

.popup-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.popup-content ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
    color: #34495e;
}

.popup-content li {
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 968px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .product-card {
        min-height: 500px;
    }
    
    .popup-content {
        max-width: 500px;
    }
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-card {
        padding: 1rem;
        min-height: 460px;
    }
    
    .product-image {
        height: 250px;
    }
    
    .popup-content {
        padding: 1.5rem;
    }
    
    .popup-close {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .cart-info-container {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}