/* ========== СТРАНИЦА ДЕТАЛИЗАЦИИ ========== */
.container_type_detail {
    width: 80%;
    padding: 10px 0 0 0;
    margin: 0 auto;
}

/* Хлебные крошки */
.breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}
.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--primary);
}
.breadcrumb span {
    color: var(--text-dark);
    font-weight: 500;
}

/* Главная сетка */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin: 2rem 0;
    border-bottom: 1px solid var(--primary);
    border-right: 1px solid var(--primary);
    border-bottom-right-radius: 1.5rem;
    box-shadow: 6px 3px 12px rgba(253, 186, 1, 0.15);
    padding: 20px 0;
}

/* ========== ГАЛЕРЕЯ ========== */
.product-gallery {
    display: flex;
    flex-direction: column;
    min-width: 400px;
    width: 100%;
}

.gallery-slider {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    background: #f9f9f9;
    margin-bottom: 1rem;
}

.gallery-slider-wrapper {
    display: flex;
    transition: transform 0.3s ease-out;
    touch-action: pan-y pinch-zoom;
    width: 100%;
}

.gallery-slide {
    flex: 0 0 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-slide img {
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

/* Миниатюры с горизонтальной прокруткой */
.thumbnails-slider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}
.thumbnails-container {
    flex: 1;
    overflow-x: auto;
    scroll-behavior: smooth;
    white-space: nowrap;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.thumbnails-container::-webkit-scrollbar {
    height: 4px;
}
.thumbnails-container::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 4px;
}
.thumbnails-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}
.thumbnails {
    display: inline-flex;
    gap: 0.5rem;
    white-space: normal;
}
.thumbnails img {
    width: 100px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.2s;
    flex-shrink: 0;
}

.thumbnails img.active {
    border-color: var(--primary);
}
.thumbnails img:hover {
    border-color: var(--primary-light);
}
.thumbnails-prev,
.thumbnails-next {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.thumbnails-prev:hover,
.thumbnails-next:hover {
    background: rgba(0, 0, 0, 0.8);
}
@media (max-width: 768px) {
    .thumbnails img {
        width: 70px;
        height: 56px;
    }
}

/* ========== ПРАВАЯ КОЛОНКА ========== */
.product-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    gap: 1.5rem;
}
.product-info-top {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.info__box {
    max-height: 3.2rem;
    width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 2rem;
    padding: 0.4rem 0;
}
.info__attributes {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.product-info__param {
    font-weight: 500;
    color: var(--text-dark);
    min-width: 100px;
}
.product-info__value {
    font-size: 1rem;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 60%;
    text-align: right;
    color: var(--text-dark);
}

.truncated-single-line{
    font-size: 1rem;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
    text-align: right;
    color: var(--text-dark);
}

.selected-price {
    font-weight: bold;
    font-size: 1.2rem;
}
.selected-price .old-price {
    font-weight: normal;
    font-size: 0.9em;
    color: var(--text-secondary, #888);
    text-decoration: line-through;
}
.size-select {
    padding: 0.5rem;
    font-size: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-light);
    background: var(--white);
    cursor: pointer;
    min-width: 120px;
}
.size-select:hover {
    border-color: var(--primary);
}
.size-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

/* Цветовые переключатели */
.color-swatch {
    display: inline-block;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    transition: 0.2s;
    overflow: hidden;
    cursor: pointer;
}
.color-swatch img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.color-swatch.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--primary);
}
.color-swatch:hover {
    border-color: var(--primary);
}

/* Текстовые переключатели */
.text-swatch {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--border-light);
    border-radius: 2rem;
    text-decoration: none;
    background-color: var(--white);
    transition: all 0.2s;
    color: var(--text-dark);
    font-size: 0.9rem;
    cursor: pointer;
}
.text-swatch:hover {
    background-color: var(--primary-soft);
    border-color: var(--primary);
}
.text-swatch.active {
    background-color: var(--primary);
    color: #000;
    border-color: var(--primary);
}

/* Кнопка "В корзину" */
.add-to-cart {
    width: 100%;
    background-color: var(--white);
    border: 1px solid var(--primary);
    border-radius: 2rem;
    padding: 0.8rem 0;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}
.add-to-cart:hover {
    background-color: var(--primary);
    color: #000;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(253, 186, 1, 0.3);
}

/* ========== ТАБЫ ========== */
.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-light);
    margin: 2rem 0 1rem;
}
.tab-button {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s, border-bottom 0.2s;
    border-bottom: 2px solid transparent;
}
.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.tab-button:hover {
    color: var(--primary);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Характеристики */
.parameters {
    max-width: 100%;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#cartMessage {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.parameters ul {
    list-style: none;
    padding: 0;
}
.parameter__element {
    border-bottom: 1px solid var(--border-light);
    padding: 0.5rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem;
    justify-content: space-between;
}
.parameter__left {
    font-weight: 500;
    color: var(--text-dark);
    width: max-content;
    max-width: 40%;
    min-width: 30%;
}
.parameter__right {
    flex: 1;
    text-align: right;
    color: var(--text-secondary);
}

/* Таблица модулей */
#modules table {
    width: 100%;
    border-collapse: collapse;
}
#modules th, #modules td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}
#modules th {
    background-color: var(--card-bg);
    font-weight: 600;
}
#modules a {
    color: var(--text-dark);
    text-decoration: none;
}
#modules a:hover {
    text-decoration: underline;
    color: var(--primary);
}

.accessories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.accessory-card {
    background: var(--white);
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%; /* важно для одинаковой высоты */
}

.accessory-card:hover {
    transform: translateY(-4px);
}

.accessory-card__image {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    padding: 0.5rem;
    flex-shrink: 0;
}

.accessory-card__image img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.accessory-card__body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.accessory-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.accessory-card__article {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.accessory-card__price {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    margin-top: auto; /* прижимает цену к верхней части, но не к кнопке */
}

/* Кнопка прижимается к низу */
.add-accessory-btn {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
    background: var(--primary);
    color: var(--text-dark);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: auto; /* прижимает кнопку к низу контейнера */
}

.add-accessory-btn:hover {
    background: var(--primary-light);
}

.add-accessory-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Контейнер действий на карточке комплектующего (кнопка / счётчик) */
.accessory-card__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: auto; /* прижимает к низу карточки, как было у кнопки */
}

/* Счётчик количества комплектующих */
.accessory-counter {
    display: none; /* показывается после добавления в корзину (через inline display) */
    align-items: center;
    gap: 0.5rem;
    background: var(--white);
    border: 1px solid var(--primary);
    border-radius: 2rem;
    padding: 0.2rem 0.75rem;
}

.counter-btn {
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    background: var(--primary-light);
    color: var(--text-dark);
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.counter-btn:hover {
    background: var(--primary);
}

.counter-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.counter-value {
    min-width: 1.75rem;
    text-align: center;
    font-weight: 700;
}

/*DEV*/
/* ===== КАРУСЕЛЬ ЦВЕТОВ ===== */
.color-carousel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 70%;
}

.color-carousel-track-wrapper {
    overflow: hidden;
    flex: 1;
    /*width: 100%;*/
    padding: 12px 5px;
}

.color-carousel-track {
    display: flex;
    gap: 0.5rem;
    transition: transform 0.3s ease;
    will-change: transform;
}

/* Кнопки карусели */
.color-carousel-btn {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.color-carousel-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.color-carousel-btn:active {
    transform: scale(0.95);
}

.color-carousel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Адаптивность для кнопок */
@media (max-width: 576px) {
    .color-carousel-btn {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
}
/*DEV*/

/* ========== С ЭТИМ ТОВАРОМ ПОКУПАЮТ ========== */
.also-bought-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.also-bought-card {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    text-decoration: none;
    color: var(--text-dark);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.also-bought-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.also-bought-card__image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #f5f5f5;
    display: block;
}

.also-bought-card__body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
}

.also-bought-card__name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.also-bought-card__prices {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.also-bought-card__old-price {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    text-decoration: line-through;
}

.also-bought-card__price {
    font-weight: 700;
    color: var(--text-dark);
}

.also-bought-status {
    color: var(--text-secondary);
    padding: 1rem 0;
}

@media (max-width: 768px) {
    .also-bought-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .also-bought-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 768px) {
    .container_type_detail {
        width: 95%;
    }
    .product-detail {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .product-gallery {
        min-width: 100%;
    }
    .product-info {
        padding-bottom: 20px;
    }
    .product-info__value {
        max-width: 100%;
        justify-content: flex-start;
        text-align: left;
    }

    .gallery-slide img {
        max-height: 55vh;
    }

    .info__box {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        box-sizing: border-box;
        max-width: 100%;
        max-height: none;
    }
    .product-info__param {
        min-width: auto;
    }
}
@media (min-width: 769px) {
    .gallery-slider {
        height: auto;
    }
    .truncated-single-line{
        align-items: flex-start;
    }
}