body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f6f9;
    color: #333;
}

.hg-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Шапка */
.pricelist-header {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.pricelist-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: #0d6efd;
}
.pricelist-date {
    color: #6c757d;
    margin-top: 8px;
    font-size: 0.9rem;
}

/* Контролы */
.expand-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 20px 0;
}
.expand-controls label {
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
    color: #495057;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Кнопка скачивания */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #198754;
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: background-color 0.2s;
}
.download-btn:hover {
    background: #157347;
}

/* Аккордеон — общий контейнер списка */
.accordion-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Элемент аккордеона */
.accordion__item {
    margin-bottom: 5px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Заголовок аккордеона */
.accordion__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.accordion__header::after {
    content: "";
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-size: contain;
    transition: transform 0.3s ease;
}
.accordion__item_show .accordion__header::after {
    transform: rotate(-180deg);
}

/* Цвета уровней */
.level-0 > .accordion__item > .accordion__header { 
    background-color: #094caf; 
    text-transform: uppercase; 
    color: #ffffff;
    display: block;
    font-size: 18px;
    font-weight: bolder;
    line-height: 1.4;
    padding: 15px;
    text-decoration: none;
    border-bottom: 3px solid #cccccc;
    border-radius: 10px;
    margin: 2px 5px 2px 5px;
}

.level-1 .accordion__header { 
    color: #ffffff; 
    font-size: 18px;
    background-color: #3079eb;
    font-weight: normal;
    outline: 0 none;
    padding: 20px 15px 20px 30px;
    line-height: 1.4;
    padding: 15px;
    text-decoration: none;
    border-bottom: 3px solid #cccccc;
    border-radius: 10px;
    margin: 2px 5px 2px 5px;
}

.level-2 .accordion__header { 
    background-color: #72a9f7; 
    padding: 20px 15px 20px 40px;
    color: #ffffff; 
    text-transform: none;
    line-height: 1.4;
    padding: 15px;
    text-decoration: none;
    border-bottom: 3px solid #cccccc;
    border-radius: 10px;
    margin: 2px 5px 2px 5px;
}

/* Контент */
.accordion__content {
    background: #fff;
    padding: 0;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.accordion__item .accordion__content {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* === Строка товара === */
.product-row {
    display: flex;
    align-items: center;
    text-decoration: none;
    text-transform: none;
    background-color: #ffffff;
    color: #3d3d3d;
    padding: 10px;
    border-bottom: 1px solid #D3D3D3;
}
.product-row:hover {
    background-color: #f8f9fa;
}

/* === Блок с фото === */
.product-photo-wrapper {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    position: relative;
    margin-right: 12px;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f5f5f5;
}
.product-photo-wrapper.empty {
    background-color: transparent;
}
.product-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* === Кнопка-триггер поверх фото === */
.photo-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}
.photo-count {
    background: rgba(39, 174, 96, 0.9);
    color: #fff;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 6px 0 6px 0;
    font-weight: 600;
    margin: 2px;
    white-space: nowrap;
}

/* === Блок с информацией о товаре === */
.product-info {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.product-name {
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 4px;
    color: #2a2c2f;
}
.product-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #6c757d;
    flex-wrap: wrap;
}
.product-price {
    font-weight: 400;
    color: #495057;
    white-space: nowrap;
}
.product-packing {
    color: #495057;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .hg-main { padding: 10px; }
    .accordion__header { padding: 10px 12px; }
    .level-1 .accordion__header, .level-2 .accordion__header { padding-left: 16px; }
}

/* Попап */
.photo-popup {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.photo-popup.show {
    display: flex;
}
.photo-popup-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.photo-popup-close {
    position: absolute;
    top: 8px; right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 34px; height: 34px;
    font-size: 1.4em;
    cursor: pointer;
    z-index: 10;
    color: #333;
}
.photo-popup-close:hover {
    background: #e74c3c;
    color: #fff;
}
.photo-popup-main {
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 75vh;
    overflow: hidden;
}
.photo-popup-img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
}
.photo-popup-thumbs {
    display: flex;
    gap: 6px;
    padding: 10px;
    overflow-x: auto;
    background: #f5f5f5;
    justify-content: center;
}
.photo-popup-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0.6;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
}
.photo-popup-thumb:hover {
    opacity: 0.9;
}
.photo-popup-thumb.active {
    opacity: 1;
    border-color: #3498db;
}

.product-row-wrapper {
    position: relative;
}

/* Убедимся, что попап скрыт по умолчанию */
.photo-popup {
    display: none;
}
.photo-popup.show {
    display: flex;
}

/* Убираем отступ, если фото нет (класс empty) */
.product-photo-wrapper.empty {
    width: 0;
    padding: 0;
    margin: 0;
    min-height: 0;
}

/* На мобильных делаем фото-блок компактным */
@media (max-width: 768px) {
    .product-photo-wrapper {
        width: 80px; /* фиксированная ширина блока с фото на мобильном */
        flex-shrink: 0; /* чтобы он не сжимался в 0, если есть фото */
    }

    .product-photo-wrapper.empty {
        display: none; /* полностью скрываем, если фото нет */
    }

    .product-info {
        /* Чтобы текст не прыгал, когда фото-блок исчезает */
        min-height: 80px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}
