/* === Форма поиска (шорткод [book_library]) === */
.sbl-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}
.sbl-search-form input,
.sbl-search-form select,
.sbl-search-form button {
    flex: 1;           /* каждый элемент занимает равную долю ширины строки */
    min-width: 150px;  /* чтобы не сжимались слишком сильно на узких экранах */
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.sbl-search-form button {
    padding: 8px 16px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.sbl-search-form button:hover {
    background: #135e96;
}

/* === Сетка книг (шорткод [book_library]) — 5 книг в ряд === */
.sbl-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}
@media (max-width: 1100px) {
    .sbl-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* Планшет */
@media (max-width: 900px) {
    .sbl-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
/* Телефон */
@media (max-width: 600px) {
    .sbl-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}
@media (max-width: 700px) {
    .sbl-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 460px) {
    .sbl-grid {
        grid-template-columns: 1fr;
    }
}

.sbl-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid #f0f1f3;
    border-radius: 12px;
    padding: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sbl-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.sbl-card-cover img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.sbl-card-title {
    margin-top: 12px;
    font-weight: 600;
    color: #14171f;
}

.sbl-card-author {
    color: #6b7280;
    font-size: 0.9em;
    margin-top: 4px;
}



/* === Страница отдельной книги === */
.sbl-single-wrap {
    padding: 40px 20px;
}
.sbl-single-book {
    display: flex;
    gap: 48px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #f0f1f3;
}
.sbl-single-cover {
    flex: 0 0 auto;
}
.sbl-single-cover img {
    width: 240px;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}
.sbl-single-info {
    flex: 1;
    min-width: 280px;
}
.sbl-single-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 2rem;
    line-height: 1.25;
    color: #14171f;
    font-weight: 700;
}

/* Поля (автор, страницы, ISBN, категория и т.д.) в виде аккуратных плашек */
.sbl-single-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}
.sbl-field {
    margin: 0;
    padding: 10px 16px;
    background: #f6f7f9;
    border-radius: 8px;
    font-size: 0.97rem;
    color: #333;
}
.sbl-field strong {
    color: #6b7280;
    font-weight: 600;
    margin-right: 6px;
}

.sbl-single-description {
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid #eef0f2;
}
.sbl-single-description h3 {
    font-size: 1.1rem;
    color: #14171f;
    margin-bottom: 10px;
}
.sbl-single-description p {
    color: #4b5563;
    line-height: 1.7;
}

.sbl-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #2b8aef, #1e6fd1);
    color: #fff !important;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 6px 16px rgba(43, 138, 239, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sbl-download-icon {
    flex-shrink: 0;
}
.sbl-download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(43, 138, 239, 0.4);
    background: linear-gradient(135deg, #1e6fd1, #1558a8);
}

@media (max-width: 640px) {
    .sbl-single-book {
        padding: 24px;
        gap: 24px;
    }
    .sbl-single-cover img {
        width: 180px;
        margin: 0 auto;
        display: block;
    }
    .sbl-single-title {
        font-size: 1.5rem;
        text-align: center;
    }
}

/* Увеличение обложки при клике */
.sbl-cover-clickable {
    cursor: zoom-in;
}

.sbl-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.sbl-lightbox.sbl-lightbox-open {
    display: flex;
}
.sbl-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
/* Абзацы в описании книги */
.sbl-description-content {
    max-width: 100%;
}
.sbl-description-content p {
    margin: 0;
    color: #4b5563;
    line-height: 1.7;
    font-size: 1rem;
    text-align: justify; /* текст выравнивается по обоим краям, как в документе */
}
.sbl-description-content p:last-child {
    margin-bottom: 0;
}
/* === [book_library_latest] — сетка последних книг === */
.sbl-latest-grid {
    display: grid;
    grid-template-columns: repeat(var(--sbl-columns, 4), 1fr);
    gap: 24px;
}
@media (max-width: 900px) {
    .sbl-latest-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 560px) {
    .sbl-latest-grid {
        grid-template-columns: 1fr;
    }
}

/* Карточка книги — используется и в [book_library], и в [book_library_latest] */
.sbl-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.sbl-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
    border-color: #dfe3e8;
}
.sbl-card-cover {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}
.sbl-card-cover img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.sbl-card:hover .sbl-card-cover img {
    transform: scale(1.04);
}
.sbl-card-title {
    margin-top: 14px;
    font-weight: 600;
    font-size: 0.98rem;
    color: #14171f;
    line-height: 1.35;
}
.sbl-card-author {
    color: #8a8f98;
    font-size: 0.85rem;
    margin-top: 4px;
}

/* === [book_categories_list] — список категорий со счётчиком === */
.single-content .sbl-category-list,
.sbl-category-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-left: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.sbl-category-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 16px;
    border-radius: 10px;
    text-decoration: none;
    color: #2b2f38;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.sbl-category-item a:hover {
    background: #f7f9fc;
    border-color: #eef0f3;
    transform: translateX(2px);
}
.sbl-category-name {
    font-size: 0.96rem;
    font-weight: 400;
}
.sbl-category-count {
    background: #eef2ff;
    color: #4f5fce;
    font-size: 0.8rem;
    min-width: 34px;
    text-align: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 700;
    transition: background 0.15s ease, color 0.15s ease;
}
.sbl-category-item a:hover .sbl-category-count {
    background: #4f5fce;
    color: #fff;
}