/* =========================================================
   BIBLIOTEKA.KG BOOK VIEW PAGE
   ВАЖНО: подключать после theme.css
   ========================================================= */

.book-view-page {
    position: relative;
    padding: 24px 0 44px;
    color: var(--text);
}

.book-view-section {
    margin-bottom: 28px;
}

.book-view-main,
.book-view-sidebar {
    position: relative;
}

/* =========================================================
   BREADCRUMBS
   ========================================================= */

.book-view-breadcrumbs {
    padding: 13px 16px;
    color: var(--text);
    background: rgba(var(--surface-rgb), var(--glass-alpha));
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: var(--shadow);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.05);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.05);
}

.book-view-breadcrumbs .breadcrumb {
    background: transparent;
}

.book-view-breadcrumbs .breadcrumb,
.book-view-breadcrumbs .breadcrumb-item,
.book-view-breadcrumbs .breadcrumb-item a {
    color: var(--muted);
    font-weight: 650;
    text-decoration: none;
}

.book-view-breadcrumbs .breadcrumb-item.active {
    color: var(--text);
}

.book-view-breadcrumbs .breadcrumb-item a:hover,
.book-view-breadcrumbs .breadcrumb-item a:focus {
    color: var(--accent);
}

/* =========================================================
   HERO
   ========================================================= */

.book-hero-inner,
.book-section-card {
    position: relative;
    overflow: hidden;
    color: var(--text);
    background: rgba(var(--surface-rgb), var(--glass-alpha));
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: var(--shadow);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.05);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.05);
}

.book-hero-inner::before,
.book-section-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(720px 260px at 5% -10%, rgba(103, 232, 249, .16), transparent 62%),
        radial-gradient(620px 240px at 106% 110%, rgba(var(--tint-rgb), .18), transparent 60%);
    pointer-events: none;
}

.book-hero-inner {
    padding: 34px;
}

.book-hero-inner > .row,
.book-section-card > * {
    position: relative;
    z-index: 2;
}

.book-cover-frame {
    position: relative;
    padding: 12px;
    background: rgba(var(--surface-rgb), .72);
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .10);
}

html.theme-dark .book-cover-frame,
body.theme-dark .book-cover-frame {
    box-shadow: 0 10px 24px rgba(0, 0, 0, .26);
}

.book-cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    background:
        radial-gradient(420px 180px at 50% 0%, rgba(103, 232, 249, .10), transparent 60%),
        rgba(var(--surface-rgb), .82);
    overflow: hidden;
}

.book-cover img {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    object-position: center;
}

.book-hero-content {
    position: relative;
}

.book-view-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 7px 12px;
    color: var(--bg);
    background: var(--accent);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.book-title {
    margin: 0 0 14px;
    color: var(--text);
    font-size: clamp(30px, 3vw, 48px);
    font-weight: 850;
    line-height: 1.1;
}

.book-author-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 16px;
    font-weight: 700;
}

.book-author-line i {
    color: var(--accent);
}

.book-author-separator {
    opacity: .55;
}

.book-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.book-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 11px;
    color: var(--text);
    background: rgba(var(--surface-rgb), .72);
    border: 1px solid rgba(255, 255, 255, .18);
    font-size: 13px;
    font-weight: 750;
}

.book-meta-label {
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .035em;
}

.book-meta-value {
    color: var(--text);
}

/* =========================================================
   ACCESS BOX
   ========================================================= */

.book-access-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
    background: rgba(var(--surface-rgb), .72);
    border: 1px solid rgba(255, 255, 255, .18);
}

.book-access-text {
    display: grid;
    gap: 4px;
}

.book-access-text strong {
    color: var(--text);
    font-size: 16px;
    font-weight: 850;
}

.book-access-text span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.book-access-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.book-access-actions .btn,
.cta-smart-actions .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
}

/* Акцентируем основные кнопки, не ломая классы виджетов */
.book-access-actions .btn-warning,
.book-access-actions .btn-primary,
.book-access-actions .btn-success,
.book-access-actions .btn-cta,
.cta-smart-actions .btn-warning,
.cta-smart-actions .btn-primary,
.cta-smart-actions .btn-success,
.cta-smart-actions .btn-cta {
    color: var(--bg) !important;
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 10px 24px rgba(103, 232, 249, .20);
}

.book-access-actions .btn-warning:hover,
.book-access-actions .btn-primary:hover,
.book-access-actions .btn-success:hover,
.book-access-actions .btn-cta:hover,
.cta-smart-actions .btn-warning:hover,
.cta-smart-actions .btn-primary:hover,
.cta-smart-actions .btn-success:hover,
.cta-smart-actions .btn-cta:hover {
    color: var(--accent) !important;
    background: var(--bg) !important;
    border-color: var(--accent) !important;
}

/* =========================================================
   CONTENT SECTIONS
   ========================================================= */

.book-section-card {
    padding: 30px;
}

.book-section-header {
    margin-bottom: 18px;
}

.book-section-header h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(24px, 2.5vw, 34px);
    font-weight: 850;
    line-height: 1.15;
}

.book-desc {
    color: var(--text);
    font-size: 16px;
    line-height: 1.75;
}

.book-empty-text {
    margin: 0;
    color: var(--muted);
}

/* =========================================================
   TOC / ACCORDION
   ========================================================= */

.book-accordion-card {
    padding: 0;
}

.book-accordion-card .accordion {
    position: relative;
    z-index: 2;
}

.book-accordion-card .accordion-item {
    color: var(--text);
    background: transparent;
    border: 0;
}

.book-accordion-card .accordion-button {
    min-height: 64px;
    padding: 20px 24px;
    color: var(--text);
    background: rgba(var(--surface-rgb), .64);
    border: 0;
    box-shadow: none;
    font-size: 18px;
    font-weight: 850;
}

.book-accordion-card .accordion-button span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.book-accordion-card .accordion-button i {
    color: var(--accent);
}

.book-accordion-card .accordion-button:focus {
    box-shadow: 0 0 0 .2rem rgba(103, 232, 249, .25);
}

.book-accordion-card .accordion-button:not(.collapsed) {
    color: var(--text);
    background: rgba(var(--surface-rgb), .78);
    border-bottom: 1px solid var(--border);
}

.book-accordion-card .accordion-collapse {
    background: rgba(var(--surface-rgb), .50);
}

.book-accordion-card .accordion-body {
    padding: 24px;
    color: var(--text);
}

.book-toc {
    color: var(--text);
    line-height: 1.65;
}

.book-toc a {
    color: var(--accent);
}

.book-toc a:hover {
    color: var(--accent-hover);
}

.book-toc p,
.book-toc li,
.book-toc dt,
.book-toc dd {
    color: var(--text);
}

.book-toc hr {
    border-top: 1px solid var(--border);
    opacity: .7;
}

.book-toc ul {
    padding-left: 1.1rem;
}

.book-toc ol {
    padding-left: 1.25rem;
}

.book-toc table {
    width: 100%;
    border-collapse: collapse;
}

.book-toc table td,
.book-toc table th {
    border: 1px solid var(--border);
    padding: .35rem .5rem;
    color: var(--text);
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.book-view-sidebar-sticky {
    position: sticky;
    top: 96px;
}

/* Пока реклама старая, но карточки хотя бы вписываем в тему */
.book-view-sidebar .card,
.book-view-bottom-banner .card,
.book-view-top-banner .card {
    color: var(--text);
    background: rgba(var(--surface-rgb), var(--glass-alpha));
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: var(--shadow);
}

.book-view-sidebar img,
.book-view-bottom-banner img,
.book-view-top-banner img {
    display: block;
}

/* =========================================================
   SMART CTA
   ========================================================= */

.cta-smart-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -120px;
    z-index: 1040;
    padding: .65rem 0;
    color: var(--text);
    background: rgba(var(--surface-rgb), .92);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 18px rgba(0, 0, 0, .12);
    backdrop-filter: blur(8px) saturate(1.05);
    -webkit-backdrop-filter: blur(8px) saturate(1.05);
    transition: bottom .25s ease;
}

.cta-smart-bar.is-visible {
    bottom: 0;
}

.cta-smart-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.cta-smart-title {
    min-width: 0;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cta-smart-title strong {
    color: var(--text);
}

.cta-smart-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

@media (min-width: 992px) {
    .cta-smart-bar {
        display: none;
    }
}

/* =========================================================
   БЕЗ ЗАКРУГЛЕНИЙ — под текущую стилистику
   ========================================================= */

.book-view-breadcrumbs,
.book-hero-inner,
.book-section-card,
.book-cover-frame,
.book-cover,
.book-view-kicker,
.book-meta-chip,
.book-access-box,
.book-access-actions .btn,
.cta-smart-actions .btn,
.book-accordion-card .accordion-button,
.book-view-sidebar .card,
.book-view-bottom-banner .card,
.book-view-top-banner .card {
    border-radius: 0 !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1199.98px) {
    .book-hero-inner {
        padding: 28px;
    }

    .book-cover {
        min-height: 360px;
    }
}

@media (max-width: 991.98px) {
    .book-view-page {
        padding-top: 18px;
    }

    .book-view-sidebar-sticky {
        position: static;
        top: auto;
    }

    .book-view-sidebar {
        margin-top: 8px;
    }

    .book-cover {
        min-height: 340px;
    }
}

@media (max-width: 767.98px) {
    .book-title {
        font-size: 28px;
    }

    .book-hero-inner,
    .book-section-card {
        padding: 24px;
    }

    .book-cover {
        min-height: 320px;
    }

    .book-access-actions {
        flex-direction: column;
    }

    .book-access-actions .btn {
        width: 100%;
    }

    .cta-smart-bar-inner {
        align-items: stretch;
        flex-direction: column;
    }

    .cta-smart-title {
        white-space: normal;
    }

    .cta-smart-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .cta-smart-actions .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .book-hero-inner,
    .book-section-card {
        padding: 20px;
    }

    .book-cover {
        min-height: 280px;
    }

    .book-meta-grid {
        gap: 8px;
    }

    .book-meta-chip {
        width: 100%;
        justify-content: space-between;
    }

    .book-accordion-card {
        padding: 0;
    }

    .book-accordion-card .accordion-button {
        padding: 18px 20px;
    }

    .book-accordion-card .accordion-body {
        padding: 20px;
    }
}