/* Страница товара */

.pd-media-card,
.pd-buy-card,
.pd-desc {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.pd-buy-card {
    padding: 24px;
}
.pd-title {
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
    font-weight: 800;
    line-height: 1.15;
    margin: 4px 0 8px;
}
.pd-calc {
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--c-bg);
    border: 1px solid var(--c-line);
}
.pd-superopt {
    background: var(--c-lav-soft);
    border: 1px solid var(--c-line-strong);
    color: var(--c-lav-strong);
}

/* ---------- Фото и надпись ---------- */
.pd-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    border-radius: var(--radius-md);
    background: var(--c-surface-tint);
    overflow: hidden;
}
.pers-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
}
.pers-stage img {
    display: block;
    max-width: 100%;
    max-height: 460px;
    object-fit: contain;
}
.pers-text {
    position: absolute;
    transform: translate(-50%, -50%) rotate(var(--pers-rotate, 0deg)) scale(0.8);
    white-space: nowrap;
    pointer-events: none;
    /* --pers-size — проценты ширины фото (как в кабинете мастера), --pers-unit — 1% ширины, ставит product.js */
    font-size: calc(var(--pers-size, 8) * var(--pers-unit, 4px));
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.35s var(--ease-spring);
}
.pers-text.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--pers-rotate, 0deg)) scale(1);
}
.pers-field .form-control:focus {
    border-color: var(--c-lav);
    box-shadow: var(--focus-ring);
}

/* ---------- Вкладки «Фото / 3D» ---------- */
.pd-media-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: var(--c-bg);
    border: 1px solid var(--c-line);
}
.pd-media-tab {
    border: 0;
    border-radius: 999px;
    padding: 7px 14px;
    background: transparent;
    color: var(--c-ink-2);
    font-size: 0.85rem;
    font-weight: 700;
    transition: background 0.18s, color 0.18s;
}
.pd-media-tab.is-active {
    background: var(--c-surface);
    color: var(--c-lav-strong);
    box-shadow: var(--shadow-sm);
}
.model-view {
    position: relative;
    width: 100%;
    height: 420px;
    cursor: grab;
    touch-action: none;
}
.model-view:active {
    cursor: grabbing;
}
.model-view canvas {
    display: block;
}
.model-view-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--c-ink-2);
    font-size: 0.9rem;
}
.pd-stage-3d {
    flex-direction: column;
}
.model-view-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--nav);
    color: var(--c-ink-2);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* ---------- Миниатюры и плюсы ---------- */
.pd-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
}
.pd-thumb {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    padding: 4px;
    border-radius: 14px;
    border: 2px solid transparent;
    background: var(--c-surface-tint);
    transition: border-color 0.15s;
}
.pd-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.pd-thumb.is-active,
.pd-thumb:hover {
    border-color: var(--c-lav-mid);
}
.pd-perks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}
.pd-perks span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--c-bg);
    border: 1px solid var(--c-line);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--c-ink-2);
}
.pd-perks i {
    color: var(--c-lav);
}

.pd-spec {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--c-surface);
    border: 1px solid var(--c-line);
}
.pd-desc .nav-tabs {
    --bs-nav-tabs-link-active-color: var(--c-lav-strong);
    --bs-nav-tabs-link-active-border-color: var(--c-line) var(--c-line) var(--c-surface);
    --bs-nav-link-color: var(--c-ink-2);
    --bs-nav-link-hover-color: var(--c-lav-strong);
}

/* ---------- Панель покупки на телефоне ---------- */
.pd-sticky-buy {
    display: none;
}
@media (max-width: 991.98px) {
    .pd-sticky-buy {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 12px;
        z-index: 1035;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 10px 10px 16px;
        border-radius: 999px;
        background: var(--nav);
        backdrop-filter: blur(10px);
        border: 1px solid var(--c-line-strong);
        box-shadow: var(--shadow-md);
        transform: translateY(140%);
        transition: transform 0.35s var(--ease-out);
    }
    .pd-sticky-buy.is-visible {
        transform: none;
    }
    body.tma-mode .pd-sticky-buy {
        bottom: calc(76px + env(safe-area-inset-bottom));
    }
    .pd-sticky-price {
        display: flex;
        flex-direction: column;
        min-width: 0;
        line-height: 1.15;
    }
    .pd-sticky-title {
        font-size: 0.72rem;
        color: var(--c-ink-2);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .pd-sticky-price strong {
        font-family: var(--font-display);
        font-size: 1.1rem;
    }
    /* Пока панель видна, кнопка чата поднимается над ней */
    body:has(.pd-sticky-buy.is-visible) .floating-assistant-btn {
        transform: translateY(-72px);
    }
}
@media (max-width: 575.98px) {
    .pd-media-card, .pd-buy-card { padding: 14px; border-radius: 20px; }
    .pd-stage { min-height: 280px; }
    .model-view { height: 320px; }
    .pd-calc { padding: 14px; }
}
