/* Book reader buttons and dialog (app/Views/components/book_reader.php). Uses theme tokens when present. */
.book-reader-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 20rem;
}

/* Under the cover gallery on the book page: room below the Front/Back captions. */
.cover-gallery ~ .book-reader-actions {
    margin-top: 1rem;
}

.book-reader-actions__button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--theme-color-primary, #006b67);
    border-radius: 999px;
    background: transparent;
    padding: 0.45rem 0.95rem 0.45rem 0.75rem;
    color: var(--theme-color-primary, #006b67);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.book-reader-actions__button--primary {
    background: var(--theme-color-primary, #006b67);
    color: var(--theme-color-primary-contrast, #fff);
}

.book-reader-actions__button:hover {
    filter: brightness(1.1);
}

.book-reader-actions__button:focus-visible {
    outline: 3px solid var(--theme-color-primary, #006b67);
    outline-offset: 2px;
}

.book-reader-actions__button svg {
    width: 1.1rem;
    height: 1.1rem;
}

.book-reader-actions__note {
    flex-basis: 100%;
    margin: 0;
    color: var(--theme-color-text-muted, #59636e);
    font-size: 0.8rem;
}

/* Full-screen reading surface. */
.book-reader {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    padding: 0;
    background: #26292d;
    color: #f4f4f5;
}

.book-reader[open] {
    display: grid;
    grid-template-rows: auto 1fr;
}

.book-reader::backdrop {
    background: rgb(0 0 0 / 0.7);
}

html:has(.book-reader[open]) {
    overflow: hidden;
}

.book-reader__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    border-bottom: 1px solid #3a3f45;
    background: #1c1f22;
    padding: 0.6rem 1rem;
}

.book-reader__heading {
    flex: 1 1 14rem;
    min-width: 0;
}

.book-reader__heading h2 {
    overflow: hidden;
    margin: 0;
    color: #fff;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-reader__heading p {
    margin: 0;
    color: #b6bcc4;
    font-size: 0.8rem;
}

.book-reader__nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.book-reader__tool:disabled {
    opacity: 0.4;
    cursor: default;
}

.book-reader__tool:disabled:hover {
    background: #2f3338;
}

.book-reader__status {
    min-width: 6.5rem;
    margin: 0;
    text-align: center;
    color: #d4d8dd;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.book-reader__tools {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.book-reader__tool {
    display: inline-grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border: 1px solid #4a5058;
    border-radius: 6px;
    background: #2f3338;
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
}

.book-reader__tool:hover {
    background: #3a3f45;
}

.book-reader__tool:focus-visible,
.book-reader__pages:focus-visible {
    outline: 3px solid #5eead4;
    outline-offset: 2px;
}

.book-reader__close {
    margin-left: 0.5rem;
}

.book-reader__zoom {
    min-width: 3.25rem;
    color: #d4d8dd;
    font-size: 0.85rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.book-reader__pages {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 1rem;
    overflow: auto;
    padding: 1rem;
    overscroll-behavior: contain;
}

.book-reader__page {
    max-width: none;
    background: #fff;
    box-shadow: 0 4px 18px rgb(0 0 0 / 0.45);
}

.book-reader__page canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.book-reader__error {
    max-width: 32rem;
    margin: 3rem auto;
    color: #f4f4f5;
    text-align: center;
}

.book-reader__error a {
    color: #5eead4;
}

@media (max-width: 42rem) {
    .book-reader__bar {
        padding: 0.5rem 0.75rem;
    }

    .book-reader__pages {
        padding: 0.5rem;
    }
}
