/* =========================================================
   Страница товара — layout как в макете (галерея | инфо)
   ========================================================= */

.kd-page-product .kd-shop-content {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
}

/* body.kd-page-product и body.woocommerce — один элемент, не вложенность */
body.kd-page-product div.product.kd-single-product,
.kd-page-product div.product.kd-single-product {
    display: block;
    grid-template-columns: none;
    gap: 0;
}

.kd-product-page {
    padding: 0.5rem 0 2.5rem;
}

.kd-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin: 0 0 1.1rem;
    font-size: 0.875rem;
    color: #998894;
}

.kd-breadcrumbs a {
    color: #998894;
}

.kd-breadcrumbs a:hover {
    color: var(--bs-orange, #fe7e00);
}

.kd-breadcrumbs span:last-child {
    color: #765e68;
}

.kd-product-head {
    margin-bottom: 1.75rem;
    max-width: 52rem;
}

.kd-product-title {
    margin: 0 0 0.85rem;
    font-size: clamp(1.45rem, 2.6vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
    color: #4a323a;
    text-transform: none;
    letter-spacing: 0;
}

.kd-product-lead {
    margin: 0;
    color: #765e68;
    line-height: 1.6;
    font-size: 1rem;
}

.kd-product-lead p {
    margin: 0 0 0.65rem;
}

.kd-product-lead p:last-child {
    margin-bottom: 0;
}

.kd-product-lead strong,
.kd-product-lead b {
    color: #4a323a;
    font-weight: 700;
}

/* ---- Двухколоночная сетка ---- */
.kd-product-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 2.75rem;
    align-items: start;
    margin-bottom: 2.75rem;
}

.kd-product-layout__gallery,
.kd-product-layout__summary {
    min-width: 0;
}

.kd-product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    align-items: center;
    margin-bottom: 1.15rem;
    font-size: 0.95rem;
    color: #998894;
}

.kd-product-meta__label {
    font-weight: 600;
    color: #765e68;
}

.kd-product-meta__article {
    margin-left: 0;
}

.kd-product-meta__article span {
    font-weight: 700;
    color: #765e68;
    letter-spacing: 0.02em;
}

/* ---- Галерея ---- */
.kd-product-gallery {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.kd-product-gallery__main {
    border-radius: 1.5rem;
    overflow: hidden;
    background: #f7f2ef;
}

.kd-product-gallery__main img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.kd-product-gallery__thumbs {
    display: flex;
    gap: 0.65rem;
    margin-top: 0.85rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
}

.kd-product-gallery__thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
}

.kd-product-gallery__thumb.is-active {
    border-color: var(--bs-orange, #fe7e00);
}

.kd-product-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- Размеры ---- */
.kd-product-sizes {
    margin-bottom: 1rem;
}

.kd-product-sizes__title {
    margin-bottom: 0.65rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #765e68;
}

.kd-product-sizes__group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.kd-size-option {
    cursor: pointer;
    margin: 0;
}

.kd-size-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.kd-size-option-back {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #e6d8dc;
    border-radius: 0.85rem;
    background: #fff;
    min-width: 5.75rem;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.kd-size-option input:checked + .kd-size-option-back {
    border-color: var(--bs-orange, #fe7e00);
    background: #fff8f2;
    box-shadow: 0 0 0 1px rgba(254, 126, 0, 0.15);
}

.kd-size-option-back .name-block {
    font-size: 0.72rem;
    text-align: center;
    color: #765e68;
    line-height: 1.2;
}

.kd-size-option-back .name-block span {
    display: block;
    font-size: 0.62rem;
    color: #998894;
}

.kd-size-option-back .icon-block svg {
    width: 1.75rem;
    height: 1.75rem;
}

/* ---- Характеристики ---- */
.kd-product-specs {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px solid #efe6e8;
}

.kd-product-specs dl {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0;
    font-size: 0.9rem;
}

.kd-product-specs dt {
    color: #998894;
    font-weight: 500;
}

.kd-product-specs dd {
    margin: 0;
    color: #765e68;
    font-weight: 600;
    text-align: right;
}

/* ---- Покупка: цена слева, кнопки справа ---- */
.kd-variations-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.kd-variations-form .quantity {
    display: none !important;
}

.kd-product-buy {
    padding: 1.15rem 1.2rem 1.05rem;
    border-radius: 1.15rem;
    background: #fff;
    border: 1px solid #efe6e8;
    box-shadow: 0 10px 28px rgba(74, 58, 66, 0.05);
}

.kd-product-buy__title {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #4a323a;
}

.kd-product-buy__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: nowrap;
}

.kd-product-buy__price .price,
.kd-product-buy__price .price-tag,
.kd-product-buy__price #price-buy {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--bs-orange, #fe7e00);
    white-space: nowrap;
}

.kd-variation-wrap {
    flex: 0 0 auto;
    min-width: 0;
}

.kd-product-buy__actions {
    display: flex;
    flex-flow: row nowrap;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

.kd-product-buy__actions .shop {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.25;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, opacity 0.15s ease;
}

.kd-product-buy__actions .shop-add-cart {
    background: linear-gradient(135deg, var(--bs-orange, #fe7e00) 0%, #e86a00 100%);
    color: #fff;
    border-color: var(--bs-orange, #fe7e00);
}

.kd-product-buy__actions .shop-buy-now {
    background: #fff;
    color: var(--bs-orange, #fe7e00);
    border-color: var(--bs-orange, #fe7e00);
}

.kd-product-buy__actions .shop-add-cart:not(.is-disabled):not(:disabled):hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.kd-product-buy__actions .shop-buy-now:not(.is-disabled):not(:disabled):hover {
    background: #fff5eb;
    transform: translateY(-1px);
}

.kd-product-buy__actions .shop.is-disabled,
.kd-product-buy__actions .shop:disabled {
    background: #ececec;
    color: #8a8a8a;
    border-color: #d4d4d4;
    cursor: not-allowed;
    transform: none;
}

.kd-product-buy__actions .shop-buy-now.is-disabled,
.kd-product-buy__actions .shop-buy-now:disabled {
    background: #fafafa;
}

/* Ссылка «Перейти в корзину» от WooCommerce — не нужна, есть шапка и «Купить сейчас». */
.kd-variations-form a.added_to_cart {
    display: none !important;
}

/* Загрузка — текст «Добавляем…», без круглого спиннера. */
.kd-product-buy__actions .shop.is-loading {
    pointer-events: none;
    opacity: 0.92;
    transform: none;
    filter: none;
}

.kd-product-buy__actions .shop-add-cart.is-loading,
.kd-product-buy__actions .shop-buy-now.is-loading {
    background: linear-gradient(135deg, var(--bs-orange, #fe7e00) 0%, #e86a00 100%);
    border-color: var(--bs-orange, #fe7e00);
    color: #fff !important;
}

.kd-product-buy__actions .shop-add-cart.is-added {
    background: linear-gradient(135deg, #2e9e5a 0%, #248a4c 100%);
    border-color: #2e9e5a;
    color: #fff;
}

@keyframes kd-spin {
    to {
        transform: rotate(360deg);
    }
}

.kd-product-buy__note {
    margin: 0.75rem 0 0;
    font-size: 0.8rem;
    color: #998894;
}

.kd-product-desc-block {
    margin: 0 0 2.25rem;
    padding: 1.35rem 1.5rem;
    border-radius: 1.25rem;
    background: #fff;
    border: 1px solid #efe6e8;
}

.kd-product-desc {
    margin: 0;
    color: #765e68;
    line-height: 1.65;
    font-size: 0.98rem;
    max-width: 58rem;
}

.kd-product-desc p {
    margin: 0 0 0.75rem;
}

.kd-product-desc p:last-child {
    margin-bottom: 0;
}

.kd-product-back {
    margin-top: 2rem;
}

.kd-product-back a {
    color: #765e68;
}

.kd-product-back a:hover {
    color: var(--bs-orange, #fe7e00);
}

/* WC не должен дублировать цену */
.kd-variation-wrap .woocommerce-variation {
    display: none !important;
}

/* Кастомная форма — не наследуем flex от WooCommerce */
.kd-page-product .kd-variations-form.cart {
    display: block;
    margin: 0;
    gap: 0;
}

.kd-page-product .kd-variations-form .woocommerce-variation-add-to-cart {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.kd-page-product .kd-variations-form .single_add_to_cart_button {
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
}

/* Нижние блоки Evo — на всю ширину, 2 колонки */
.kd-product-story {
    margin-top: 2rem;
    width: 100%;
    clear: both;
}

/* «Похожие модели» — под описанием, та же сетка карточек, что в каталоге */
.kd-product-related {
    margin-top: 3rem;
    width: 100%;
    clear: both;
}

.kd-product-related .related.products > h2 {
    margin: 0 0 1.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #765e68;
}

.kd-product-related .catalog__list--shop {
    margin: 0;
}

@media (max-width: 767.98px) {
    .kd-product-related {
        margin-top: 2rem;
    }
}

.kd-product-story .product__block-bottom {
    width: 100%;
}

.kd-product-story .product__block-bottom-top {
    display: block !important;
    column-count: 3;
    column-gap: 1.25rem;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.kd-product-story .product__block-bottom-item {
    break-inside: avoid;
    page-break-inside: avoid;
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 0 1.25rem !important;
    display: inline-block;
}

.kd-product-story .product__block-bottom-item.wide {
    column-span: all;
    display: block;
}

.kd-product-story .product__block-bottom-item-back {
    height: auto;
    gap: 0.75rem;
}

.kd-product-story .product__block-bottom-item-text {
    color: #765e68;
    line-height: 1.55;
    font-size: 0.95rem;
}

.kd-product-story .product__block-bottom img.img-preview {
    border-radius: 1.25rem;
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 991.98px) {
    .kd-product-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .kd-product-meta__article {
        margin-left: 0;
    }

    .kd-product-story .product__block-bottom-top {
        column-count: 2;
    }
}

@media (max-width: 575.98px) {
    .kd-product-buy__row {
        flex-wrap: wrap;
    }

    .kd-product-buy__actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
    }

    .kd-product-buy__actions .shop {
        flex: 1 1 auto;
    }

    .kd-product-story .product__block-bottom-top {
        column-count: 1;
    }

    .kd-product-story .product__block-bottom-item,
    .kd-product-story .product__block-bottom-item.wide {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}
