.page-card-wrapper {
    margin-top: 30px;
    margin-bottom: 60px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.btn-page-back {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 25px;
    display: inline-flex;
    align-items: center;
}

.layout-standalone {
    background: #fff;
    padding: 35px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

/* minmax(0, ...) КРИТИЧЕСКИ ВАЖНО: не дает контенту распирать сетку вправо */
.details-layout {
    display: grid;
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    grid-template-areas:
        "gallery info"
        "seller  info";
    gap: 20px 40px;
    align-items: start;
    width: 100%;
    box-sizing: border-box;
}

/* min-width: 0 сбрасывает стандартное распирание grid-элементов */
.gallery-column,
.seller-card,
.details-info-box {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.gallery-column {
    grid-area: gallery;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.seller-card {
    grid-area: seller;
    background: #fdfdfd;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    height: fit-content;
}

.details-info-box {
    grid-area: info;
    display: flex;
    flex-direction: column;
}

/* ГАЛЕРЕЯ И ФОТО */
.details-img-box {
    position: relative;
    background: #f7f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 350px;
    cursor: pointer;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.details-img-box img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.zoom-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 47, 52, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.product-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    width: 100%;
}

.thumb-item {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: pointer;
    background: #f8fafc;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    box-sizing: border-box;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-item.active,
.thumb-item:hover {
    border-color: var(--xtorg-neon-pink);
    opacity: 0.9;
}

/* ТЕКСТ */
.view-price {
    font-size: 32px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 12px;
    word-break: break-word;
}

.view-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    word-break: break-word;
}

.view-meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.view-description {
    font-size: 16px;
    line-height: 1.6;
    color: #2b3f41;
    margin: 20px 0;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* КАРТА */
.product-map-section {
    margin-top: 15px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.map-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.map-selected-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.product-mini-map {
    width: 100%;
    max-width: 100%;
    height: 220px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    z-index: 1;
    overflow: hidden;
    /* Не дает Leaflet растягивать страницу */
}

/* ПРОДАВЕЦ */
.seller-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.seller-avatar {
    width: 50px;
    height: 50px;
    background: var(--xtorg-light-purple);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.btn-chat,
.btn-contact-main,
.btn-call {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.btn-chat {
    background: #eef2f3;
    color: var(--text-primary);
}

.btn-contact-main,
.btn-call {
    background: var(--xtorg-light-purple);
    color: #fff;
}

/* ЛЕНТЫ СЛАЙДЕРОВ (Именно они выталкивали страницу вправо) */
.related-slider-section {
    margin-top: 30px;
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    /* Обязательно для блокировки вылезания */
}

.slider-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.horizontal-slider-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    /* Скроллится только внутри блока, а не весь экран */
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.horizontal-slider-container::-webkit-scrollbar {
    height: 6px;
}

.horizontal-slider-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.horizontal-slider {
    display: flex;
    gap: 16px;
    width: max-content;
}

.slider-card {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.slider-card:hover {
    transform: translateY(-3px);
}

.slider-card-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #f8fafc;
}

.slider-card-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.slider-card-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.slider-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 32px;
}

.slider-card-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: auto;
}

/* МОДАЛКА ЗУМА */
.zoom-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.zoom-modal.show {
    display: flex;
}

.zoom-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #fff;
    font-size: 38px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100001;
    padding: 10px;
}

.zoom-controls {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 100001;
}

.zoom-controls button {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
}

.zoom-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    font-size: 24px;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 100001;
}

.zoom-prev {
    left: 15px;
}

.zoom-next {
    right: 15px;
}

.zoom-image-wrapper {
    width: 85%;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#zoom-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.15s ease-out;
}

/* МОБИЛКА (до 992px) */
@media (max-width: 992px) {
    .details-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
    }

    .gallery-column {
        order: 1;
        width: 100%;
    }

    .details-info-box {
        order: 2;
        width: 100%;
    }

    .seller-card {
        order: 3;
        margin-top: 0;
        width: 100%;
    }

    .details-img-box {
        height: 280px;
    }

    .product-gallery-thumbs {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .thumb-item {
        width: 60px;
        min-width: 60px;
        height: 60px;
        flex-shrink: 0;
    }
}