/* =========================== soft-list-view.css ========================= */

/* Стили для сетки товаров */
.product-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #f2f2f2; /* нейтральный фон, чтобы не было вспышки */
    overflow: hidden;
    border-radius: 10px;
}

.product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.product-item {
    width: calc(25% - 10px); /* Ширина для четырёх товаров в строке */
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    text-align: center;
    background-color: #f9f9f9;
    margin-bottom: 10px;
    overflow: hidden;

    display: flex;
    flex-direction: column;

    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-item:hover {
    transform: scale(1.05); /* Немного увеличиваем карточку */
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2); /* Добавляем тень */
}

.product-image {
    width: 100%;
    height: auto;
    /*height: 150px;*/
    object-fit: cover;
    object-position: center;
    cursor: zoom-in;
}
.product-title {
    font-size: 1.1em;
    margin: 10px 0;
    font-weight: bold;
}
.product-archive {
    color: #007b00;
    font-size: 1.1em;
    margin-top: auto;
}
.product-stock {
    font-size: 0.9em;
    color: #555;
}

/* ====================== Краткое описание продукта (и кнопка по совместительству) =================== */

.product-description {
    flex-grow: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: #fff;
    border: 1px solid #ccc;
    cursor: pointer;
    font-size: 0.95em;
    margin-top: 8px; /* 🔹 равен отступу у списка файлов */
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s, color 0.2s;
}

.product-description:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    background-color: rgba(59, 130, 246, 0.05);
    color: #0056b3;
}


.visually-hidden {
    display: none !important;
}


/* Контент товаров */
.content-product {
    flex-grow: 1;
    padding: 20px;
}

.product-image.hidden {
    display: none;
}

.image-wrapper {
    position: relative;
    display: inline-block;
}

.zoom-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 6px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    pointer-events: none; /* Чтобы клики шли сквозь лупу на изображение */
}


/*
    Кастомизация выпадающего списка файлов.
 */

/* Обертка для селекта */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%; /* теперь занимает всю ширину родителя */
    min-width: 180px;
    max-width: 100%; /* точно не выйдет за границы */
    font-family: "Segoe UI", Tahoma, sans-serif;
    margin-top: 8px;
}


/* Сам селект скрываем, но оставляем функциональность */
.custom-select-wrapper select {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 40px 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Hover & focus */
.custom-select-wrapper select:hover,
.custom-select-wrapper select:focus {
    border-color: #3b82f6; /* Голубой акцент */
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    outline: none;
}

/* Кастомная стрелка */
.custom-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    pointer-events: none;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #333;
    transition: transform 0.3s;
}

/* Стрелка при открытом селекте */
.custom-select-wrapper select:focus + .custom-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* ========================== одиночный файл в аттаче =========================== */

.single-archive {
    display: block;
    width: 100%;             /* Растягиваем блок на всю ширину родителя */
    text-align: center;
    margin-top: 8px;         /* Отступ сверху, как у select */
}

.single-archive .archive-link {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fff;
    font-size: 14px;
    color: #0056b3;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s, color 0.2s;
}

.single-archive .archive-link:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    background-color: rgba(59, 130, 246, 0.05);
    color: #003a80;
}


/*!*===================== Модалка с картинками ==================*!*/
.soft-modal {
    position: fixed;
    top:0; left:0;
    width: 100%;
    height: 100%;
    display:flex;
    justify-content:center;
    align-items:center;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
}

.soft-modal.hidden {
    display: none;
}

.soft-modal-content {
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    box-sizing: border-box;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Оверлей для закрытия */
.soft-modal-overlay {
    position: absolute;
    top:0; left:0;
    width:100%;
    height:100%;
    background: transparent;
}

/* Заголовок */
.modal-title {
    margin: 5px 0;
    text-align: center;
}

/* Превьюшки сверху */
.modal-thumbnails {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 5px 0;
    overflow-x: auto;
    min-height: 60px;
}

.modal-thumbnails img {
    width: 60px;
    height: auto;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
}

.modal-thumbnails img.active {
    border-color: #007bff;
}

/* Основная картинка */
.modal-body {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.modal-main-image {
    margin-top: 10px;
    display: block;
    max-width: 100%;
    margin-bottom: 10px;
    object-fit: contain;
    transition: max-height 0.2s ease, width 0.2s ease;
}

/* Кнопка закрытия */
.modal-close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 1.8em;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
}



/* ======================== Модалка с описанием ========================= */

/* Внешний контейнер для закруглений и тени */
#descriptionModal .description-modal-wrapper {
    max-width: 70ch;
    min-width: 20ch;
    max-height: 90vh;
    border-radius: 12px;
    overflow: hidden;
    background-color: #fff;
    box-sizing: border-box; /* ? */
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Скроллируемый контент */
#descriptionModal .soft-modal-content {
    overflow-y: auto;
    padding: 40px 25px 30px;
    /*padding: 30px 25px;*/
    box-sizing: border-box;
    flex-grow: 1;
    width: 100%;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Кнопка закрытия */
#descriptionModal .modal-close-btn {
    position: absolute;
    top: 20px;
    right: 15px;
    font-size: 22px;
    cursor: pointer;
    z-index: 10;
}

/* Заголовок и тело текста */
#descriptionModalBody {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}
#descriptionModalTitle {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

/* Эффекты "книжки" */
#descriptionModal.hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}
#descriptionModal:not(.hidden) {
    opacity: 1;
    transform: scale(1);
}

/* UI для загрузки */
.loading {
    color: #888;
    text-align: center;
    padding: 1em;
    font-style: italic;
}


/* ========================== Классы для markdown, точнее для Flexmark ========================= */
.key-icon {
    max-height: 1.2em;          /* высота изображения чуть больше высоты текста */
    vertical-align: middle;
}

/* Для форматированного текста */
pre {
    white-space: pre-wrap;
    font-family: "Consolas", monospace;
    font-size: 0.8em;
}

/* Стиль консоли CP/M с мигающим курсором в конце строки */
.console-cpm {
    background: #000;
    color: #00ff00;
    font-family: "SFMono-Regular", Menlo, Monaco, "Courier New", monospace;
    padding: 0.05em 0.25em;
    border-radius: 4px;
    white-space: pre;
    font-size: 0.95em;
    -webkit-font-smoothing: antialiased;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
    position: relative; /* нужно для позиционирования курсора */
}

.console-cpm::after {
    content: ' ';
    background-color: #00ff00;
    color: #000;
    animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

/* Консоль с белыми символами на синем фоне */
.console-wb {
    background: blue;
    color: white;
    font-family: "SFMono-Regular", Menlo, Monaco, "Courier New", monospace;
    padding: 0.05em 0.25em;
    border-radius: 4px;
    white-space: pre;
    font-size: 0.95em;
    -webkit-font-smoothing: antialiased;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}


/* ================== Адаптивные стили для разных экранов ================= */

@media (max-width: 992px) {
    .product-item {
        width: calc(33.33% - 10px); /* Три товара в строке */
    }
}
@media (max-width: 768px) {
    .product-item {
        width: calc(50% - 10px); /* Два товара в строке */
    }
}
@media (max-width: 576px) {
    .product-item {
        width: 100%; /* Один товар в строке для мобильных устройств */
    }
    .product-description {
        margin-top: 10px;
    }
}


