<!DOCTYPE html>
<html lang="en" data-bs-theme="light" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title th:text="${project.name} + ' | Project Details'">Project</title>

    <link th:href="@{/assets/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css}" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/assets/css/project.css}">
</head>

<body>

    <div th:replace="~{fragments/navbar :: navbar}"></div>

    <header class="hero">
        <div class="container">
            <div class="row align-items-center">
                <div class="col-lg-7">
                    <span class="project-badge">Project Case Study</span>
                    <h1 class="display-4 fw-bold mt-2" th:text="${project.name}">Project Name</h1>
                    <p class="lead text-muted" th:text="${project.description}">Short description.</p>

                    <div class="d-flex gap-3 mt-4">
                        <a th:href="${project.githubUrl}" target="_blank" class="btn btn-dark px-4 py-2 rounded-pill">
                            <i class="bi bi-git me-2"></i> Gitea
                        </a>
                        <a th:if="${project.liveUrl != null}" th:href="${project.liveUrl}" target="_blank"
                            class="btn btn-outline-primary px-4 py-2 rounded-pill">
                            <i class="bi bi-globe me-2"></i> Live Demo
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </header>

    <section class="py-4" th:if="${project.screenshots != null && !project.screenshots.isEmpty()}">
        <div class="container">
            <div class="browser-frame">
                <div class="browser-bar">
                    <div class="dot"></div>
                    <div class="dot"></div>
                    <div class="dot"></div>
                </div>
                <div id="projectCarousel" class="carousel slide" data-bs-ride="carousel">
                    <div class="carousel-inner">
                        <div th:each="img, stat : ${project.screenshots}"
                            th:class="'carousel-item ' + (${stat.index} == 0 ? 'active' : '')">
                            <img th:src="${img}" class="d-block w-100" alt="Screenshot">
                        </div>
                    </div>
                    <button class="carousel-control-prev" type="button" data-bs-target="#projectCarousel"
                        data-bs-slide="prev">
                        <span class="carousel-control-prev-icon"></span>
                    </button>
                    <button class="carousel-control-next" type="button" data-bs-target="#projectCarousel"
                        data-bs-slide="next">
                        <span class="carousel-control-next-icon"></span>
                    </button>
                </div>
            </div>
        </div>
    </section>

    <section class="py-5" id="project-overview">
        <div class="container">
            <ul class="nav nav-pills mb-4 gap-2 justify-content-center" id="projectTab" role="tablist">
                <li class="nav-item" role="presentation">
                    <button class="nav-link active" id="overview-tab" data-bs-toggle="pill" data-bs-target="#overview"
                        type="button" role="tab">Overview</button>
                </li>
                <li class="nav-item" role="presentation">
                    <button class="nav-link" id="stack-tab" data-bs-toggle="pill" data-bs-target="#stack" type="button"
                        role="tab">Tech Stack</button>
                </li>
                <li class="nav-item" role="presentation" th:if="${project.documentationHtml != null}">
                    <button class="nav-link" id="docs-tab" data-bs-toggle="pill" data-bs-target="#docs" type="button"
                        role="tab">Documentation</button>
                </li>
                <li class="nav-item" role="presentation" th:if="${project.futureHtml != null}">
                    <button class="nav-link" id="future-tab" data-bs-toggle="pill" data-bs-target="#future"
                        type="button" role="tab">Future Plans</button>
                </li>
            </ul>

            <div class="tab-content dynamic-container" id="projectTabContent">
                <div class="tab-pane fade show active" id="overview" role="tabpanel" aria-labelledby="overview-tab">
                    <h3 class="fw-bold mb-4">Project Overview</h3>
                    <div class="lh-lg" th:utext="${project.overviewHtml}"></div>
                </div>

                <div class="tab-pane fade" id="stack" role="tabpanel" aria-labelledby="stack-tab">
                    <h3 class="fw-bold mb-4">Technology Stack</h3>
                    <div class="stack-content" th:utext="${project.stackHtml}"></div>
                </div>

                <div class="tab-pane fade" id="docs" role="tabpanel" aria-labelledby="docs-tab"
                    th:if="${project.documentationHtml != null}">
                    <h3 class="fw-bold mb-4">Technical Documentation</h3>
                    <div class="lh-lg" th:utext="${project.documentationHtml}"></div>
                </div>

                <div class="tab-pane fade" id="future" role="tabpanel" aria-labelledby="future-tab"
                    th:if="${project.futureHtml != null}">
                    <h3 class="fw-bold mb-4">The Roadmap</h3>
                    <div class="lh-lg" th:utext="${project.futureHtml}"></div>
                </div>
            </div>
        </div>
    </section>

    <section id="demo-vid" class="bg-dark py-5 text-white">
        <div class="container text-center">
            <h2 class="fw-bold mb-5"><i class="bi bi-play-btn me-2"></i>Video Demonstration</h2>
            <div class="row justify-content-center">
                <div class="col-lg-10">
                    <div class="ratio ratio-16x9 rounded-4 shadow-lg overflow-hidden bg-secondary">
                        <div class="d-flex align-items-center justify-content-center h-100">
                            <div class="text-center">
                                <i class="bi bi-camera-video display-1 opacity-25"></i>
                                <p class="mt-3">Walkthrough Video Coming Soon</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <div th:replace="~{fragments/footer :: footer}"></div>
    <script th:src="@{/assets/js/bootstrap.bundle.min.js}"></script>
</body>

</html>