.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.preview-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 1px solid #ccc;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.3s;
}

.preview-image:hover {
    transform: scale(1.1);
}

/* Новый класс для изображений в галерее */
.gallery-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border: 1px solid #ccc;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.3s;
}

.gallery-image:hover {
    transform: scale(1.1);
}

.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gallery-item {
    position: relative;
    display: inline-block;
    text-align: center;
}

.gallery-buttons {
    text-align: center;
    margin-top: 5px;
}

.set-main {
    background: none;
    border: none;
    font-size: 24px;
    color: gold;
    cursor: pointer;
    transition: transform 0.2s;
}

.set-main:hover {
    color: gold;
    transform: scale(1.2);
}

/* Модальное окно */
.custom-modal {
    display: none;
    /* Оставляем только display: none */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.custom-modal.show {
    display: flex;
    /* Показываем модальное окно с flex */
}

.custom-modal-image {
    max-width: 100%;
    height: auto;
    display: block;
}

.custom-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    font-size: 40px;
    font-weight: bold;
    color: white;
    cursor: pointer;
}

.custom-modal-close:hover {
    color: rgb(104, 104, 104);
}

.custom-modal {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal.show {
    opacity: 1;
}

.thumbnail-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    margin-bottom: 5px;
    cursor: pointer;
    border: 1px solid #ddd;
}

.thumbnail-image:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.main-image img {
    max-width: 100%;
    /* Исправлено с auto на 100% */
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.thumbnails {
    max-width: 100px;
}

.main-image {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

.thumbnail-image.active-thumbnail {
    border: 2px solid #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}