/* Страница товара /tovar.php */

.product-page .product-main {
    padding: 28px 0 60px;
}

.product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    grid-template-areas:
        "gallery info"
        "actions info";
    gap: clamp(16px, 3vw, 28px) clamp(24px, 4vw, 48px);
    align-items: start;
}

.product-gallery {
    grid-area: gallery;
}

.product-info {
    grid-area: info;
}

.product-actions {
    grid-area: actions;
}

.product-gallery-main {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: #f0ebf7;
    aspect-ratio: 4 / 3;
}

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

.product-gallery-zoom {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #431c72;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(67, 28, 114, 0.18);
}

.product-gallery-zoom svg {
    width: 20px;
    height: 20px;
}

.product-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.product-thumb {
    width: 72px;
    height: 54px;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    padding: 0;
    background: #eee;
    cursor: pointer;
}

.product-thumb.is-active {
    border-color: #431c72;
}

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

.product-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(67, 28, 114, 0.08);
    color: #431c72;
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.product-title {
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    line-height: 1.2;
    color: #431c72;
    margin: 0 0 14px;
    font-weight: 700;
}

.product-price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 16px;
    margin-bottom: 18px;
}

.product-price {
    font-size: clamp(1.4rem, 2.2vw, 1.85rem);
    font-weight: 700;
    color: #431c72;
}

.product-price-note {
    font-size: 0.78rem;
    color: rgba(67, 28, 114, 0.65);
}

.product-sale-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e11d48;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.product-sale-note {
    margin: -6px 0 18px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #9f1239;
    font-weight: 600;
}

.product-desc {
    font-size: 0.95rem;
    line-height: 1.65;
    color: #3d3a45;
    margin: 0 0 22px;
    white-space: pre-line;
}

.product-perks {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: grid;
    gap: 8px;
}

.product-info > .product-title,
.product-info > .product-price-row,
.product-info > .product-sale-note,
.product-info > .product-desc,
.product-info > .product-perks {
    margin: 0;
    padding: 16px 0;
    border-bottom: 1px solid rgba(67, 28, 114, 0.12);
}

.product-info > .product-title {
    padding-top: 4px;
}

.product-info > :last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.product-perks li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #431c72;
}

.product-perks li::before {
    content: '';
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #431c72, #6b3fa8);
}

.product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.product-actions .btn {
    flex: 1 1 0;
    min-width: 140px;
    width: auto;
    height: 48px;
    margin: 0;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1.5px solid transparent;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    align-self: stretch;
}

.product-actions .btn-outline-product {
    background: transparent;
    color: #431c72;
    border-color: rgba(67, 28, 114, 0.35);
    box-shadow: none;
}

.product-actions .btn-outline-product:hover {
    border-color: #431c72;
    background: rgba(67, 28, 114, 0.06);
}

.product-alt {
    font-size: 0.8rem;
    color: rgba(67, 28, 114, 0.75);
}

.product-alt a {
    color: #431c72;
    font-weight: 600;
    text-decoration: none;
}

.product-alt a:hover {
    text-decoration: underline;
}

.product-related {
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid rgba(67, 28, 114, 0.12);
}

.product-related-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 18px;
}

.product-related h2 {
    font-size: 1.15rem;
    color: #431c72;
    margin: 0;
}

.product-related-nav {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.product-related-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid rgba(67, 28, 114, 0.3);
    background: #fff;
    color: #431c72;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 3px;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.product-related-arrow:hover:not(:disabled) {
    background: rgba(67, 28, 114, 0.08);
}

.product-related-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

.product-related-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px 18px;
}

.product-related-track::-webkit-scrollbar {
    display: none;
}

.product-related-card {
    flex: 0 0 calc((100% - 48px) / 4);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 24px rgba(67, 28, 114, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(67, 28, 114, 0.14);
}

.product-related-media {
    position: relative;
}

.product-related-media img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.product-related-media .catalog-sale-badge {
    top: 8px;
    left: 8px;
    padding: 5px 9px;
    font-size: 11px;
}

.product-related-title {
    display: block;
    padding: 12px 14px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #431c72;
    line-height: 1.35;
}

.product-related-price {
    display: block;
    margin: auto 14px 0;
    padding: 10px 0 14px;
    border-top: 1px solid rgba(67, 28, 114, 0.12);
    font-size: 0.82rem;
    font-weight: 700;
    color: #431c72;
    font-variant-numeric: tabular-nums;
}

.product-404 {
    text-align: center;
    padding: 80px 20px;
}

.product-404 h1 {
    color: #431c72;
    margin-bottom: 12px;
}

.catalog-info h3 a {
    color: inherit;
    text-decoration: none;
}

.catalog-info h3 a:hover {
    text-decoration: underline;
}

.catalog-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    width: 100%;
}

.catalog-detail-link {
    display: block;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: #431c72;
    text-decoration: none;
    opacity: 0.85;
}

.catalog-detail-link:hover {
    opacity: 1;
    text-decoration: underline;
}

@media (max-width: 900px) {
    /* Мобилка: картинка → описание → кнопка */
    .product-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "gallery"
            "info"
            "actions";
        gap: 18px;
    }

    .product-related-card {
        flex-basis: calc((100% - 32px) / 3);
    }
}

@media (max-width: 560px) {
    .product-related-card {
        flex-basis: 72%;
    }

    .product-related h2 {
        font-size: 1rem;
    }

    .product-related-arrow {
        width: 34px;
        height: 34px;
    }

    .product-actions .btn {
        width: 100%;
    }
}
