/* Book page styles (UnQbdWeb2) -- Book-detail "Details tab" cards.
   These classes render inside .book-view-page, where book-reader.css defines
   the --bvr-* token layer that cascades in (light + dark). We consume those
   tokens with literal fallbacks; dark mode is handled by the token layer
   re-pointing, so explicit body.dark-mode rules below exist only where a
   hardcoded (non-tokenized) value needs a dark counterpart. */

/* ==============================================
   SECTION + CARD SHELL
   ============================================== */

.book-section {
    margin-bottom: 1.25rem;
}

.book-section-card {
    background: var(--bvr-surface, #FFFFFF);
    border: 1px solid var(--bvr-border, #E0E0E0);
    border-radius: var(--bvr-r-lg, 16px);
    box-shadow: var(--bvr-shadow-sm, 0 1px 2px rgba(2, 6, 23, 0.06));
    padding: 1.5rem;
}

/* Stack consecutive cards inside the same section with breathing room. Without
   this gap the Own a Copy retailer card and the Get Full Access CTA touch
   each other on book detail pages (caught during App Review feedback). */
.book-section-card + .book-section-card {
    margin-top: 1.25rem;
}

.book-section-title {
    margin: 0 0 0.85rem 0;
    color: var(--bvr-ink, #222222);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.book-section-title i {
    font-size: 1.45rem;
    color: var(--bvr-primary-deep, #0174B1);
}

/* ==============================================
   DESCRIPTION
   ============================================== */

.book-description-full {
    color: var(--bvr-ink-2, #475569);
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 1.25rem;
}

.book-description-full p {
    margin-bottom: 1rem;
}

.book-description-full p:last-child {
    margin-bottom: 0;
}

/* ==============================================
   METADATA
   ============================================== */

.book-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1px;
    margin-top: 1.25rem;
    background: var(--bvr-border, #E0E0E0);
    border: 1px solid var(--bvr-border, #E0E0E0);
    border-radius: var(--bvr-r-md, 12px);
    overflow: hidden;
}

.book-metadata-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.85rem 0.95rem;
    background: var(--bvr-surface, #FFFFFF);
}

.book-metadata-item i {
    color: var(--bvr-primary-deep, #0174B1);
    font-size: 1.1rem;
    margin-bottom: 0.1rem;
}

.book-metadata-label {
    color: var(--bvr-ink-3, #64748B);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.book-metadata-value {
    color: var(--bvr-ink, #222222);
    font-size: 0.9rem;
    font-weight: 600;
}

/* ==============================================
   RATING SUMMARY (average stars + count)
   ============================================== */

.book-rating {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 1.1rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--bvr-border, #E0E0E0);
}

.book-rating-stars {
    display: flex;
    gap: 0.1rem;
    color: var(--bvr-cta, #FFAA00);
    font-size: 1.15rem;
}

.book-rating-text {
    font-size: 0.85rem;
    color: var(--bvr-ink-3, #64748B);
    font-weight: 600;
}

/* ==============================================
   REVIEWS
   ============================================== */

.book-reviews {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    margin-top: 1.1rem;
}

.book-review-button {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    background: var(--bvr-primary, #00B4FF);
    color: #FFFFFF;
    border: none;
    border-radius: var(--bvr-r-sm, 8px);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: var(--bvr-shadow-sm, 0 1px 2px rgba(2, 6, 23, 0.06));
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.book-review-button:hover {
    background: var(--bvr-primary-deep, #0174B1);
    transform: translateY(-1px);
    box-shadow: var(--bvr-shadow-md, 0 6px 18px rgba(2, 6, 23, 0.12));
}

/* Public reviews list block */
.book-reviews-list-section {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--bvr-border, #E0E0E0);
}

.book-reviews-list-heading {
    margin: 0 0 1rem 0;
    color: var(--bvr-ink, #222222);
    font-weight: 700;
    font-size: 1.05rem;
}

.book-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-height: 600px;
    overflow-y: auto;
}

.book-reviews-more-info {
    margin: 1rem 0 0 0;
    color: var(--bvr-ink-3, #64748B);
    font-size: 0.85rem;
    text-align: center;
}

.book-review-item {
    padding: 0;
}

.book-review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.4rem;
    gap: 0.75rem;
}

.book-review-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.book-review-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bvr-primary, #00B4FF);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.book-review-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.book-review-username {
    color: var(--bvr-ink, #222222);
    font-weight: 700;
    font-size: 0.9rem;
}

.book-review-date {
    color: var(--bvr-ink-3, #64748B);
    font-size: 0.8rem;
}

.book-review-rating {
    display: flex;
    gap: 0.05rem;
    color: var(--bvr-cta, #FFAA00);
    font-size: 0.85rem;
}

/* Right side of a review header: star rating plus the report/block kebab. */
.book-review-meta {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.book-review-text {
    margin: 0.3rem 0 0 0;
    color: var(--bvr-ink-2, #475569);
    font-size: 0.9rem;
    line-height: 1.55;
}

.book-reviews-empty {
    text-align: center;
    color: var(--bvr-ink-3, #64748B);
    font-size: 0.95rem;
    padding: 1.5rem 0;
}

/* ==============================================
   GET ACCESS CARD (Guest - not logged in)
   ============================================== */

.book-access-card {
    background: linear-gradient(150deg, var(--bvr-primary, #00B4FF), var(--bvr-primary-deep, #0174B1));
    color: #FFFFFF;
    text-align: center;
    border: none;
    box-shadow: var(--bvr-shadow-md, 0 6px 18px rgba(2, 6, 23, 0.12));
    position: relative;
    overflow: hidden;
}

.book-access-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.16) 0%, transparent 70%);
    pointer-events: none;
}

.book-access-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    z-index: 1;
}

.book-access-icon-ring {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-access-icon-ring i {
    font-size: 1.85rem;
    color: #FFFFFF;
}

.book-access-title {
    margin: 0;
    color: #FFFFFF;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -0.01em;
}

.book-access-text {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
    max-width: 500px;
    line-height: 1.55;
}

.book-access-features {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0.25rem 0;
}

.book-access-feature {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 500;
}

.book-access-feature i {
    color: #FFFFFF;
    font-size: 0.95rem;
}

.book-access-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

.book-access-button-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--bvr-cta, #FFAA00);
    color: #FFFFFF;
    border: none;
    border-radius: var(--bvr-r-sm, 8px);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.book-access-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.book-access-button-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--bvr-r-sm, 8px);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.book-access-button-secondary:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.6);
}

.book-access-pricing {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

/* ==============================================
   UPGRADE CARD (Free tier users)
   ============================================== */

.book-upgrade-card {
    background: linear-gradient(150deg, var(--bvr-primary, #00B4FF), var(--bvr-primary-deep, #0174B1));
    border: none;
    color: #FFFFFF;
    text-align: center;
    box-shadow: var(--bvr-shadow-md, 0 6px 18px rgba(2, 6, 23, 0.12));
    position: relative;
    overflow: hidden;
}

.book-upgrade-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.14) 0%, transparent 70%);
    pointer-events: none;
}

.book-upgrade-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}

.book-upgrade-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.85rem;
    background: rgba(255, 255, 255, 0.18);
    color: #FFFFFF;
    border-radius: var(--bvr-r-pill, 999px);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.book-upgrade-badge i {
    font-size: 0.85rem;
}

.book-upgrade-title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.book-upgrade-text {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
    max-width: 480px;
    line-height: 1.55;
}

.book-upgrade-price-row {
    display: flex;
    align-items: baseline;
    gap: 0.15rem;
    margin: 0.2rem 0;
}

.book-upgrade-price {
    font-size: 2.25rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.02em;
}

.book-upgrade-period {
    font-size: 1.05rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.book-upgrade-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.75rem;
    background: var(--bvr-cta, #FFAA00);
    color: #FFFFFF;
    border: none;
    border-radius: var(--bvr-r-sm, 8px);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
    margin-top: 0.2rem;
}

.book-upgrade-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

/* ==============================================
   PURCHASE CARD (Own a Copy - all tiers)
   ============================================== */

.book-purchase-card {
    margin-top: 1rem;
}

.book-purchase-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.book-purchase-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.book-purchase-header i {
    font-size: 1.3rem;
    color: var(--bvr-primary-deep, #0174B1);
}

.book-purchase-heading {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bvr-ink, #222222);
}

.book-purchase-subtext {
    margin: 0 0 0.75rem 0;
    font-size: 0.85rem;
    color: var(--bvr-ink-2, #475569);
}

.book-purchase-links {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.book-purchase-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: var(--bvr-surface, #FFFFFF);
    border-radius: var(--bvr-r-md, 12px);
    color: inherit;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--bvr-border, #E0E0E0);
}

.book-purchase-link:hover {
    background: var(--bvr-surface-2, #F8FAFC);
    border-color: var(--bvr-primary, #00B4FF);
    transform: translateX(2px);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--bvr-shadow-sm, 0 1px 2px rgba(2, 6, 23, 0.06));
}

.purchase-link-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.purchase-retailer {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--bvr-ink, #222222);
}

.purchase-format {
    font-size: 0.78rem;
    color: var(--bvr-ink-3, #64748B);
}

.purchase-link-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.purchase-price {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--bvr-ink, #222222);
}

.book-purchase-link i {
    font-size: 0.95rem;
    color: var(--bvr-ink-3, #64748B);
    transition: color 0.2s ease, transform 0.2s ease;
}

.book-purchase-link:hover i {
    color: var(--bvr-primary-deep, #0174B1);
    transform: translateX(2px);
}

/* ==============================================
   NOTICE
   ============================================== */

.book-notice {
    margin: 1.5rem auto 0 auto;
    max-width: 800px;
    padding: 0.9rem 1.25rem;
    background: var(--bvr-chip, #F1F5F9);
    border: 1px solid var(--bvr-border, #E0E0E0);
    border-radius: var(--bvr-r-md, 12px);
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
}

.book-notice i {
    color: var(--bvr-primary-deep, #0174B1);
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.book-notice p {
    margin: 0;
    color: var(--bvr-ink-2, #475569);
    font-size: 0.88rem;
    line-height: 1.5;
}

.book-notice strong {
    font-weight: 700;
    color: var(--bvr-ink, #222222);
}

/* ==============================================
   RATING FORM (write / edit a review)
   ============================================== */

.book-rating-form {
    background: var(--bvr-surface-2, #F8FAFC);
    border: 1px solid var(--bvr-border, #E0E0E0);
    border-radius: var(--bvr-r-md, 12px);
    padding: 1.25rem;
    margin-bottom: 1.1rem;
}

.book-rating-form h3 {
    margin: 0 0 1rem 0;
    color: var(--bvr-ink, #222222);
    font-weight: 700;
    font-size: 1.15rem;
}

.rating-stars-input {
    display: flex;
    gap: 0.2rem;
    margin-bottom: 1rem;
    justify-content: flex-start;
}

.rating-stars-input i {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.rating-stars-input i:hover {
    transform: scale(1.15);
}

.rating-review-text {
    width: 100%;
    padding: 0.85rem;
    border: 1px solid var(--bvr-border, #E0E0E0);
    border-radius: var(--bvr-r-md, 12px);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 110px;
    margin-bottom: 0.85rem;
    background: var(--bvr-surface, #FFFFFF);
    color: var(--bvr-ink, #222222);
}

.rating-review-text:focus {
    outline: none;
    border-color: var(--bvr-primary, #00B4FF);
    box-shadow: 0 0 0 3px rgba(0, 180, 255, 0.15);
}

.rating-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-submit-rating,
.btn-cancel-rating {
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: var(--bvr-r-sm, 8px);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-submit-rating {
    background: var(--bvr-primary, #00B4FF);
    color: #FFFFFF;
    box-shadow: var(--bvr-shadow-sm, 0 1px 2px rgba(2, 6, 23, 0.06));
}

.btn-submit-rating:hover:not(:disabled) {
    background: var(--bvr-primary-deep, #0174B1);
    transform: translateY(-1px);
    box-shadow: var(--bvr-shadow-md, 0 6px 18px rgba(2, 6, 23, 0.12));
}

.btn-submit-rating:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-cancel-rating {
    background: transparent;
    color: var(--bvr-ink-2, #475569);
    border: 1px solid var(--bvr-border, #E0E0E0);
}

.btn-cancel-rating:hover {
    background: var(--bvr-chip, #F1F5F9);
}

.user-rated-message {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.25rem;
    background: var(--bvr-chip, #F1F5F9);
    border: 1px solid var(--bvr-border, #E0E0E0);
    border-radius: var(--bvr-r-md, 12px);
    color: var(--bvr-ink, #222222);
    font-weight: 600;
    margin-bottom: 1.1rem;
}

.user-rated-message i {
    font-size: 1.35rem;
    color: var(--bvr-primary-deep, #0174B1);
}

/* ==============================================
   USER'S EXISTING RATING (display + edit affordance)
   ============================================== */

.user-existing-rating {
    padding: 1.1rem;
    background: var(--bvr-surface-2, #F8FAFC);
    border: 1px solid var(--bvr-border, #E0E0E0);
    border-radius: var(--bvr-r-md, 12px);
    margin-bottom: 1.1rem;
}

.existing-rating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.existing-rating-header h4 {
    margin: 0;
    color: var(--bvr-primary-deep, #0174B1);
    font-weight: 700;
    font-size: 0.95rem;
}

/* Lighter label in dark mode -- primary-deep on the dark rating card is too low-contrast. */
body.dark-mode .existing-rating-header h4 {
    color: var(--bvr-primary-light, #4DB8FF);
}

.btn-edit-rating {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    background: transparent;
    color: var(--bvr-ink-2, #475569);
    border: 1px solid var(--bvr-border, #E0E0E0);
    border-radius: var(--bvr-r-sm, 8px);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-edit-rating:hover {
    background: var(--bvr-chip, #F1F5F9);
    border-color: var(--bvr-primary, #00B4FF);
}

.existing-rating-stars {
    display: flex;
    gap: 0.1rem;
    color: var(--bvr-cta, #FFAA00);
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
}

.existing-rating-text {
    margin: 0 0 0.5rem 0;
    color: var(--bvr-ink-2, #475569);
    font-size: 0.95rem;
    line-height: 1.55;
}

.existing-rating-date {
    margin: 0;
    color: var(--bvr-ink-3, #64748B);
    font-size: 0.8rem;
}

/* ==============================================
   RESPONSIVE DESIGN
   ============================================== */

@media (max-width: 900px) {
    .book-metadata {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .book-section-card {
        padding: 1.25rem;
    }

    .book-purchase-links {
        gap: 0.5rem;
    }

    .book-access-features {
        flex-direction: column;
        gap: 0.6rem;
    }

    .book-access-actions {
        flex-direction: column;
        width: 100%;
    }

    .book-access-button-primary,
    .book-access-button-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* ==============================================
   DARK MODE
   ----------------------------------------------
   The --bvr-* token layer (book-reader.css) re-points under
   body.dark-mode .book-view-page, so every tokenized property above already
   adapts. Rules below cover only the few hardcoded values that need a dark
   counterpart -- mainly the focus ring on the review textarea.
   ============================================== */

body.dark-mode .rating-review-text:focus {
    box-shadow: 0 0 0 3px rgba(77, 184, 255, 0.25);
}
