/* Book detail page — product hero + purchase panel */

.book-detail {
    --book-cover-radius: 0.85rem;
    --book-panel-radius: 1rem;
    --book-accent: #0d9f6e;
    --book-accent-soft: rgba(13, 159, 110, 0.12);
    --book-warn: #f0a202;
    --book-muted: var(--bs-secondary-color, #6c757d);
}

.book-detail__breadcrumb {
    --bs-breadcrumb-divider: "‹";
    margin-bottom: 1.25rem;
}

.book-detail__breadcrumb .breadcrumb-item a {
    text-decoration: none;
}

.book-detail__breadcrumb .breadcrumb-item a:hover {
    text-decoration: underline;
}

.book-detail__hero {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

.book-detail__aside {
    order: -1;
}

@media (min-width: 992px) {
    .book-detail__hero {
        grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
        gap: 2rem;
    }

    .book-detail__aside {
        order: 0;
    }
}

.book-detail__main {
    min-width: 0;
}

.book-detail__title {
    font-size: clamp(1.45rem, 2.2vw, 1.9rem);
    font-weight: 800;
    line-height: 1.35;
    margin: 0 0 0.35rem;
}

.book-detail__subtitle {
    color: var(--book-muted);
    font-size: 0.95rem;
    margin: 0 0 1rem;
    letter-spacing: 0.02em;
}

.book-detail__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
}

.book-detail__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    line-height: 1.2;
    background: rgba(13, 110, 253, 0.08);
    color: #0b5ed7;
    border: 1px solid rgba(13, 110, 253, 0.12);
}

.book-detail__chip--muted {
    background: rgba(108, 117, 125, 0.1);
    color: #495057;
    border-color: rgba(108, 117, 125, 0.14);
}

.book-detail__chip--ai {
    background: var(--book-accent-soft);
    color: #0a7a55;
    border-color: rgba(13, 159, 110, 0.22);
    font-weight: 700;
}

.book-detail__chip i {
    font-size: 0.95rem;
    opacity: 0.9;
}

.book-detail__ai-note {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin: 0 0 1.1rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.7rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #0a7a55;
    background: var(--book-accent-soft);
    border: 1px solid rgba(13, 159, 110, 0.16);
}

.book-detail__ai-note i {
    font-size: 1rem;
    margin-top: 0.12rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.book-detail__rating {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 1.15rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    background: rgba(240, 162, 2, 0.08);
    border: 1px solid rgba(240, 162, 2, 0.16);
}

.book-detail__stars {
    display: inline-flex;
    gap: 0.15rem;
    direction: ltr;
    color: #d0d0d0;
    font-size: 1.15rem;
    line-height: 1;
}

.book-detail__stars .is-on {
    color: var(--book-warn);
}

.book-detail__rating-score {
    font-weight: 700;
    color: #9a6b00;
}

.book-detail__rating-count {
    color: var(--book-muted);
    font-size: 0.875rem;
}

.book-detail__lead {
    font-size: 1.02rem;
    line-height: 1.85;
    margin: 0 0 1.25rem;
    color: inherit;
}

.book-detail__files {
    margin-bottom: 0.25rem;
}

.book-detail__files-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--book-muted);
    margin-bottom: 0.55rem;
}

.book-detail__file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.book-detail__file {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 0.65rem;
    font-size: 0.86rem;
    font-weight: 600;
    background: var(--book-accent-soft);
    color: #0a7a55;
    border: 1px solid rgba(13, 159, 110, 0.18);
}

.book-detail__file i {
    font-size: 1rem;
}

/* Purchase / cover panel */
.book-detail__aside {
    position: relative;
}

@media (min-width: 992px) {
    .book-detail__aside-sticky {
        position: sticky;
        top: 5.5rem;
    }
}

.book-detail__panel {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--book-panel-radius);
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.book-detail__cover-wrap {
    position: relative;
    background:
        radial-gradient(circle at 30% 20%, rgba(13, 159, 110, 0.12), transparent 55%),
        linear-gradient(160deg, #f4f7f5 0%, #e8eef0 100%);
    padding: 1.25rem 1.25rem 0.5rem;
    display: flex;
    justify-content: center;
}

.book-detail__cover {
    width: min(100%, 220px);
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: var(--book-cover-radius);
    box-shadow:
        0 12px 28px rgba(15, 23, 42, 0.18),
        0 2px 6px rgba(15, 23, 42, 0.08);
    background: #fff;
}

.book-detail__owned-ribbon {
    position: absolute;
    top: 0.85rem;
    inset-inline-start: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--book-accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(13, 159, 110, 0.35);
}

.book-detail__panel-body {
    padding: 1.15rem 1.25rem 1.35rem;
}

.book-detail__price-block {
    margin-bottom: 1rem;
}

.book-detail__price-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 0.75rem;
}

.book-detail__price {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--book-accent);
    margin: 0;
    line-height: 1.2;
}

.book-detail__price--free {
    color: var(--book-accent);
}

.book-detail__old-price {
    font-size: 1rem;
    color: #dc3545;
    text-decoration: line-through;
    opacity: 0.85;
}

.book-detail__discount {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(220, 53, 69, 0.1);
    color: #c82333;
    font-size: 0.78rem;
    font-weight: 700;
}

.book-detail__actions {
    display: grid;
    gap: 0.65rem;
}

.book-detail__actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-weight: 700;
    border-radius: 0.7rem;
    padding: 0.7rem 1rem;
}

.book-detail__actions .btn-success {
    background: var(--book-accent);
    border-color: var(--book-accent);
}

.book-detail__actions .btn-success:hover {
    background: #0b8a5f;
    border-color: #0b8a5f;
}

.book-detail__owned-note {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.7rem;
    background: var(--book-accent-soft);
    color: #0a7a55;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.65rem;
}

.book-detail__owned-note i {
    font-size: 1.15rem;
    margin-top: 0.1rem;
}

.book-detail__hint {
    margin: 0.65rem 0 0;
    font-size: 0.8rem;
    color: var(--book-muted);
    text-align: center;
}

.book-detail__section {
    margin-top: 1.75rem;
}

.book-detail__section-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--book-panel-radius);
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 0.25rem 1rem rgba(15, 23, 42, 0.04);
}

.book-detail__section-card .card-body {
    padding: 1.35rem 1.5rem;
}

.book-detail__section-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 1rem;
}

.book-detail__description {
    line-height: 1.9;
}

.book-detail__description img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

/* Interactive rating (owned books) */
.book-rating-stars {
    display: inline-flex;
    gap: 0.2rem;
    direction: ltr;
}

.book-rating-stars button {
    border: 0;
    background: transparent;
    color: #c5c5c5;
    font-size: 1.45rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
}

.book-rating-stars button:hover {
    transform: scale(1.08);
}

.book-rating-stars button.is-active,
.book-rating-stars button.is-hover {
    color: var(--book-warn);
}

.book-detail__user-score {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--book-accent-soft);
    color: #0a7a55;
    font-size: 0.82rem;
    font-weight: 700;
}

@media (max-width: 991.98px) {
    .book-detail__cover {
        width: min(100%, 180px);
    }

    .book-detail__panel {
        max-width: 420px;
        margin-inline: auto;
    }
}

/* Dark theme */
[data-bs-theme="dark"] .book-detail__chip {
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.22);
}

[data-bs-theme="dark"] .book-detail__chip--muted {
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.2);
}

[data-bs-theme="dark"] .book-detail__chip--ai {
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.28);
}

[data-bs-theme="dark"] .book-detail__ai-note {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.22);
}

[data-bs-theme="dark"] .book-detail__rating {
    background: rgba(240, 162, 2, 0.1);
    border-color: rgba(240, 162, 2, 0.22);
}

[data-bs-theme="dark"] .book-detail__rating-score {
    color: #fbbf24;
}

[data-bs-theme="dark"] .book-detail__file {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.25);
}

[data-bs-theme="dark"] .book-detail__panel {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .book-detail__cover-wrap {
    background:
        radial-gradient(circle at 30% 20%, rgba(16, 185, 129, 0.16), transparent 55%),
        linear-gradient(160deg, #1a2332 0%, #121820 100%);
}

[data-bs-theme="dark"] .book-detail__owned-note {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
}

[data-bs-theme="dark"] .book-detail__user-score {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
}

[data-bs-theme="dark"] .book-detail__section-card {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0.35rem 1.25rem rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] .book-detail__discount {
    background: rgba(248, 113, 113, 0.14);
    color: #fca5a5;
}
