@extends('frontend.master')
@section('page_title', $currentPolicy->title . ' | KYAMC Journal')

@section('frontend_content')

    <!-- Inner Page Header -->
    <section class="inner-page-header py-4 mb-4" style="background-color: var(--theme-primary);">
        <div class="container">
            <h2 class="fw-semibold text-white mb-0">{{ $currentPolicy->title }}</h2>
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb mt-2 mb-0">
                    <li class="breadcrumb-item"><a href="{{ route('home') }}"
                            class="text-white-50 text-decoration-none">Home</a></li>
                    <li class="breadcrumb-item"><span class="text-white-50">Ethics and Policies</span></li>
                    <li class="breadcrumb-item active text-white" aria-current="page">{{ $currentPolicy->title }}</li>
                </ol>
            </nav>
        </div>
    </section>

    <!-- Main Content Area -->
    <main class="container my-5 flex-grow-1">
        <div class="row gx-5">

            <!-- Left Column: Main Rich Text Content -->
            <div class="col-lg-8 mb-5">
                <div class="content-wrapper bg-white p-4 p-md-5 rounded-3 shadow-sm border border-light">

                    <!-- Dynamic CKEditor Content -->
                    <div class="text-muted lh-lg ck-content">
                        {!! $currentPolicy->description !!}
                    </div>

                </div>
            </div>

            <!-- Right Column: Sidebar Navigation -->
            <div class="col-lg-4">

                <!-- Sidebar Menu -->
                <div class="card border-0 shadow-sm rounded-3 mb-4 sticky-sidebar">
                    <div class="card-header text-white py-3 fw-medium" style="background-color: var(--theme-primary);">
                        In This Section
                    </div>
                    <div class="list-group list-group-flush sidebar-nav">

                        <!-- Dynamically loop through all active policies -->
                        @foreach($allPolicies as $policy)
                            <a href="{{ route('policies.show', $policy->id) }}"
                                class="list-group-item list-group-item-action py-3 {{ $currentPolicy->id == $policy->id ? 'active-sidebar-link fw-bold text-dark' : 'text-muted' }}">
                                <i
                                    class="me-2 {{ $currentPolicy->id == $policy->id ? 'text-theme-primary' : 'text-muted' }}">&rarr;</i>
                                {{ $policy->title }}
                            </a>
                        @endforeach

                    </div>
                </div>

                <!-- Helper Card -->
                <div class="card border-0 shadow-sm rounded-3 bg-light">
                    <div class="card-body p-4 text-center">
                        <h5 class="fw-semibold text-dark mb-2">Need Help?</h5>
                        <p class="text-muted small mb-3">If you have specific questions about our policies, contact support.
                        </p>
                        <a href="mailto:editor@kyamc.edu.bd" class="btn btn-outline-theme w-100 fw-medium">Contact Editorial
                            Office</a>
                    </div>
                </div>
            </div>

        </div>
    </main>

@endsection