/* =====================================================
   Кітапхана — архив книг
   Версия: 1.0.0
   ===================================================== */

.books-archive-container {
    width: 100%;
    padding: 0 0 40px;
    position: relative;
}

/* -------------------------------------------------------
   Фильтры
------------------------------------------------------- */
.books-filters {
    margin-bottom: 28px;
}

.books-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
}

.books-filter-item.books-filter-search {
    flex: 2 1 200px;
}

.books-filter-item.books-filter-select {
    flex: 1 1 160px;
}

.books-filter-item.books-filter-reset {
    flex: 0 0 auto;
}

.books-filter-input,
.books-filter-select-el {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d5d5d5;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    background: #fff;
    height: 42px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1;
}

.books-filter-input:focus,
.books-filter-select-el:focus {
    outline: none;
    border-color: #888;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.books-filter-select-el {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 11 11'%3E%3Cpath fill='%23666' d='M5.5 8L1 3h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.books-reset-btn {
    height: 42px;
    padding: 0 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: transparent;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.books-reset-btn:hover {
    border-color: #333;
    color: #333;
    background: #f5f5f5;
}

/* -------------------------------------------------------
   Зона результатов
------------------------------------------------------- */
.books-results {
    position: relative;
    min-height: 200px;
}

.books-results.loading {
    opacity: 0.45;
    pointer-events: none;
}

/* -------------------------------------------------------
   Сетка: 6 в строку
------------------------------------------------------- */
.books-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin-bottom: 36px;
}

/* -------------------------------------------------------
   Карточка книги
------------------------------------------------------- */
.books-card {
    display: flex;
    flex-direction: column;
}

.books-card-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* Обложка */
.books-card-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 5px;
    overflow: hidden;
    background: #f0f0f0;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.books-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.books-card-link:hover .books-card-cover img {
    transform: scale(1.04);
}

.books-card-no-cover {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
}

/* Мета */
.books-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.books-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.books-card-link:hover .books-card-title {
    color: #555;
}

.books-card-author {
    font-size: 12px;
    color: #888;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.books-card-theme {
    font-size: 11px;
    color: #aaa;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* -------------------------------------------------------
   Нет результатов
------------------------------------------------------- */
.books-no-results {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: #aaa;
    font-size: 15px;
}

/* -------------------------------------------------------
   Кнопка «Загрузить ещё»
------------------------------------------------------- */
.books-loadmore-wrap {
    text-align: center;
    margin-top: 10px;
}

.books-loadmore-btn {
    display: inline-block;
    padding: 11px 40px;
    border: 1px solid #333;
    background: transparent;
    color: #333;
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    letter-spacing: 0.02em;
}

.books-loadmore-btn:hover {
    background: #333;
    color: #fff;
}

.books-loadmore-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* -------------------------------------------------------
   Loader
------------------------------------------------------- */
.books-loader {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.books-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #eee;
    border-top-color: #555;
    border-radius: 50%;
    animation: books-spin 0.9s linear infinite;
}

@keyframes books-spin {
    to { transform: rotate(360deg); }
}

/* -------------------------------------------------------
   Адаптив
------------------------------------------------------- */
@media (max-width: 1200px) {
    .books-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 992px) {
    .books-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

@media (max-width: 540px) {
    .books-filter-item.books-filter-search,
    .books-filter-item.books-filter-select {
        flex: 1 1 100%;
    }

    .books-filter-item.books-filter-reset {
        flex: 1 1 100%;
    }

    .books-reset-btn {
        width: 100%;
    }

    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}
