/* === Основные стили === */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f8f8;
}

/* === Header === */
header {
    background-color: #333;
    color: #fff;
    padding: 10px 20px;
    text-align: center;
}
header h1 {
    margin: 0;
    font-size: 24px;
}
header nav {
    margin-top: 10px;
}
header nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 10px;
}
header nav a:hover {
    text-decoration: underline;
}

/* === Footer === */
footer {
    background-color: #333;
    color: #fff;
    padding: 10px 20px;
    text-align: center;
}
footer a {
    color: #fff;
    text-decoration: none;
    margin: 0 10px;
}
footer a:hover {
    text-decoration: underline;
}
.footer-container {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    background-color: #333;
    color: #fff;
}
.footer-column {
    flex: 1;
    margin-right: 20px;
}
.footer-column h3 {
    font-size: 18px;
    margin-bottom: 10px;
}
.footer-column ul {
    list-style: none;
    padding: 0;
}
.footer-column ul li {
    margin-bottom: 5px;
}
.footer-column ul li a {
    color: #fff;
    text-decoration: none;
}
.footer-column ul li a:hover {
    text-decoration: underline;
}

/* === Статьи карточек на главной/категориях === */
.homepage .products-container,
.products-page .products-container,
.category-page .products-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 20px;
}
.homepage .product-card,
.products-page .product-card,
.category-page .product-card {
    width: 23%;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #ccc;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    box-sizing: border-box;
}
.homepage .product-card img,
.products-page .product-card img,
.category-page .product-card img {
    width: 100%;
    height: auto;
}
.homepage .product-info,
.products-page .product-info,
.category-page .product-info {
    margin-top: 10px;
    text-align: left;
}
.homepage .product-name,
.products-page .product-name,
.category-page .product-name {
    font-size: 18px;
    margin-bottom: 10px;
}
.homepage .product-price,
.products-page .product-price,
.category-page .product-price {
    font-size: 16px;
    color: #e60000;
    margin-bottom: 10px;
    text-align: center;
}
.homepage .rating .star,
.products-page .rating .star,
.category-page .rating .star {
    color: orange;
}
.homepage .details-button,
.products-page .details-button,
.category-page .details-button {
    display: inline-block;
    background-color: #ff6600;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
}
.homepage .details-button:hover,
.products-page .details-button:hover,
.category-page .details-button:hover {
    background-color: #cc5200;
}

/* === Адаптив === */
@media (max-width: 1200px) {
    .homepage .product-card,
    .products-page .product-card,
    .category-page .product-card { width: 31%; }
}
@media (max-width: 768px) {
    .homepage .product-card,
    .products-page .product-card,
    .category-page .product-card { width: 48%; }
}
@media (max-width: 480px) {
    .homepage .product-card,
    .products-page .product-card,
    .category-page .product-card { width: 100%; }
}

/* === Страница товара === */
.product-page .product-container.single-product {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 20px;
    background: #fff;
    margin: 20px;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.product-page .product-images {
    flex: 0 0 50%;
    max-width: 50%;
    margin-right: 20px;
}
.product-page .product-images img {
    width: 100%;
    height: auto;
}
.product-page .product-thumbs {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.product-page .product-thumbs .thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 1px solid #ccc;
    cursor: pointer;
}
.product-page .product-details {
    flex: 1;
}
.product-page .product-details h1 {
    font-size: 24px;
    margin: 0 0 10px;
}
.product-page .product-price {
    font-size: 20px;
    margin: 10px 0;
    text-align: left;
}
.product-page .product-price .old-price {
    text-decoration: line-through;
    color: #999;
    margin-right: 10px;
    font-size: 18px;
}
.product-page .product-price .new-price {
    color: #e60000;
    font-weight: bold;
    font-size: 22px;
}
.product-page .discount-banner {
    background-color: #ffe0b2;
    color: #d84315;
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: bold;
    margin-bottom: 15px;
    display: inline-block;
}
.product-page .rating {
    margin: 10px 0;
}
.product-page .rating .star {
    color: orange;
}
.product-page .button-container {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}
.buy-button,
.buy-one-click {
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    color: #fff;
    text-decoration: none;
}
.buy-button {
    background-color: #ff6600;
}
.buy-button:hover {
    background-color: #cc5200;
}
.buy-one-click {
    background-color: #f00;
}
.buy-one-click:hover {
    background-color: #cc0000;
}
.product-page .product-description {
    margin: 20px 0;
    line-height: 1.6;
}

/* === Блок «Схожі товари/витрини» === */
.product-page .related-products {
    margin-top: 40px;
}

.product-page .related-products h2 {
    margin-bottom: 20px;
    padding: 0 20px;
}

.product-page .related-products__list {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start;
    gap: 15px;
    padding: 0 20px;
    overflow-x: auto; /* Добавляем горизонтальную прокрутку на случай нехватки места */
}

.product-page .related-product-card {
    flex: 0 0 calc(20% - 12px); /* 20% минус gap между карточками */
    min-width: 180px; /* Минимальная ширина для предотвращения сжатия */
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center;
    box-sizing: border-box;
}

.product-page .related-product-card img {
    width: 100%;
    height: auto;
    max-height: 150px;
    object-fit: cover;
}

.product-page .related-product-info {
    margin-top: 10px;
    text-align: left;
}

.product-page .related-product-name {
    font-size: 14px;
    margin-bottom: 5px;
    height: 2.8em; /* Фиксированная высота для выравнивания */
    overflow: hidden;
    line-height: 1.4;
}

.product-page .related-product-price {
    font-size: 14px;
    color: #e60000;
    margin-bottom: 10px;
    text-align: center;
}

.product-page .related-product-price .old-price-small {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    margin-left: 8px;
}

.product-page .related-rating {
    text-align: center;
    margin-bottom: 10px;
}

.product-page .related-rating .star {
    color: orange;
    font-size: 14px;
}

.product-page .related-details-button {
    display: inline-block;
    background-color: #ff6600;
    color: #fff;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
    text-decoration: none;
    font-size: 12px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.product-page .related-details-button:hover {
    background-color: #cc5200;
}

/* Адаптив для похожих товаров */
@media (max-width: 1200px) {
    .product-page .related-product-card {
        flex: 0 0 calc(25% - 12px);
        min-width: 160px;
    }
}

@media (max-width: 768px) {
    .product-page .related-products .products-container {
        gap: 10px;
    }
    
    .product-page .related-product-card {
        flex: 0 0 calc(50% - 5px);
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .product-page .related-product-card {
        flex: 0 0 calc(100% - 10px);
        min-width: auto;
    }
}