@extends('layouts.user')

@section('title', 'Smart Dermatology | Book')
@section('body_class', 'book-body')

@push('styles')
    <link rel="stylesheet" href="{{ asset('theme/user/css/book.css') }}">
@endpush

@section('content')
    <main class="book-shell">
        <aside class="book-sidebar" aria-label="Table of contents">
            <div class="book-sidebar__inner">
                <div class="d-flex align-items-center justify-content-between gap-2 mb-3">
                    <div class="book-brand">
                        <div class="book-brand__title">Skin Guide</div>
                        <div class="book-brand__subtitle">A book-style reader</div>
                    </div>
                    <button class="btn btn-sm btn-outline-secondary book-icon-btn d-lg-none" id="tocCloseBtn" type="button" aria-label="Close table of contents">
                        <i class="fa-solid fa-xmark"></i>
                    </button>
                </div>

                <div class="book-search mb-3">
                    <i class="fa-solid fa-magnifying-glass"></i>
                    <input id="bookSearch" type="search" class="form-control" placeholder="Search chapters..." autocomplete="off">
                </div>

                <nav id="bookToc" class="book-toc"></nav>
            </div>
        </aside>

        <section class="book-reader" aria-label="Reader">
            <div class="book-topbar">
                <button class="btn btn-sm btn-outline-secondary book-icon-btn d-lg-none" id="tocOpenBtn" type="button">
                    <i class="fa-solid fa-bars"></i>
                    <span class="ms-1">Contents</span>
                </button>
                <div class="book-topbar__spacer"></div>
                <div class="book-controls">
                    <button class="btn btn-sm btn-outline-secondary book-icon-btn" id="fontDecBtn" type="button" title="Decrease font size"><i class="fa-solid fa-minus"></i></button>
                    <button class="btn btn-sm btn-outline-secondary book-icon-btn" id="fontIncBtn" type="button" title="Increase font size"><i class="fa-solid fa-plus"></i></button>
                    <button class="btn btn-sm btn-outline-secondary book-icon-btn" id="themeBtn" type="button" title="Toggle theme"><i class="fa-solid fa-moon"></i></button>
                </div>
            </div>

            <div class="book-progress" aria-hidden="true"><div class="book-progress__bar" id="bookProgressBar"></div></div>

            <article class="book-content">
                <header class="book-content__header">
                    <div class="book-content__meta" id="bookMeta"></div>
                    <h1 class="book-content__title" id="bookTitle"></h1>
                    <p class="book-content__subtitle" id="bookSubtitle"></p>
                </header>
                <div class="book-content__body" id="bookBody"></div>
                <footer class="book-content__footer">
                    <div class="d-flex align-items-center justify-content-between gap-2 flex-wrap">
                        <button class="btn btn-outline-secondary" id="prevBtn" type="button"><i class="fa-solid fa-arrow-left me-2"></i>Previous</button>
                        <div class="book-pagehint" id="bookHint"></div>
                        <button class="btn btn-pink" id="nextBtn" type="button">Next<i class="fa-solid fa-arrow-right ms-2"></i></button>
                    </div>
                </footer>
            </article>
        </section>
    </main>
@endsection

@push('scripts')
    <script src="{{ asset('theme/user/js/book-data.js') }}"></script>
    <script src="{{ asset('theme/user/js/book.js') }}"></script>
@endpush
