/* Books page specific styles */

/* Контейнер для заголовка и контролей */
.header-container {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.about-name {
    margin-bottom: 0.5rem;
}

.books-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
    margin-left: 0;
}

.sort-select {
    height: 30px;
    font-size: 1rem;
    background-color: inherit;
    color: var(--text-color);
    padding: 0 0.5rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-sm);
    min-width: 130px;
}

/* Стили для options внутри select */
.sort-select option {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Стили для активного/выбранного option */
.sort-select option:checked,
.sort-select option:hover,
.sort-select option:focus {
    background-color: var(--primary-color);
    color: var(--bg-color);
}

/* Стили для select при фокусе */
.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color-light);
}

/* Switch styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
    cursor: pointer;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    border: 1px solid var(--primary-color);
    transition: all 0.3s ease;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: var(--primary-color);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(19px);
    background-color: var(--bg-color);
}

/* Books grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    width: 100%;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .books-controls {
        margin-left: 0;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }
}

/* Book card styles */
.book-card {
    display: flex;
    flex-direction: column;
    border: none;
    min-height: 250px;
    align-items: center;
    min-width: 130px;
    max-width: 100%;
    opacity: 1;
}

.book-link {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.book-link:hover {
    background-color: transparent;
    border: none;
}

/* Явно указываем размеры для обложек книг, чтобы они оставались одинаковыми при всех переходах */
.book-cover {
    width: 72% !important;
    height: auto;
    max-width: 92% !important;
    min-width: 92% !important;
    max-height: 100vh;
    object-fit: contain;
    margin: 0 auto;
    display: block;
    transition: none;
}

.hide-covers .book-cover {
    display: none !important;
}

.book-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-top: 0.5rem;
    opacity: 1;
}

.book-author {
    font-size: var(--font-size-sm);
    color: var(--text-color-muted);
    opacity: 1;
}

/* Animation for book cards - removing transform to prevent jump */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Stagger animation for book cards */
.book-card:nth-child(1) { animation: fadeIn 0.5s ease-out forwards; animation-delay: 0.1s; }
.book-card:nth-child(2) { animation: fadeIn 0.5s ease-out forwards; animation-delay: 0.2s; }
.book-card:nth-child(3) { animation: fadeIn 0.5s ease-out forwards; animation-delay: 0.3s; }
.book-card:nth-child(4) { animation: fadeIn 0.5s ease-out forwards; animation-delay: 0.4s; }
/* ... добавить больше если нужно */

/* Стили для книг без обложек */
.hide-covers .book-card {
    background: var(--bg-color);
    padding: 1rem;
    border: none;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease-in-out;
}

.hide-covers .book-title {
    margin-top: 0;
    color: var(--primary-color);
    opacity: 1;
}

.hide-covers .book-author {
    margin-top: 0.5rem;
    opacity: 1;
} 

/* Добавляем дополнительные стили для страницы с детальной информацией о книге */
.book-details .book-cover {
    width: 300px;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

@media (max-width: 768px) {
    .book-details .book-cover {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}