/* css/product.css — стили карточки товара. Путь: css/product.css */

/* ============================================================
   ОСНОВНАЯ СЕТКА КАРТОЧКИ
   ============================================================ */

.product-page{
    display:grid;
    grid-template-columns:1.2fr 1fr;
    gap:48px;
    margin:0 0 30px;
    align-items:start;
}

/* ============================================================
   ГАЛЕРЕЯ (десктоп)
   ============================================================ */

.book-gallery{
    display:grid;
    grid-template-columns:1fr 100px;
    gap:16px;
}
.gallery-main{
    background:var(--card);
    border-radius:var(--radius);
    padding:16px;
    box-shadow:var(--shadow-sm);
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:500px;
}
.gallery-main img{
    max-width:100%;
    max-height:min(520px, 80vh);
    width:auto;
    height:auto;
    object-fit:contain;
    border-radius:10px;
    display:block;
}
.gallery-thumbs{
    display:flex;
    flex-direction:column;
    gap:10px;
    max-height:560px;
    overflow-y:auto;
    padding-right:4px;
}
.gallery-thumb{
    width:100%;
    height:80px;
    object-fit:cover;
    cursor:pointer;
    border:2px solid transparent;
    border-radius:8px;
    transition:.2s;
    background:var(--card);
}
.gallery-thumb:hover{border-color:var(--accent-soft)}
.gallery-thumb.active{border-color:var(--accent)}
.gallery-video video{
    width:100%;
    max-height:400px;
    margin-top:20px;
    border-radius:var(--radius);
}

/* ============================================================
   ИНФОРМАЦИЯ О КНИГЕ
   ============================================================ */

.book-info h1{
    font-size:28px;
    margin-bottom:10px;
    line-height:1.3;
    word-wrap:break-word;
    overflow-wrap:break-word;
}
.book-info .author{
    color:var(--muted);
    font-size:15px;
    margin-bottom:10px;
}
.book-info .author a{font-weight:600}

.book-info .age-line{margin:10px 0}
.book-info .age-badge{
    display:inline-block;
    background:var(--accent-soft);
    color:var(--accent);
    font-size:13px;
    font-weight:700;
    padding:5px 14px;
    border-radius:20px;
    line-height:1;
}

.foreign-agent-warning{
    background:#fff3e6;
    color:#b45a4a;
    padding:10px 16px;
    border-radius:10px;
    border-left:4px solid #e8a87c;
    font-size:14px;
    font-weight:600;
    margin:12px 0;
}

.book-info .weight{
    color:var(--muted);
    font-size:14px;
    margin-bottom:6px;
}
.book-info .price{
    font-size:32px;
    font-weight:800;
    color:var(--accent);
    margin:20px 0;
    line-height:1;
}
.book-info .old-price{
    font-size:18px;
    color:var(--muted);
    text-decoration:line-through;
    margin-left:10px;
    font-weight:400;
}
.book-info .actions{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    margin-top:20px;
}

/* Анонс в правой колонке */
.book-annonce-full{
    margin-top:24px;
    padding-top:20px;
    border-top:1px solid #eae6e1;
}
.book-annonce-full h3{
    font-size:15px;
    color:var(--muted);
    margin-bottom:8px;
    text-transform:uppercase;
    letter-spacing:.5px;
    font-weight:600;
}
.book-annonce-full p{
    font-size:14.5px;
    color:var(--ink);
    line-height:1.6;
}

/* ============================================================
   ОПИСАНИЕ (annotation_full)
   ============================================================ */

.book-description{
    margin-top:20px;
    background:var(--card);
    border-radius:var(--radius);
    padding:28px;
    box-shadow:var(--shadow-sm);
}
.book-description h2{font-size:20px;margin-bottom:14px}
.book-description p{margin-bottom:12px;line-height:1.7}

/* ============================================================
   ТЕГИ
   ============================================================ */

.book-tags{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin:20px 0;
}
.book-tags .tag{
    font-size:13px;
    background:var(--accent-soft);
    color:var(--accent);
    padding:5px 12px;
    border-radius:20px;
    text-decoration:none;
}
.book-tags .tag:hover{background:var(--accent);color:#fff}

/* ============================================================
   ОТЗЫВЫ
   ============================================================ */

.reviews-block{
    margin-top:30px;
    background:var(--card);
    border-radius:var(--radius);
    padding:30px;
    box-shadow:var(--shadow-sm);
}
.reviews-block h2{font-size:20px;margin-bottom:20px}
.reviews-block h3{
    font-size:16px;
    margin-bottom:14px;
    color:var(--muted);
    font-weight:600;
}
.reviews-sep{
    border:none;
    border-top:1px solid #eae6e1;
    margin:28px 0;
}

.reviews-block form{margin-top:20px}
.reviews-block input[type="text"],
.reviews-block textarea{
    width:100%;
    padding:14px 18px;
    font-size:16px;
    font-family:inherit;
    line-height:1.5;
    border:1px solid #eae6e1;
    border-radius:12px;
    background:#fff;
    color:var(--ink);
    outline:none;
    transition:border-color .2s, box-shadow .2s;
    box-sizing:border-box;
    margin-bottom:12px;
}
.reviews-block input[type="text"]::placeholder,
.reviews-block textarea::placeholder{
    color:#9aa5ac;
    font-size:16px;
}
.reviews-block input[type="text"]:focus,
.reviews-block textarea:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-soft);
}
.reviews-block textarea{
    min-height:120px;
    resize:vertical;
}

.review{
    background:var(--bg);
    padding:16px 18px;
    border-radius:10px;
    margin-bottom:12px;
}
.review-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    margin-bottom:6px;
}
.review b{color:var(--accent);font-size:15px}
.review-stars{
    color:var(--warm);
    font-size:18px;
    letter-spacing:2px;
    line-height:1;
}
.review p{margin-top:6px;font-size:14.5px;color:var(--ink);line-height:1.6}
.review-date{
    margin-top:8px;
    font-size:12.5px;
    color:var(--muted);
}

/* ============================================================
   ХЛЕБНЫЕ КРОШКИ
   ============================================================ */

.breadcrumbs{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
    font-size:13px;
    color:var(--muted);
    margin:0 0 20px;
    padding:0;
}
.breadcrumbs a{
    color:var(--muted);
    text-decoration:none;
}
.breadcrumbs a:hover{color:var(--accent)}
.breadcrumbs span{color:var(--muted)}
.breadcrumbs span:last-child{
    color:var(--ink);
    font-weight:500;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* ============================================================
   МОБИЛЬНЫЙ (≤ 860px)
   ============================================================ */

@media (max-width: 860px){
    .product-page{
        grid-template-columns:1fr;
        gap:20px;
        margin-bottom:20px;
    }

    /* Галерея — сверху главное фото, снизу сетка 4×N */
    .book-gallery{
        grid-template-columns:1fr;
        gap:14px;
    }
    .gallery-main{
        min-height:0;
        aspect-ratio:1 / 1;
        padding:12px;
        border-radius:14px;
    }
    .gallery-main img{
        max-height:100%;
        max-width:100%;
        width:auto;
        height:auto;
        object-fit:contain;
        display:block;
    }

    /* 4 миниатюры в ряд = 25% ширины каждая */
    .gallery-thumbs{
        display:grid;
        grid-template-columns:repeat(4, 1fr);
        gap:8px;
        max-height:none;
        overflow:visible;
        padding:0;
        flex-direction:unset;
    }
    .gallery-thumb{
        width:100%;
        height:auto;
        aspect-ratio:1 / 1;
        object-fit:cover;
        border-radius:10px;
        border:2px solid transparent;
        cursor:pointer;
    }
    .gallery-thumb.active{
        border-color:var(--accent);
        box-shadow:0 0 0 3px var(--accent-soft);
    }
    .gallery-thumb:hover{border-color:var(--accent-soft)}

    .gallery-video video{
        width:100%;
        max-height:300px;
        border-radius:12px;
        margin-top:12px;
    }

    /* Информация о книге */
    .book-info h1{
        font-size:22px;
        line-height:1.3;
        margin:14px 0 10px;
        hyphens:auto;
        -webkit-hyphens:auto;
        word-break:break-word;
    }
    .book-info .author{
        font-size:14px;
        margin-bottom:8px;
    }
    .book-info .age-line{margin:10px 0}
    .book-info .weight{
        font-size:13.5px;
        margin-bottom:6px;
    }
    .book-info .price{
        font-size:28px;
        margin:16px 0;
    }
    .book-info .actions{
        margin-top:16px;
        gap:10px;
    }
    .book-info .actions .btn-cart{
        width:100%;
        height:52px;
        font-size:16px;
    }

    /* Описание */
    .book-description{
        padding:20px 16px;
        margin-top:16px;
    }
    .book-description h2{font-size:18px}

    /* Отзывы */
    .reviews-block{
        padding:20px 16px;
        margin-top:20px;
    }
    .reviews-block h2{font-size:18px}
    .reviews-block input[type="text"]{
        padding:16px 18px;
        font-size:17px;
        height:52px;
        border-radius:12px;
    }
    .reviews-block textarea{
        padding:16px 18px;
        font-size:17px;
        min-height:140px;
        border-radius:12px;
    }
    .reviews-block input[type="text"]::placeholder,
    .reviews-block textarea::placeholder{
        font-size:16px;
    }

    /* Хлебные крошки */
    .breadcrumbs{
        font-size:12px;
        margin-bottom:14px;
    }
}

/* ============================================================
   ОЧЕНЬ УЗКИЕ ЭКРАНЫ (≤ 380px)
   ============================================================ */

@media (max-width: 380px){
    /* На узких экранах 3 в ряд вместо 4 — читаемее */
    .gallery-thumbs{
        grid-template-columns:repeat(3, 1fr);
        gap:6px;
    }
    .gallery-main{aspect-ratio:4 / 5}
    .book-info h1{font-size:20px}
    .book-info .price{font-size:24px}
}

/* ============================================================
   ФОРМА ОТЗЫВА: ЗВЁЗДНЫЙ РЕЙТИНГ
   ============================================================ */

.reviews-block form label{
    display:block;
    margin-bottom:12px;
    font-size:14px;
    color:var(--muted);
}

.rating-field{
    display:flex;
    align-items:center;
    gap:14px;
    margin:16px 0 14px;
    padding:10px 0;
}

.rating-label{
    font-size:14.5px;
    color:var(--ink);
    font-weight:600;
    white-space:nowrap;
}

.rating-stars{
    display:flex;
    gap:4px;
}

.rating-stars .star{
    background:none;
    border:none;
    cursor:pointer;
    font-size:32px;
    line-height:1;
    color:#d5d9d6;
    padding:0;
    transition:color .15s, transform .15s;
    font-family:inherit;
    height:auto;
    width:auto;
    min-width:0;
}

.rating-stars .star:hover,
.rating-stars .star.hover{
    color:#e8a87c;
    transform:scale(1.1);
}

.rating-stars .star.active{
    color:#e8a87c;
}

/* Мобильный */
@media (max-width: 860px){
    .rating-field{
        flex-direction:column;
        align-items:flex-start;
        gap:8px;
    }
    .rating-stars .star{
        font-size:38px;
        padding:4px;
    }
}

/* ============================================================
   ФОРМА ОТЗЫВА НА КАРТОЧКЕ КНИГИ
   ============================================================ */

.reviews-block form{
    margin-top:20px;
}

.reviews-block form label,
.reviews-block .form-field{
    display:block;
    font-size:14px;
    color:var(--ink);
    font-weight:600;
    margin-bottom:6px;
}

.reviews-block input[type="text"],
.reviews-block input[type="email"],
.reviews-block textarea{
    width:100%;
    padding:14px 18px;
    font-size:16px;
    font-family:inherit;
    line-height:1.5;
    border:1px solid #eae6e1;
    border-radius:12px;
    background:#fff;
    color:var(--ink);
    outline:none;
    transition:border-color .2s, box-shadow .2s;
    box-sizing:border-box;
    margin-bottom:16px;
}

.reviews-block input[type="text"]::placeholder,
.reviews-block textarea::placeholder{
    color:#9aa5ac;
    font-size:16px;
}

.reviews-block input[type="text"]:focus,
.reviews-block textarea:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-soft);
}

.reviews-block textarea{
    min-height:120px;
    resize:vertical;
}

/* КНОПКА «ОТПРАВИТЬ» */
.reviews-block button,
.reviews-block .btn-submit{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height:48px;
    padding:0 36px;
    background:var(--accent);
    color:#fff;
    border:none;
    border-radius:50px;
    cursor:pointer;
    font-weight:600;
    font-family:inherit;
    font-size:15px;
    line-height:1;
    transition:background .2s, transform .15s;
    box-sizing:border-box;
    min-width:180px;
    -webkit-appearance:none;
    appearance:none;
}
.reviews-block button:hover{
    background:var(--accent-dark);
    transform:translateY(-2px);
}
.reviews-block button:disabled{
    background:#c9d3cd;
    cursor:wait;
    transform:none;
}

/* Звёзды выбора оценки */
.rating-field{
    display:flex;
    align-items:center;
    gap:14px;
    margin:16px 0 20px;
    padding:0;
}
.rating-label{
    font-size:14.5px;
    color:var(--ink);
    font-weight:600;
    white-space:nowrap;
}
.rating-stars{
    display:flex;
    gap:4px;
}
.rating-stars .star{
    background:none !important;
    border:none !important;
    cursor:pointer;
    font-size:32px;
    line-height:1;
    color:#d5d9d6;
    padding:0 !important;
    transition:color .15s, transform .15s;
    font-family:inherit;
    height:auto !important;
    width:auto !important;
    min-width:0 !important;
    min-height:0 !important;
    border-radius:0 !important;
}
.rating-stars .star:hover,
.rating-stars .star.hover{
    color:#e8a87c;
    transform:scale(1.1);
}
.rating-stars .star.active{
    color:#e8a87c;
}

/* Список отзывов */
.reviews-block .review{
    background:var(--bg);
    padding:16px 18px;
    border-radius:10px;
    margin-bottom:12px;
}
.reviews-block .review-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    margin-bottom:6px;
    flex-wrap:wrap;
}
.reviews-block .review b{
    color:var(--accent);
    font-size:15px;
}
.reviews-block .review-stars{
    color:var(--warm);
    font-size:18px;
    letter-spacing:2px;
    line-height:1;
    font-weight:normal;
}
.reviews-block .review p{
    margin-top:6px;
    font-size:14.5px;
    color:var(--ink);
    line-height:1.6;
}
.reviews-block .review-date{
    margin-top:8px;
    font-size:12.5px;
    color:var(--muted);
}

/* Мобильный */
@media (max-width: 860px){
    .reviews-block button,
    .reviews-block .btn-submit{
        width:100%;
        min-width:0;
    }
    .rating-stars .star{
        font-size:38px;
        padding:4px;
    }
}

/* ============================================================
   LIGHTBOX — полноэкранный просмотр картинки
   ============================================================ */

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    cursor: zoom-out;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
    animation: lightbox-fade .2s ease;
}

.lightbox.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox__img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    user-select: none;
    -webkit-user-drag: none;
    transition: transform .2s ease;
    transform-origin: center center;
}

/* Кнопка закрытия */
.lightbox__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    padding: 0;
    font-family: inherit;
}
.lightbox__close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Навигация ← → */
.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    padding: 0;
    font-family: inherit;
}
.lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.3);
}
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }

/* Счётчик 1 / N */
.lightbox__counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 14px;
    border-radius: 20px;
    user-select: none;
}

@keyframes lightbox-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Курсор-увеличилка на главной картинке */
.gallery-main img {
    cursor: zoom-in;
}

/* На мобиле — уменьшаем крестик и стрелки */
@media (max-width: 860px) {
    .lightbox { padding: 8px; }
    .lightbox__close { top: 10px; right: 10px; width: 40px; height: 40px; font-size: 24px; }
    .lightbox__nav { width: 44px; height: 44px; font-size: 24px; }
    .lightbox__nav--prev { left: 8px; }
    .lightbox__nav--next { right: 8px; }
}