<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WaifuBoard Books</title>
    <link rel="stylesheet" href="/views/css/globals.css">
    <link rel="stylesheet" href="/views/css/components/navbar.css">
    <link rel="stylesheet" href="/views/css/components/hero.css">
    <link rel="stylesheet" href="/views/css/components/anilist-modal.css">
    <link rel="stylesheet" href="/views/css/components/updateNotifier.css">
    <link rel="stylesheet" href="/views/css/components/local-library.css">
    <link rel="icon" href="/public/assets/waifuboards.ico" type="image/x-icon">
</head>
<body>
<div class="hero-wrapper">
    <div class="hero-background">
        <img id="hero-bg-media" src="" alt="">
    </div>
    <div class="hero-vignette"></div>

    <div class="hero-content">
        <div class="hero-poster-card">
            <img id="hero-poster" src="" alt="">
        </div>
        <div class="hero-text">
            <h1 class="hero-title" id="hero-title">Loading...</h1>
            <div class="hero-meta">
                <span class="score-badge" id="hero-score"></span>
                <span id="hero-year"></span>
                <span id="hero-type"></span>
            </div>
            <p class="hero-desc" id="hero-desc"></p>
            <div class="hero-buttons">
                <button class="btn-primary" id="read-btn">Read Now</button>
                <button class="btn-blur">+ Add to Library</button>
            </div>
        </div>
    </div>
    <button class="library-mode-btn icon-only" id="library-mode-btn" onclick="toggleLibraryMode()" title="Switch library mode">
        <svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
            <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
            <polyline points="9 22 9 12 15 12 15 22"/>
        </svg>
    </button>
</div>
<main id="local-content" class="hidden">
    <section class="section">
        <div class="section-header">
            <div class="section-title">Local Books Library</div>
            <button class="btn-secondary" onclick="scanLocalLibrary()">
                <svg width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
                    <path d="M21 12a9 9 0 1 1-9-9"/><path d="M21 3v6h-6"/>
                </svg>
                <span id="scan-text">Scan Library</span>
            </button>
        </div>
        <div class="local-filters">
            <div class="filter-group">
                <button class="filter-btn active" data-filter="all">All</button>
                <button class="filter-btn" data-filter="unlinked">Unlinked</button>
            </div>
            <div class="filter-group">
                <button class="filter-btn" data-sort="az">A–Z</button>
            </div>
        </div>
        <div class="local-library-grid" id="local-entries-grid">
            <div class="skeleton-card"></div>
            <div class="skeleton-card"></div>
        </div>
    </section>
</main>
<main id="online-content">
    <section class="section">
        <div class="section-header">
            <div class="section-title">Continue Reading</div>
        </div>
        <div class="carousel-wrapper">
            <button class="scroll-btn left" onclick="scrollCarousel('my-status-books', -1)">‹</button>
            <div class="carousel" id="my-status-books"></div>
            <button class="scroll-btn right" onclick="scrollCarousel('my-status-books', 1)">›</button>
        </div>
    </section>

    <section class="section">
        <div class="section-header"><div class="section-title">Trending Books</div></div>
        <div class="carousel-wrapper">
            <button class="scroll-btn left" onclick="scrollCarousel('trending', -1)">‹</button>
            <div class="carousel" id="trending"></div>
            <button class="scroll-btn right" onclick="scrollCarousel('trending', 1)">›</button>
        </div>
    </section>

    <section class="section">
        <div class="section-header"><div class="section-title">All Time Popular</div></div>
        <div class="carousel-wrapper">
            <button class="scroll-btn left" onclick="scrollCarousel('popular', -1)">‹</button>
            <div class="carousel" id="popular"></div>
            <button class="scroll-btn right" onclick="scrollCarousel('popular', 1)">›</button>
        </div>
    </section>
</main>

<div id="updateToast" class="hidden">
    <p>Update available: <span id="latestVersionDisplay">v1.x</span></p>

    <a
            id="downloadButton"
            href="https://git.waifuboard.app/ItsSkaiya/WaifuBoard/releases"
            target="_blank"
    >
        Click To Download
    </a>
</div>

<script src="/src/scripts/utils/auth-utils.js"></script>
<script src="/src/scripts/utils/notification-utils.js"></script>
<script src="/src/scripts/utils/search-manager.js"></script>
<script src="/src/scripts/utils/list-modal-manager.js"></script>
<script src="/src/scripts/utils/continue-watching-manager.js"></script>
<script src="/src/scripts/books/books.js"></script>
<script src="/src/scripts/local-library-books.js"></script>
<script src="/src/scripts/updateNotifier.js"></script>
<script src="/src/scripts/auth-guard.js"></script>
</body>
</html>