body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #121212; 
    color: #ffffff;
    margin: 0;
    padding: 0;
    text-align: center;
    overflow-x: hidden;
}

h1 {
    font-size: 2.5rem;
    margin: 20px 0;
    color: #f8f8f8;
}

button, input {
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    background: #333;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
}

button:hover, input:focus {
    background: #555;
}

input[type="text"] {
    width: 100%; /* Пусть ширина растягивается, но только до максимума */
    max-width: 600px; /* Максимальная ширина для поисковой строки */
    margin: 20px auto; /* Центрирование и отступы сверху/снизу */
    display: block; /* Блочный элемент для центровки */
    border-radius: 8px;
    background: #333;
    color: #fff;
    font-size: 1.1rem;
    padding: 10px;
    border: none;
    outline: none;
}

input[type="text"]:focus {
    border: 2px solid #4CAF50;
}


/* Галерея с возможностью прокрутки */
.gallery {
    max-height: 80vh; /* Ограничиваем максимальную высоту, чтобы появилась прокрутка */
    overflow-y: auto; /* Вертикальная прокрутка */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, max-content));
    gap: 20px;
    justify-content: center;
    padding: 20px;
}



.folder, .image-card { 
    background: #222; 
    border-radius: 10px; 
    padding: 15px; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    width: 200px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    word-wrap: break-word; /* Перенос слов */
    overflow-wrap: break-word; /* Перенос слов */
    white-space: normal; /* Разрешить перенос строк */
    text-align: center; /* Выравнивание текста */
    padding: 10px; /* Отступы внутри карточки */    
}

.folder:hover, .image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.image-card img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #222;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 80%;
    max-height: 80%;
}

.modal img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: white;
}
.loading-indicator {
    display: none; /* Скрыть по умолчанию */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
}

.loader {
    border: 5px solid #f3f3f3; /* Светлый фон */
    border-top: 5px solid #4CAF50; /* Зеленый цвет для вращающегося сегмента */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    font-size: 1.2rem;
    margin-top: 10px;
}

/* Контейнер для кнопок (папок), который будет распределять их по строкам */
.gallery {
    display: flex;
    flex-wrap: wrap;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    justify-content: center;
    padding: 20px 40px; /* Отступы сверху/снизу по 20px, а справа/слева по 40px */
}


/* Стили для каждой кнопки (папки) */
.folder {
    background-color: #333; /* Темный фон для кнопки */
    border: 2px solid #555; /* Тонкая граница чуть светлее фона */
    border-radius: 12px; /* Округлые углы */
    padding: 15px; /* Отступы внутри кнопки */
    text-align: center; /* Выравнивание содержимого по центру */
    transition: all 0.3s ease; /* Плавное изменение */
    cursor: pointer; /* Указатель мыши на кнопке */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Тень для кнопки */
}

/* Эффект при наведении */
.folder:hover {
    background-color: #444; /* Немного светлее фон при наведении */
    transform: scale(1.10); /* Легкое увеличение размера при наведении */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4); /* Более выраженная тень */
}

/* Стили для изображения */
.folder-image {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px; /* Округление углов изображения */
    object-fit: cover; /* Масштабирование изображения, чтобы оно не искажалось */
    margin-bottom: 10px; /* Отступ снизу между изображением и текстом */
}


/* Стили для текста на кнопке */
.folder strong {
    display: block; /* Делает текст блочным элементом */
    font-size: 16px; /* Размер шрифта */
    font-weight: bold; /* Жирный шрифт */
    color: #fff; /* Белый цвет текста, чтобы было видно на темном фоне */
    text-transform: capitalize; /* Преобразование первой буквы в верхний регистр */
}

/* Стиль для названия каталога */
.folder-name {
    display: inline-block; /* Меняет блочный элемент на строчно-блочный */
    margin-top: 10px;
    padding: 10px;
    font-weight: bold;
    color: #ffffff;
    font-size: 0.9em;
    border: 2px solid #555; /* Тонкая рамка */
    border-radius: 8px; /* Округление углов */
    background-color: #333; /* Фон в стиле страницы */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); /* Легкая тень для эффекта */
    width: fit-content; /* Подгоняет ширину под контент */
    margin-left: 10px; /* Немного отступа слева между элементами */
    margin-right: 10px; /* Немного отступа справа между элементами */
    text-align: center; /* Выравнивание текста по центру */
}

/* Обертка для кнопок категорий, чтобы выровнять все кнопки по центру */
#category-buttons {
    display: flex; /* Используем flexbox для выравнивания */
    justify-content: center; /* Выравнивание по центру */
    flex-wrap: wrap; /* Разрешаем перенос элементов на новую строку */
    gap: 10px; /* Расстояние между элементами */
}


/* .site-footer {
    text-align: center;
    padding: 20px;
    background: #f5f5f5;
} */

.site-link {
    color: inherit; /* Наследует цвет текста */
    text-decoration: none; /* Убирает подчеркивание */
    cursor: pointer; /* Меняет курсор на указатель */
    position: relative;
}

.site-link:hover:after {
    content: " (перейти на сайт)";
    font-size: 0.8em;
    color: #666;
}

/* Дополнительно можно добавить визуальный эффект при наведении */
.site-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}


/* Адаптация под мобильные устройства */
@media (max-width: 768px) {
    .gallery {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 10px;
    }

    .image-card {
        width: 40%; /* Две карточки в ряд */
    }

    .folder {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 10px;
        width: 40%;
    }

    .favorite-btn {
        padding: 10px;
        font: optional;
    }


}


#searchQuery {
    cursor: text; /* Курсор ввода текста */
}

#searchQuery:hover {
    cursor: text; /* При наведении курсор как в Word */
}

#searchQuery:focus {
    cursor: none; /* При вводе скрываем курсор */
}
