/* Основная структура страницы товара */
.product-page {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Основная информация о товаре */
.product-main {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 3rem;
}

.product-info{
  flex: 1;
}

.main-photo-container {
    text-align: center;
}

.main-photo {
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.product-info h1 {
    text-align: left;
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 2rem;
}

/* Теги товара */
.tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tag {
    background: #e74c3c;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Блок цены */
.price-section {
    margin: 1.5rem 0;
}

.old-price {
    text-decoration: line-through;
    color: #95a5a6;
    margin-right: 1rem;
    font-size: 1.1rem;
}

.current-price {
    font-size: 1.4rem;
    font-weight: bold;
    color: #27ae60;
}

/* Категория товара */
.category {
  text-align: left;
    /*font-style: italic;*/
    color: #7f8c8d;
    margin-bottom: 1rem;
}

/* Характеристики товара */
.chars {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.chars h3, .chars h2 {
    color: #34495e;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.chars div {
    line-height: 1.6;
}

/* Описание товара */
.description {
    /*margin: 2rem 0;
    padding: 1.5rem;
    border-radius: 8px;
    background: rgba(255,156,0,0.1);*/
    font-size: 1rem;
    color: #555;
}

.description h3, .description h2 {
    color: #34495e;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.description div {
    line-height: 1.6;
}

/* Кнопки действий */
.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.add-to-cart {
    background: #27ae60;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s, transform 0.2s;
    font-weight: bold;
}

.add-to-cart:hover {
    opacity: 0.75;
    transform: translateY(-2px);
}

.btn-vk {
    background: #4a76a8;
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    display: inline-block;
    text-align: center;
    transition: background 0.3s, transform 0.2s;
    /*font-weight: bold;*/
}

.btn-vk:hover {
    background: #3a5f88;
    transform: translateY(-2px);
}

/* Галерея-слайдер */
.gallery-slider {
    margin-top: 4rem;
}

.gallery-slider h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #34495e;
    font-size: 1.8rem;
}

.slider-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto 2rem;
    overflow: hidden;
    border-radius: 8px;
}

.slider-track {
    display: flex;
    transition: transform 0.5s ease-in-out;
    width: 100%;
}

.slide {
    min-width: 100%;
    flex-shrink: 0; /* Запрещаем сжатие слайдов */
}

.slide img {
    width: 100%;
    height: 400px; /* Фиксированная высота для всех слайдов */
    object-fit: cover;
    border-radius: 8px;
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-nav.prev {
    left: 10px;
}

.slider-nav.next {
    right: 10px;
}

.slider-nav:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Миниатюры навигации */
.thumbnails {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s, border-color 0.3s;
    border: 2px solid transparent;
}

.thumbnail.active {
    opacity: 1;
    border-color: #3498db;
}

.thumbnail:hover {
    opacity: 1;
}


/* Галерея в формате Pinterest-карточек с разной высотой */
.gallery-grid {
    margin-top: 4rem;
}

.gallery-grid h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #34495e;
    font-size: 1.6rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    /* grid-auto-rows: 200px;  Базовая высота строк — можно настроить */
}

.photo-grid-item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    position: relative;
}

.photo-grid-item:hover {
    transform: scale(1.02);
    z-index: 10;
}

.photo-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Обрезаем фото, чтобы заполнить карточку */
    display: block;
}

/* Адаптивность для планшетов — 2 колонки */
@media (max-width: 1024px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
        /* grid-auto-rows: 180px; */
    }
}

/* Адаптивность для мобильных — 1 колонка */
@media (max-width: 768px) {
    .photo-grid {
        grid-template-columns: 1fr; /* Одна колонка на мобильных */
        gap: 1rem;
        /* grid-auto-rows: 150px;  Уменьшаем высоту строк */
    }

    .gallery-grid {
        margin-top: 3rem;
    }
}

/* Очень маленькие экраны — уменьшаем отступы */
@media (max-width: 480px) {
    .photo-grid {
        gap: 1rem;
        /* grid-auto-rows: 120px; */
    }
}


/* Сообщения об ошибках */
.error-message {
    color: #e74c3c;
    text-align: center;
    font-size: 1.2rem;
    margin: 2rem 0;
    padding: 1rem;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    background: #fdf2f2;
}

/* Стили для страницы 404 */
.not-found {
    text-align: center;
    padding: 4rem 1rem;
}

.not-found h1 {
    color: #e74c3c;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.not-found p {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 2rem;
}

.back-to-home {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 0.8rem 2rem;
    text-decoration: none;
    border-radius: 25px;
    transition: background 0.3s;
}

.back-to-home:hover {
    background: #2980b9;
}

/* Адаптивность — планшеты (768px — 1024px) */
@media (max-width: 1024px) {

    .slider-container {
        max-width: 700px;
    }

    .slide img {
        height: 350px;
    }
}

/* Адаптивность — мобильные устройства (до 768px) */
@media (max-width: 768px) {
    body {
        /*font-size: 14px;*/
    }

    .category {
      text-align: center;
    }

    .price-section {
      text-align: center;
    }

    .menu {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .product-page {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    .product-main {
        flex-direction: column;
    }

    .main-photo {
        max-width: 100%;
    }

    .product-info h1 {
        text-align: center;
        font-size: 2rem;
    }

    .current-price {
        font-size: 1.5rem;
    }

    .chars, .description {
        padding: 1rem;
    }

    .actions {
        flex-direction: column;
    }

    .add-to-cart, .btn-vk {
        width: 100%;
        text-align: center;
    }

    .gallery-slider {
        margin-top: 3rem;
    }

    .slider-container {
        max-width: 100%;
    }

    .slide img {
        height: 250px;
    }

    .thumbnails {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        margin-bottom: -0.5rem;
    }

    .thumbnail {
        width: 60px;
        height: 45px;
        flex-shrink: 0;
    }

    footer {
        padding: 1.5rem 0;
    }

    footer p {
        font-size: 0.8rem;
    }
}

/* Очень маленькие экраны (до 480px) */
@media (max-width: 480px) {

    .product-page {
        margin: 0.5rem auto;
    }

    .product-info h1 {
        font-size: 1.8rem;
    }

    .gallery-grid h2{
        font-size: 1.4rem;
    }

    .price-section {
        margin: 1rem 0;
    }

    .old-price {
        font-size: 1rem;
    }

    .current-price {
        font-size: 1.4rem;
    }

    .tags {
        gap: 0.3rem;
        justify-content: center;
    }

    .tag {
        padding: 0.2rem 0.6rem;
        font-size: 0.8rem;
    }

    .slide img {
        height: 200px;
    }

    .thumbnail {
        width: 50px;
        height: 35px;
    }

    .add-to-cart, .btn-vk {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .not-found h1 {
        font-size: 2.5rem;
    }

    .not-found p {
        font-size: 1.1rem;
    }
}

/* Печатная версия */
@media print {
    header, footer, .actions, .slider-nav, .thumbnails {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .product-page, .product-main, .main-photo-container, .product-info {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .main-photo, .slide img {
        max-width: 100% !important;
        height: auto !important;
        border: none !important;
        box-shadow: none !important;
    }

    a {
        text-decoration: none !important;
        color: black !important;
    }
}

.phototable{
  display: block;
}

.galphoto{
  display: inline-block;
}
