/* Redesigned product page preview (product_info.php?product=v2):
   src/templates/storefront/ProductV2.html. Builds on src/css/home-v2.css, which the page also
   loads: its tokens and legacy palette, header, footer and the shared .kt2-* components. */

/* colours and tokens: the legacy palette at the end of home-v2.css */
body.kt-pp-v2 { font-family: "Nunito", "Segoe UI", Arial, sans-serif; }

/* the legacy breadcrumb bar: the page prints its own, lighter one */
body.kt-pp-v2 #header > .row.header-navigation { display: none !important; }
/* the legacy floating "Поръчай" button: replaced by .ktp-sticky */
body.kt-pp-v2 #bottom-action { display: none !important; }

.ktp { padding-top: 0; }
.ktp svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── gallery + buy box ─────────────────────────────────────────────── */
.ktp-top {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}
.ktp-gallery { position: sticky; top: 16px; }
.ktp-gallery__stage {
    position: relative;
    background: var(--kt2-surface);
    border-radius: 24px;
    box-shadow: var(--kt2-shadow);
    aspect-ratio: 1 / 1;
    max-height: calc(100vh - 240px);
    min-height: 420px;
    width: 100%;
    overflow: hidden;
}
.ktp-gallery__main { display: flex; width: 100%; height: 100%; padding: 32px; cursor: zoom-in; }
.ktp-gallery__main img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s ease; }
.ktp-gallery__main:hover img { transform: scale(1.03); }
.ktp-gallery__badge { top: 18px; left: 18px; font-size: 15px; padding: 8px 12px; }
.ktp-wish {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--kt2-shadow);
    color: var(--kt2-ink);
    cursor: pointer;
    transition: transform .15s ease, color .15s ease;
}
.ktp-wish svg { width: 24px; height: 24px; }
.ktp-wish:hover { transform: scale(1.08); color: var(--kt2-sale); }
.ktp-wish.is-on { color: var(--kt2-sale); }
.ktp-wish.is-on svg { fill: currentColor; }
.ktp-gallery__thumbs {
    display: flex;
    gap: 10px;
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.ktp-thumb {
    width: 76px;
    height: 76px;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--kt2-shadow);
    cursor: pointer;
}
.ktp-thumb img { width: 100%; height: 100%; object-fit: contain; }
.ktp-thumb.is-active { border-color: var(--kt2-green); }

.ktp-buy { padding-top: 6px; }
.ktp-title {
    margin: 0 0 10px;
    font-size: clamp(24px, 2.6vw, 34px);
    font-weight: 900;
    line-height: 1.18;
    letter-spacing: -.015em;
    color: var(--kt2-heading);
}
.ktp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 14px; color: var(--kt2-muted); }
.ktp-meta a { color: var(--kt2-muted); text-decoration: underline; text-underline-offset: 3px; }
.ktp-meta a:hover { color: var(--kt2-red); }
.ktp-stars { text-decoration: none !important; }
.ktp-stars__bar {
    background: linear-gradient(90deg, #ffb400 calc(var(--rating) * 20%), #d6e3c8 0);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 1px;
}

.ktp-price { margin: 22px 0 6px; color: var(--kt2-muted); font-weight: 600; font-size: 16px; }
/* the legacy price markup is "<div>EUR</div>BGN": EUR big, BGN under it */
.ktp-price__now { line-height: 1.25; }
.ktp-price__now > div { font-size: 40px; font-weight: 900; line-height: 1.05; color: var(--kt2-green-dark); letter-spacing: -.02em; }
.ktp-price--sale .ktp-price__now > div { color: var(--kt2-sale); }
.ktp-price__was { margin-top: 6px; font-size: 14px; }
.ktp-price__was s, .ktp-price__was s div { display: inline; font-weight: 600; }
.ktp-price__was s div { margin-right: .4em; }
.ktp-save { margin-left: 8px; padding: 3px 9px; border-radius: 999px; background: #ffe3e3; color: #b42323; font-weight: 800; }

.ktp-stock { display: flex; align-items: center; gap: 8px; margin: 14px 0 20px; font-weight: 700; font-size: 15px; }
.ktp-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(31, 138, 91, .15); }
.ktp-stock--in { color: var(--kt2-green-dark); }
.ktp-stock--out { color: var(--kt2-red-dark); }
.ktp-stock--out .ktp-dot { box-shadow: 0 0 0 4px rgba(229, 72, 59, .15); }

.ktp-options { margin-bottom: 16px; }
.ktp-options select { height: 44px; padding: 0 12px; border: 1.5px solid var(--kt2-line); border-radius: 12px; background: #fff; }

.ktp-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.ktp-cta { min-height: 56px; gap: 10px; font-size: 18px; border: 0; width: 100%; }
.ktp-cta svg { width: 22px; height: 22px; }
.ktp-fast { min-height: 50px; }
.ktp-tbi { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; font-size: 14px; color: var(--kt2-muted); }
.ktp-tbi svg { flex: none; width: 22px; height: 22px; color: var(--kt2-green-dark); }

.ktp-usps {
    display: grid;
    gap: 12px;
    list-style: none;
    margin: 24px 0 0;
    padding: 18px 20px;
    border-radius: var(--kt2-radius);
    background: #fff;
    box-shadow: var(--kt2-shadow);
    font-size: 14.5px;
    color: var(--kt2-muted);
}
.ktp-usps li { display: flex; align-items: center; gap: 12px; }
.ktp-usps svg { flex: none; width: 26px; height: 26px; color: var(--kt2-red); }
.ktp-usps strong { color: var(--kt2-ink); }
.ktp-usps a { color: var(--kt2-ink); text-decoration: underline; }

/* ── description ───────────────────────────────────────────────────── */
.ktp-desc { max-width: 860px; }
.ktp-desc__body {
    position: relative;
    padding: 28px 32px;
    border-radius: var(--kt2-radius);
    background: #fff;
    box-shadow: var(--kt2-shadow);
    font-size: 16.5px;
    line-height: 1.7;
    color: #36502a;
    text-align: left;
}
.ktp-desc__body.is-clamped { max-height: 520px; overflow: hidden; }
.ktp-desc__body.is-clamped::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 120px;
    background: linear-gradient(rgba(255, 255, 255, 0), #fff);
}
/* AI descriptions repeat the product name as h1/h2: calm them down to section heads */
.ktp-desc__body h1, .ktp-desc__body h2, .ktp-desc__body h3 {
    margin: 26px 0 10px;
    font-family: inherit;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--kt2-heading);
    text-align: left;
}
.ktp-desc__body > :first-child { margin-top: 0; }
.ktp-desc__body ul { padding-left: 0; list-style: none; }
.ktp-desc__body li { position: relative; padding-left: 28px; margin: 10px 0; }
.ktp-desc__body li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: .55em;
    width: 12px;
    height: 7px;
    border-left: 2.5px solid var(--kt2-green);
    border-bottom: 2.5px solid var(--kt2-green);
    transform: rotate(-45deg);
}
.ktp-desc__body strong { color: var(--kt2-ink); }
.ktp-desc__body img { max-width: 100%; height: auto; }
.ktp-note { margin-top: 18px; padding: 14px 18px; border-radius: 14px; background: #fbf5bf; color: var(--kt2-ink); }
.ktp-desc__more {
    display: block;
    margin: -22px auto 0;
    position: relative;
    padding: 10px 22px;
    border: 1.5px solid var(--kt2-green);
    border-radius: 999px;
    background: #fff;
    color: var(--kt2-green-dark);
    font-weight: 700;
    cursor: pointer;
}
.ktp-desc__foot { display: flex; align-items: center; gap: 18px; margin: 18px 0 0; font-size: 14px; color: var(--kt2-muted); }
.ktp-share {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1.5px solid var(--kt2-line);
    border-radius: 999px;
    background: #fff;
    font-weight: 700;
    color: var(--kt2-ink);
    cursor: pointer;
}
.ktp-share svg { width: 18px; height: 18px; }
.ktp-share:hover { border-color: var(--kt2-green); }

/* ── sticky add to cart ────────────────────────────────────────────── */
.ktp-sticky {
    position: fixed;
    z-index: 900;
    left: 50%;
    bottom: 16px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 10px 10px 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 34px rgba(43, 69, 32, .22);
    transform: translate(-50%, 140%);
    transition: transform .25s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.ktp-sticky.is-shown { transform: translate(-50%, 0); }
.ktp-sticky__price { font-size: 12px; font-weight: 600; color: var(--kt2-muted); line-height: 1.2; }
.ktp-sticky__price > div { font-size: 20px; font-weight: 900; color: var(--kt2-green-dark); }
.ktp-sticky__price.ktp-price--sale > div { color: var(--kt2-sale); }
.ktp-sticky .kt2-btn { border: 0; }

/* ── tablets and phones ────────────────────────────────────────────── */
@media (max-width: 991px) {
    .ktp-top { grid-template-columns: 1fr; gap: 22px; }
    .ktp-gallery { position: static; }
}
@media (max-width: 767px) {
    .ktp-gallery__stage {
        border-radius: 20px;
        aspect-ratio: auto;
        /* low enough that the title and price are on the first screen */
        height: min(64vw, 34vh);
        min-height: 0;
        max-height: none;
    }
    .ktp-gallery__main { padding: 14px; }
    /* the photo runs edge to edge on phones */
    .ktp-gallery__stage { margin: 0 -10px; width: auto; border-radius: 0; box-shadow: none; }
    .ktp-gallery__thumbs { padding: 0 2px; }
    .ktp-usps { padding: 14px 14px; }
    .ktp-gallery__thumbs { margin-top: 10px; }
    .ktp-thumb { width: 56px; height: 56px; padding: 4px; border-radius: 12px; }
    .ktp-top { gap: 16px; }
    .ktp-title { font-size: 21px; line-height: 1.2; margin-bottom: 6px; }
    /* price straight under the title; the code and rating move under the buy box */
    .ktp-buy { display: flex; flex-direction: column; }
    .ktp-buy > .ktp-meta { order: 1; margin-top: 14px; }
    .ktp-buy { padding-top: 0; }
    .ktp-stock { margin: 10px 0 14px; }
    .ktp-price { margin-top: 4px; }
    .ktp-price__now > div { font-size: 34px; }
    .ktp-desc__body { padding: 18px 14px; font-size: 16px; }
    .ktp-desc__body.is-clamped { max-height: 420px; }
    .ktp-sticky {
        left: 0;
        right: 0;
        bottom: 0;
        justify-content: space-between;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
        transform: translateY(110%);
    }
    .ktp-sticky.is-shown { transform: translateY(0); }
    body.kt-pp-v2.ktp-sticky-on { padding-bottom: 84px; }
    .ktp-sticky .kt2-btn { flex: 1; max-width: 240px; }
}
