Your IP : 216.73.216.79


Current Path : /var/www/html/reddsis/database/seeders/redd-plus/
Upload File :
Current File : /var/www/html/reddsis/database/seeders/redd-plus/ReddPlusPageSeeder.php

<?php

namespace Database\Seeders\ReddPlus;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ReddPlusPageSeeder extends Seeder
{
    public function run(): void
    {
        $siteId = DB::table('frontend_sites')->where('slug', 'redd-plus')->value('id');
        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'home'], [
            'name' => 'Home',
            'slug' => 'home',
            'site_fk' => $siteId,
            'layout' => null,
            'entry_script' => null,
            'page_content' => '<style>
/* ---------- Hero ---------- */
.hero{
  background:url(\'/assets/redd-plus/hero_bg.png\') center/cover no-repeat;
  min-height:100vh;
  display:flex;align-items:center;
  position:relative;
}
@media (min-height: 900px) {
  .hero { min-height: 85vh; }
}
.hero h1{
  color:var(--green-900);
  font-weight:600;
  font-size:clamp(2.2rem,4.5vw,3.4rem);
  line-height:1.15;
}
.gold-rule{
  width:56px;height:3px;background:var(--gold);
  border:0;opacity:1;margin:1.25rem 0;
}
.hero p{max-width:420px;font-weight:500;}
.btn-forest{
  background:var(--green-800);color:#fff;
  border-radius:50rem;padding:.65rem 1.6rem;font-weight:600;
}
.btn-forest:hover{background:var(--green-900);color:#fff;}
.btn-outline-cream{
  border:1px solid rgba(46,74,53,.55);color:var(--green-900);
  background:rgba(247,245,238,.55);
  border-radius:50rem;padding:.65rem 1.6rem;font-weight:600;
}
.btn-outline-cream:hover{background:var(--cream);color:var(--green-900);}
.glass-card{
  background:rgba(30,45,32,.45);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  border:1px solid rgba(255,255,255,.18);
  border-radius:1rem;
  color:#fff;
  padding:1rem 1.25rem;
  display:flex;align-items:center;gap:1rem;
  max-width:340px;
  text-decoration:none;
  transition:transform .2s ease, background .2s ease;
}
.glass-card:hover{transform:translateX(4px);background:rgba(30,45,32,.6);color:#fff;}
.glass-icon{
  width:52px;height:52px;flex:0 0 52px;
  border:1px solid rgba(255,255,255,.5);border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:1.35rem;color:#eaf2e6;
}
.glass-card h6{margin:0;font-weight:700;color:#fff;}
.glass-card small{color:#dfe8da;font-weight:500;}
.glass-card .bi-arrow-right{margin-left:auto;color:#eaf2e6;}

/* ---------- Quick access ---------- */
.section-eyebrow{
  letter-spacing:.25em;
  font-weight:700;color:var(--green-900);
  font-size:.9rem;text-transform:uppercase;
  display:flex;align-items:center;gap:1rem;justify-content:center;
}
.section-eyebrow::before,.section-eyebrow::after{
  content:\"\";width:60px;height:1px;background:var(--gold);
}
.qa-card{
  background:#fff;border:0;border-radius:.75rem;
  box-shadow:0 8px 24px rgba(46,74,53,.06);
  text-align:center;padding:2rem 1rem 1.5rem;height:100%;
  transition:transform .2s ease, box-shadow .2s ease;
}
.qa-card:hover{transform:translateY(-4px);box-shadow:0 14px 30px rgba(46,74,53,.12);}
.qa-icon{
  width:76px;height:76px;margin:0 auto 1rem;
  background:var(--green-100);
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:1.9rem;color:var(--green-800);
}
.qa-card h6{font-weight:700;color:var(--green-900);}
.qa-card::after{
  content:\"\";display:block;width:42px;height:3px;
  background:var(--gold);margin:1rem auto 0;border-radius:2px;
}

/* ---------- Journey ---------- */
.journey{background:var(--olive-bg);}
.journey h2{color:var(--green-900);font-weight:600;}
.link-learn{
  color:var(--green-900);font-weight:700;text-decoration:none;
}
.link-learn:hover{color:var(--gold);}
.timeline{
  display:flex;align-items:flex-start;justify-content:space-between;
  position:relative;gap:.5rem;
}
.timeline::before{
  content:\"\";position:absolute;top:38px;left:6%;right:2%;
  border-top:2px dotted var(--gold);
}
.timeline::after{
  content:\"\\F138\";
  font-family:\"bootstrap-icons\";
  position:absolute;top:26px;right:-6px;color:var(--gold);font-size:1.2rem;
}
.t-step{position:relative;z-index:1;text-align:center;flex:1;min-width:110px;}
.t-icon{
  width:76px;height:76px;margin:0 auto .75rem;
  background:var(--cream);
  border:1px solid var(--green-200);
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:1.6rem;color:var(--green-800);
  box-shadow:0 4px 12px rgba(46,74,53,.08);
}
.t-step h6{color:var(--green-800);font-weight:700;font-size:.95rem;}
.t-step small{color:#6c7a6e;font-weight:500;line-height:1.3;display:block;max-width:150px;margin:0 auto;}



@media (max-width: 991.98px){
  .timeline{flex-wrap:wrap;row-gap:1.5rem;}
  .timeline::before,.timeline::after{display:none;}
  .t-step{flex:1 1 45%;}
  .stat-divider{border-left:0;border-top:1px solid rgba(60,80,60,.35);padding-top:1.5rem;}
}
@media (prefers-reduced-motion: reduce){
  *{transition:none!important;}
}
</style>

<!-- ===== Hero ===== -->
<header class=\"hero\">
  <div class=\"container py-5\">
    <div class=\"row align-items-center gy-4\">
      <div class=\"col-lg-6\">
        <h1 class=\"font-display\">Sustainable Forests,<br>Resilient Future.</h1>
        <hr class=\"gold-rule\">
        <p>Malaysia is committed to conserving our natural heritage and advancing climate action through REDD+. Together, we protect our forests for people, biodiversity and future generations.</p>
        <div class=\"d-flex flex-wrap gap-3 mt-4\">
          <a href=\"/redd-plus/article?id=about-redd-plus\" class=\"btn btn-forest\">Explore REDD+ <i class=\"bi bi-arrow-right ms-1\"></i></a>
          <a href=\"/redd-plus/article?id=about-redd-plus\" class=\"btn btn-outline-cream\">Learn More <i class=\"bi bi-arrow-right ms-1\"></i></a>
        </div>
      </div>
      <div class=\"col-lg-6 d-flex flex-column align-items-lg-end gap-3\">
        <a href=\"/redd-plus/article?id=stakeholder-engagement\" class=\"glass-card w-100\">
          <span class=\"glass-icon\"><i class=\"bi bi-people-fill\"></i></span>
          <span>
            <h6>Stakeholders</h6>
            <small>Collaborating for sustainable impact.</small>
          </span>
          <i class=\"bi bi-arrow-right\"></i>
        </a>
        <a href=\"/redd-plus/article?id=related-policies\" class=\"glass-card w-100\">
          <span class=\"glass-icon\"><i class=\"bi bi-flower1\"></i></span>
          <span>
            <h6>Initiatives</h6>
            <small>Driving actions for resilient forests.</small>
          </span>
          <i class=\"bi bi-arrow-right\"></i>
        </a>
      </div>
    </div>
  </div>
</header>

<!-- ===== Quick Access ===== -->
<section class=\"py-5 bg-white\">
  <div class=\"container py-3\">
    <p class=\"section-eyebrow mb-5\">Quick Access</p>
    <div class=\"row g-4\">
      <div class=\"col-6 col-lg-3\">
        <a href=\"/redd-plus/article?id=national-redd-strategy\" class=\"text-decoration-none d-block h-100\">
          <div class=\"qa-card\">
            <div class=\"qa-icon\"><i class=\"bi bi-tree-fill\"></i></div>
            <h6>National<br>REDD+ Strategy</h6>
          </div>
        </a>
      </div>
      <div class=\"col-6 col-lg-3\">
        <a href=\"/redd-plus/article?id=related-policies\" class=\"text-decoration-none d-block h-100\">
          <div class=\"qa-card\">
            <div class=\"qa-icon\"><i class=\"bi bi-cash-coin\"></i></div>
            <h6>Malaysia<br>Forest Fund</h6>
          </div>
        </a>
      </div>
      <div class=\"col-6 col-lg-3\">
        <a href=\"/redd-plus/article?id=mrv-framework\" class=\"text-decoration-none d-block h-100\">
          <div class=\"qa-card\">
            <div class=\"qa-icon\"><i class=\"bi bi-clipboard-data\"></i></div>
            <h6>MRV<br>Framework</h6>
          </div>
        </a>
      </div>
      <div class=\"col-6 col-lg-3\">
        <a href=\"/redd-plus/article?id=governance\" class=\"text-decoration-none d-block h-100\">
          <div class=\"qa-card\">
            <div class=\"qa-icon\"><i class=\"bi bi-shield-check\"></i></div>
            <h6>Governance</h6>
          </div>
        </a>
      </div>
    </div>
  </div>
</section>

<!-- ===== REDD+ Journey ===== -->
<section class=\"journey py-5\">
  <div class=\"container py-3\">
    <div class=\"row align-items-center gy-5\">
      <div class=\"col-lg-4\">
        <h2 class=\"font-display\">Malaysia&rsquo;s REDD+ Journey</h2>
        <hr class=\"gold-rule\">
        <p class=\"fw-medium\">From national strategy to results-based actions, Malaysia&rsquo;s REDD+ journey is built on strong policies, robust safeguards, transparent monitoring and meaningful impact for people, forests and climate.</p>
        <a href=\"/redd-plus/article?id=redd-implementation\" class=\"link-learn\">Learn More <i class=\"bi bi-arrow-right ms-1\"></i></a>
      </div>
      <div class=\"col-lg-8\">
        <div class=\"timeline\">
          <div class=\"t-step\">
            <div class=\"t-icon\"><i class=\"bi bi-flower1\"></i></div>
            <h6>Strategy</h6>
            <small>Setting the direction for sustainable forest management</small>
          </div>
          <div class=\"t-step\">
            <div class=\"t-icon\"><i class=\"bi bi-display\"></i></div>
            <h6>Monitoring</h6>
            <small>Measuring and verifying forest carbon with integrity</small>
          </div>
          <div class=\"t-step\">
            <div class=\"t-icon\"><i class=\"bi bi-people-fill\"></i></div>
            <h6>Implementation</h6>
            <small>Driving actions with communities and partners</small>
          </div>
          <div class=\"t-step\">
            <div class=\"t-icon\"><i class=\"bi bi-award\"></i></div>
            <h6>Results</h6>
            <small>Delivering verified impact for climate and people</small>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>


',
            'use_custom_layout' => 0,
            'is_default' => 1,
            'status' => 1,
            'sort_order' => 1,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'article'], [
            'name' => 'Article',
            'slug' => 'article',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>',
            'entry_script' => null,
            'page_content' => '@php
    use App\\Models\\Backend\\ContentArticle;
    use App\\Models\\Backend\\Ref;

    $code = request()->query(\'id\');
    $detailArticle = $code ? ContentArticle::with(\'translations\')
        ->where(\'article_code\', $code)
        ->where(\'article_status\', \'ACTIVE\')
        ->first() : null;
@endphp

@if($detailArticle)
    @php
        $t = $detailArticle->translations->first();
        $title = $t?->article_translation_title ?? \'Untitled\';
        $content = $t?->article_translation_content ?? \'\';
        $catDescr = Ref::where(\'cat\', \'ARTICLE_CAT\')->where(\'code\', $detailArticle->article_category)->value(\'descr\') ?? $detailArticle->article_category;
        $date = $detailArticle->article_date ? \\Carbon\\Carbon::parse($detailArticle->article_date)->format(\'d M Y\') : \'\';
        $isFullWidth = true;
    @endphp

    
<style>
.hero-article {
  background: url(\"/assets/redd-plus/about_hero_bg.png\") center/cover no-repeat;
  min-height: 280px;
  display: flex;
  align-items: center;
}
.breadcrumb-redd { font-size: .8rem; font-weight: 600; }
.breadcrumb-redd a { color: #6c7a6e; text-decoration: none; }
.breadcrumb-redd a:hover { color: var(--green-800); }
.breadcrumb-redd .active { color: var(--green-800); }
.breadcrumb-redd .sep { color: #a9b3a9; margin: 0 .4rem; }
.hero-article h1 {
  color: var(--green-900); font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.9rem);
}
.hero-article p { max-width: 480px; font-weight: 500; font-size: 1.05rem; }

.row-block { padding: 2.5rem 0; }
.row-block + .row-block { border-top: 1px solid #e8e4d8; }
.block-heading { color: var(--green-800); font-weight: 700; font-size: 1.35rem; }
.lead-icon {
  width: 84px; height: 84px; background: var(--green-100);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; color: var(--green-800);
}
.lead-icon.gold { background: var(--gold-100); color: var(--gold); }
.lead-icon.small { width: 56px; height: 56px; font-size: 1.4rem; }
.link-learn {
  color: var(--green-900); font-weight: 700; text-decoration: none;
  border-bottom: 2px solid var(--gold); padding-bottom: .15rem;
}
.link-learn:hover { color: var(--gold); }
.info-card {
  background: var(--card-bg,#fff); border: 1px solid #d8d4c8;
  border-radius: .75rem; text-align: center;
  padding: 1.25rem .9rem; height: 100%;
  box-shadow: 0 2px 8px rgba(46,74,53,.06);
  transition: transform .2s ease, box-shadow .2s ease;
}
.info-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(46,74,53,.12); }
.info-icon {
  width: 72px; height: 72px; margin: 0 auto .9rem;
  background: #fff; border: 1px solid var(--green-200); border-radius: 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: var(--green-700);
}
.info-card p { margin: 0; font-weight: 600; color: var(--ink); font-size: .85rem; line-height: 1.35; }
</style>
    @if($isFullWidth)
        {!! \\Illuminate\\Support\\Facades\\Blade::render($content, [\'siteSlug\' => $siteSlug ?? \'redd-plus\']) !!}
    @else
    <style>
    .article-detail { padding: 60px 0 80px; background: var(--cream); min-height: 60vh; }
    .article-breadcrumb { font-size: .82rem; color: #8a9a8e; margin-bottom: 30px; display: flex; align-items: center; gap: 8px; }
    .article-breadcrumb a { color: var(--green-800); text-decoration: none; }
    .article-breadcrumb a:hover { color: var(--gold); }
    .article-breadcrumb .sep { color: #cfc9b8; }
    .article-detail-content { max-width: 800px; margin: 0 auto; }
    .article-meta { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
    .article-meta .cat { background: var(--green-100); color: var(--green-800); padding: 6px 14px; border-radius: 50rem; font-size: .75rem; font-weight: 600; }
    .article-meta .date { color: #8a9a8e; font-size: .8rem; }
    .article-detail-title { font-size: 2rem; font-weight: 700; color: var(--green-900); line-height: 1.3; margin: 0 0 30px; }
    .article-body { color: var(--ink); font-size: 1.05rem; line-height: 1.9; }
    .article-body p { margin-bottom: 1.2rem; }
    .btn-back { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; background: var(--green-800); color: #fff; border-radius: 10px; font-size: .85rem; font-weight: 500; text-decoration: none; transition: all .25s; margin-top: 40px; }
    .btn-back:hover { background: var(--green-900); color: #fff; transform: translateX(-3px); }
    </style>

    <section class=\"article-detail\">
        <div class=\"container\">
            <div class=\"article-breadcrumb\">
                <a href=\"/{{ $siteSlug }}\">Home</a>
                <span class=\"sep\">/</span>
                <a href=\"/{{ $siteSlug }}/article\">Articles</a>
                <span class=\"sep\">/</span>
                <span>{{ $title }}</span>
            </div>

            <div class=\"article-detail-content\">
                <div class=\"article-meta\">
                    <span class=\"cat\">{{ $catDescr }}</span>
                    @if($date)
                        <span class=\"date\"><i class=\"bi bi-calendar3 me-1\"></i>{{ $date }}</span>
                    @endif
                </div>

                <h1 class=\"article-detail-title\">{{ $title }}</h1>

                <div class=\"article-body\">{!! $content !!}</div>

                <a href=\"/{{ $siteSlug }}/article\" class=\"btn-back\"><i class=\"bi bi-arrow-left\"></i> Back to Articles</a>
            </div>
        </div>
    </section>
    @endif

    <style>
    .footer-redd-article {
      background: url(\'/assets/redd-plus/faq_footer_bg.png\') center bottom/cover no-repeat;
      padding: 4rem 0 2.5rem;
    }
    .footer-redd-article a {
      color: var(--ink); text-decoration: none; font-weight: 600; font-size: .85rem;
    }
    .footer-redd-article a:hover { color: var(--green-800); }
    .footer-redd-article .bi { color: var(--green-800); font-size: 1.1rem; }
    .footer-redd-article .f-divider { width: 1px; height: 26px; background: #cfc9b8; }
    </style>
    <footer class=\"footer-redd-article mt-4\">
      <div class=\"container\">
        <div class=\"d-flex flex-wrap align-items-center justify-content-center gap-4\">
          <img src=\"/assets/redd-plus/logo.png\" alt=\"REDD+ Malaysia\" height=\"46\">
          <span class=\"f-divider d-none d-md-inline-block\"></span>
          <a href=\"https://redd.nres.gov.my\"><i class=\"bi bi-globe2\"></i> redd.nres.gov.my</a>
          <span class=\"f-divider d-none d-md-inline-block\"></span>
          <a href=\"mailto:redd@nres.gov.my\"><i class=\"bi bi-envelope\"></i> redd@nres.gov.my</a>
          <span class=\"f-divider d-none d-md-inline-block\"></span>
          <a href=\"tel:+60380008000\"><i class=\"bi bi-telephone\"></i> +603 8000 8000</a>
        </div>
      </div>
    </footer>

@else
@php
    $articles = ContentArticle::with(\'translations\')
        ->where(\'article_portal_category\', \'redd-plus\')
        ->where(\'article_status\', \'ACTIVE\')
        ->orderBy(\'article_sorting\')
        ->orderBy(\'article_date\', \'desc\')
        ->get();

    $categories = $articles->pluck(\'article_category\')->unique()->values()->toArray();

    $catLabels = Ref::where(\'cat\', \'ARTICLE_CAT\')
        ->whereIn(\'code\', $categories)
        ->pluck(\'descr\', \'code\')
        ->toArray();
@endphp

<style>
.article-hero {
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-900) 100%);
  padding: 4rem 0 4.5rem;
  color: #fff;
}
.article-hero h1 {
  font-weight: 700;
  font-size: clamp(2.3rem, 4.5vw, 3.2rem);
  line-height: 1.15;
}
.article-hero p {
  font-size: 1.1rem;
  font-weight: 500;
  max-width: 400px;
  opacity: .85;
}

.article-card {
  background: #fff;
  border: 1px solid #e8e4d8;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(46,74,53,.05);
  transition: all .2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(46,74,53,.12);
  border-color: var(--green-200);
}
.article-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.article-card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}
.article-card-cat {
  display: inline-block;
  background: var(--green-100);
  color: var(--green-800);
  padding: .25rem .75rem;
  border-radius: 50rem;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: .75rem;
}
.article-card-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--green-900);
  margin-bottom: .5rem;
  line-height: 1.4;
}
.article-card-date {
  font-size: .82rem;
  color: #8a9a8e;
  font-weight: 500;
}
.article-card-excerpt {
  font-size: .9rem;
  color: var(--ink);
  line-height: 1.6;
  margin-top: .5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-cat-pills .cat-pill {
  border: 1px solid #e2ddd0;
  background: #fff;
  color: var(--green-800);
  border-radius: .6rem;
  padding: .55rem 1.4rem;
  font-weight: 600;
  font-size: .92rem;
  transition: all .15s ease;
  cursor: pointer;
}
.article-cat-pills .cat-pill:hover {
  border-color: var(--green-800);
  color: var(--green-900);
}
.article-cat-pills .cat-pill.active {
  background: var(--green-800);
  border-color: var(--green-800);
  color: #fff;
  box-shadow: 0 6px 14px rgba(46,74,53,.25);
}

.no-articles {
  text-align: center;
  padding: 4rem 2rem;
  color: #8a9a8e;
}
.no-articles i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  color: var(--green-200);
}
</style>

<header class=\"article-hero\">
  <div class=\"container\">
    <h1>Articles &amp; News</h1>
    <p class=\"mt-3\">Latest updates, publications and news from REDD+ Malaysia.</p>
  </div>
</header>

<main class=\"container py-5\" style=\"max-width:1100px;\">

  <div class=\"d-flex flex-wrap gap-2 mb-4 article-cat-pills\" role=\"tablist\">
    <button class=\"cat-pill active\" data-cat=\"all\">All</button>
    @foreach($categories as $cat)
      <button class=\"cat-pill\" data-cat=\"{{ $cat }}\">
        {{ $catLabels[$cat] ?? $cat }}
      </button>
    @endforeach
  </div>

  @if($articles->count())
  <div class=\"row g-4\" id=\"articleGrid\">
    @foreach($articles as $item)
      @php
        $t = $item->translations->first();
        $itemTitle = $t?->article_translation_title ?? \'Untitled\';
        $excerpt = strip_tags($t?->article_translation_content ?? \'\');
        $excerpt = \\Illuminate\\Support\\Str::limit($excerpt, 150);
        $itemCatLabel = $catLabels[$item->article_category] ?? $item->article_category;
        $itemDate = $item->article_date ? \\Carbon\\Carbon::parse($item->article_date)->format(\'d M Y\') : \'\';
      @endphp
      <div class=\"col-md-6 col-lg-4 article-item\" data-cat=\"{{ $item->article_category }}\">
        <a href=\"/{{ $siteSlug }}/article?id={{ $item->article_code }}\" class=\"article-card\">
          @if($item->article_image)
            <img src=\"{{ image_url($item->article_image) }}\" alt=\"{{ $itemTitle }}\" class=\"article-card-img\">
          @else
            <div class=\"article-card-img\" style=\"background:var(--green-100);display:flex;align-items:center;justify-content:center;\">
              <i class=\"bi bi-file-earmark-text\" style=\"font-size:2.5rem;color:var(--green-200);\"></i>
            </div>
          @endif
          <div class=\"article-card-body\">
            <span class=\"article-card-cat\">{{ $itemCatLabel }}</span>
            <h3 class=\"article-card-title\">{{ $itemTitle }}</h3>
            <span class=\"article-card-date\"><i class=\"bi bi-calendar3 me-1\"></i>{{ $itemDate }}</span>
            @if($excerpt)
              <p class=\"article-card-excerpt\">{{ $excerpt }}</p>
            @endif
          </div>
        </a>
      </div>
    @endforeach
  </div>
  @else
    <div class=\"no-articles\">
      <i class=\"bi bi-journal-text\"></i>
      <h4>No articles found</h4>
      <p>Check back later for updates.</p>
    </div>
  @endif
</main>

<script>
const pills = document.querySelectorAll(\'.article-cat-pills .cat-pill\');
const items = document.querySelectorAll(\'.article-item\');

pills.forEach(p => p.addEventListener(\'click\', () => {
  pills.forEach(x => x.classList.remove(\'active\'));
  p.classList.add(\'active\');
  const cat = p.dataset.cat;
  items.forEach(item => {
    item.classList.toggle(\'d-none\', cat !== \'all\' && item.dataset.cat !== cat);
  });
}));
</script>
@endif',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 2,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'contact'], [
            'name' => 'Contact',
            'slug' => 'contact',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>
',
            'entry_script' => null,
            'page_content' => '@php
$success = session(\'success\');
$ticketNo = session(\'ticket_no\');

if (!$success && request()->isMethod(\'POST\')) {
    $data = request()->validate([
        \'name\' => \'required|string|max:255\',
        \'email\' => \'nullable|email|max:255\',
        \'subject\' => \'required|string|max:255\',
        \'feedback\' => \'required|string\',
        \'type\' => \'nullable|string|max:255\',
        \'cat\' => \'nullable|string|max:255\',
    ]);

    $data[\'ticket_no\'] = \\App\\Models\\Backend\\ContentFeedbackMain::generateTicketNo();
    $data[\'status\'] = \'PENDING\';
    $data[\'type\'] = $data[\'type\'] ?: \'INQUIRY\';
    $data[\'cat\'] = $data[\'cat\'] ?: \'OTHERS\';
    $data[\'created_user_type\'] = \'guest\';

    $feedback = \\App\\Models\\Backend\\ContentFeedbackMain::create($data);
    $ticketNo = $feedback->ticket_no;
    $success = true;

    session()->flash(\'success\', true);
    session()->flash(\'ticket_no\', $ticketNo);
}
@endphp

<style>
/* ---------- Page background ---------- */
.contact-page{
  background:
    url(\'/assets/redd-plus/contact_footer_bg.png\') center bottom / 100% auto no-repeat,
    url(\'/assets/redd-plus/contact_hero_bg.png\') center top / 100% auto no-repeat,
    #fff;
  min-height:calc(100vh - 64px);
  display:flex;flex-direction:column;
}
.contact-page > .container{flex:1;}

/* ---------- Left column ---------- */
.contact-title{
  color:var(--green-800);
  font-weight:700;
  font-size:clamp(2.3rem,4.5vw,3.2rem);
}
.contact-sub{font-size:1.15rem;font-weight:500;max-width:320px;}
.info-item{
  display:flex;gap:1.1rem;
  padding:1.4rem 0;
  border-bottom:1px solid #e8e4d8;
  max-width:400px;
}
.info-item:last-child{border-bottom:0;}
.info-icon{
  width:52px;height:52px;flex:0 0 52px;
  background:var(--green-100);
  border:1px solid var(--green-200);
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-size:1.35rem;color:var(--green-800);
}
.info-item h6{color:var(--green-800);font-weight:700;margin-bottom:.35rem;}
.info-item p{margin:0;font-weight:500;font-size:.92rem;line-height:1.55;}

/* ---------- Form card ---------- */
.form-card{
  background:#fdfcf9;
  border:1px solid #ece8db;
  border-radius:1rem;
  box-shadow:0 16px 40px rgba(46,74,53,.10);
  padding:2rem 2rem 2.25rem;
}
.form-card h2{
  color:var(--green-800);font-weight:700;font-size:1.35rem;
}
.form-card .form-control{
  border:1px solid #e2ddd0;
  border-radius:.6rem;
  padding:.8rem 1rem;
  font-size:.92rem;
  font-weight:500;
  color:var(--ink);
  background:#fff;
}
.form-card .form-control::placeholder{color:#9aa59c;}
.form-card .form-control:focus{
  border-color:var(--green-800);
  box-shadow:0 0 0 .2rem rgba(46,74,53,.12);
}
.btn-forest-contact{
  background:var(--green-800);color:#fff;
  border-radius:.6rem;padding:.7rem 1.6rem;font-weight:600;
}
.btn-forest-contact:hover{background:var(--green-900);color:#fff;}

.form-card .invalid-feedback{
  display:block;
  font-size:.8rem;
  color:#a94442;
  margin-top:.25rem;
}
.form-card .is-invalid{
  border-color:#a94442;
}
.form-card .is-invalid:focus{
  border-color:#a94442;
  box-shadow:0 0 0 .2rem rgba(169,68,66,.15);
}

/* ---------- Success message ---------- */
.contact-success{
  text-align:center;
  padding:3rem 1.5rem;
}
.contact-success i{
  font-size:3rem;
  color:var(--green-800);
  margin-bottom:1rem;
}
.contact-success h3{
  color:var(--green-800);
  font-weight:700;
  font-size:1.4rem;
  margin-bottom:.5rem;
}
.contact-success p{
  color:var(--ink);
  margin:0;
}
.contact-success .ticket{
  display:inline-block;
  background:var(--green-100);
  color:var(--green-900);
  padding:.35rem 1rem;
  border-radius:50rem;
  font-weight:700;
  margin-top:.75rem;
}

/* ---------- Footer ---------- */
.footer-contactbar{padding:2rem 0 1.5rem;}
.footer-contactbar a{
  color:var(--ink);text-decoration:none;font-weight:600;font-size:.9rem;
  display:inline-flex;align-items:center;gap:.5rem;
}
.footer-contactbar a:hover{color:var(--green-800);}
.footer-contactbar .bi{color:var(--green-800);font-size:1.1rem;}
.f-divider{width:1px;height:26px;background:#cfc9b8;}

.map-card{
  background:#fff;
  border:1px solid #ece8db;
  border-radius:1rem;
  box-shadow:0 8px 24px rgba(46,74,53,.10);
  padding:2rem;
  text-align:center;
}
.map-card .map-icon{
  width:64px;height:64px;
  background:var(--green-100);
  border:1px solid var(--green-200);
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  margin:0 auto 1rem;
  font-size:1.6rem;color:var(--green-800);
}
.map-card h5{color:var(--green-800);font-weight:700;font-size:1rem;margin-bottom:.35rem;}
.map-card p{margin:0;font-weight:500;font-size:.9rem;color:var(--ink);line-height:1.6;}
.map-card .btn-map{
  margin-top:1rem;
  background:var(--green-800);color:#fff;border:0;
  border-radius:50rem;padding:.55rem 1.8rem;font-weight:600;font-size:.9rem;
  display:inline-flex;align-items:center;gap:.5rem;
  transition:all .2s;
}
.map-card .btn-map:hover{background:var(--green-900);color:#fff;}

@media (max-width: 991.98px){
  .contact-page{background-size:auto 300px, auto 500px;}
}
</style>

<div class=\"contact-page\">
  <div class=\"container py-5\">
    <div class=\"row gy-5\">

      <!-- ===== Left: contact info ===== -->
      <div class=\"col-lg-6\">
        <h1 class=\"contact-title mb-2\">Contact Us</h1>
        <p class=\"contact-sub mb-4\">We welcome your feedback, enquiries and collaboration.</p>

        <div class=\"info-item\">
          <div class=\"info-icon\"><i class=\"bi bi-geo-alt\"></i></div>
          <div>
            <h6>Contact Information</h6>
            <p>REDD+ Malaysia Secretariat<br>
               NRES Complex, Lot 4G2, Precinct 4<br>
               Federal Government Administrative Centre<br>
               62574 Putrajaya, Malaysia</p>
          </div>
        </div>

        <div class=\"info-item\">
          <div class=\"info-icon\"><i class=\"bi bi-envelope\"></i></div>
          <div>
            <h6>Email</h6>
            <p><a href=\"mailto:redd@nres.gov.my\" class=\"text-decoration-none\" style=\"color:var(--ink);\">redd@nres.gov.my</a></p>
          </div>
        </div>

        <div class=\"info-item\">
          <div class=\"info-icon\"><i class=\"bi bi-telephone\"></i></div>
          <div>
            <h6>Phone</h6>
            <p><a href=\"tel:+60380008000\" class=\"text-decoration-none\" style=\"color:var(--ink);\">+603 8000 8000</a></p>
          </div>
        </div>

        <div class=\"info-item\">
          <div class=\"info-icon\"><i class=\"bi bi-clock\"></i></div>
          <div>
            <h6>Office Hours</h6>
            <p>Monday &ndash; Friday<br>8:30 am &ndash; 5:30 pm (GMT+8)</p>
          </div>
        </div>
      </div>

      <!-- ===== Right: form ===== -->
      <div class=\"col-lg-6\">
        <div class=\"form-card\">
          @if($success)
            <div class=\"contact-success\">
              <i class=\"bi bi-check-circle-fill\"></i>
              <h3>Thank You!</h3>
              <p>Your message has been submitted successfully.</p>
              @if($ticketNo)
                <span class=\"ticket\">Ticket No: {{ $ticketNo }}</span>
              @endif
            </div>
          @else
            <h2 class=\"mb-4\">General Inquiry</h2>
            <form method=\"POST\" action=\"{{ request()->url() }}\">
              @csrf
              <input type=\"hidden\" name=\"type\" value=\"INQUIRY\">
              <input type=\"hidden\" name=\"cat\" value=\"OTHERS\">

              <div class=\"mb-3\">
                <label for=\"name\" class=\"visually-hidden\">Your Name</label>
                <input type=\"text\" class=\"form-control @error(\'name\') is-invalid @enderror\" id=\"name\" name=\"name\" value=\"{{ old(\'name\') }}\" placeholder=\"Your Name *\" required>
                @error(\'name\')<span class=\"invalid-feedback\">{{ $message }}</span>@enderror
              </div>

              <div class=\"mb-3\">
                <label for=\"email\" class=\"visually-hidden\">Email Address</label>
                <input type=\"email\" class=\"form-control @error(\'email\') is-invalid @enderror\" id=\"email\" name=\"email\" value=\"{{ old(\'email\') }}\" placeholder=\"Email Address\">
                @error(\'email\')<span class=\"invalid-feedback\">{{ $message }}</span>@enderror
              </div>

              <div class=\"mb-3\">
                <label for=\"subject\" class=\"visually-hidden\">Subject</label>
                <input type=\"text\" class=\"form-control @error(\'subject\') is-invalid @enderror\" id=\"subject\" name=\"subject\" value=\"{{ old(\'subject\') }}\" placeholder=\"Subject *\" required>
                @error(\'subject\')<span class=\"invalid-feedback\">{{ $message }}</span>@enderror
              </div>

              <div class=\"mb-4\">
                <label for=\"feedback\" class=\"visually-hidden\">Your Message</label>
                <textarea class=\"form-control @error(\'feedback\') is-invalid @enderror\" id=\"feedback\" name=\"feedback\" rows=\"6\" placeholder=\"Your Message *\" required>{{ old(\'feedback\') }}</textarea>
                @error(\'feedback\')<span class=\"invalid-feedback\">{{ $message }}</span>@enderror
              </div>

              <button type=\"submit\" class=\"btn btn-forest-contact\">
                Send Message <i class=\"bi bi-arrow-right ms-1\"></i>
              </button>
            </form>
          @endif
        </div>
      </div>

    </div>
  </div>

    <!-- ===== Map ===== -->
  <div class="container pb-4">
    <div class="row justify-content-center">
      <div class="col-md-8 col-lg-6">
        <div class="map-card">
          <div class="map-icon"><i class="bi bi-geo-alt-fill"></i></div>
          <h5>Ministry of Natural Resources &amp; Environmental Sustainability (NRES)</h5>
          <p>Blok F11, Kompleks F, Presint 1<br>
             Pusat Pentadbiran Kerajaan Persekutuan<br>
             62000 Putrajaya, Malaysia</p>
          <a href="https://www.google.com/maps/dir/?api=1&amp;destination=Ministry+of+Natural+Resources+and+Environmental+Sustainability+Blok+F11+Kompleks+F+Presint+1+Putrajaya" target="_blank" rel="noopener" class="btn-map">
            <i class="bi bi-box-arrow-up-right"></i>Buka dalam Google Maps
          </a>
        </div>
      </div>
    </div>
  </div>

  <!-- ===== Footer ===== -->
  <footer class=\"footer-contactbar\">
    <div class=\"container\">
      <div class=\"d-flex flex-wrap align-items-center justify-content-center gap-4\">
        <img src=\"/assets/redd-plus/logo.png\" alt=\"REDD+ Malaysia\" height=\"46\">
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"https://redd.nres.gov.my\"><i class=\"bi bi-globe2\"></i>https://redd.nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"mailto:redd@nres.gov.my\"><i class=\"bi bi-envelope\"></i>redd@nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"tel:+60380008000\"><i class=\"bi bi-telephone\"></i>+603 8000 8000</a>
      </div>
    </div>
  </footer>
</div>
',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 3,
        ]);

        // ──────────────────────────────────────────────
        // Reports, Issues & Incidents
        // ──────────────────────────────────────────────
        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'reports-issues'], [
            'name' => 'Reports, Issues & Incidents',
            'slug' => 'reports-issues',
            'site_fk' => $siteId,
            'layout' => null,
            'entry_script' => null,
            'page_content' => '@php
$success = session(\'success\');
$ticketNo = session(\'ticket_no\');

if (!$success && request()->isMethod(\'POST\')) {
    $data = request()->validate([
        \'name\' => \'required|string|max:255\',
        \'email\' => \'required|email|max:255\',
        \'contact_number\' => \'required|string|max:50\',
        \'subject\' => \'required|string|max:255\',
        \'cat\' => \'required|string|max:255\',
        \'feedback\' => \'required|string\',
        \'data_protection\' => \'required|accepted\',
    ]);

    $data[\'ticket_no\'] = \\App\\Models\\Backend\\ContentFeedbackMain::generateTicketNo();
    $data[\'status\'] = \'PENDING\';
    $data['type'] = 'COMPLAINT';
    // Prepend contact number so it appears in admin panel
    $data[\'feedback\'] = \'Phone: \' . $data[\'contact_number\'] . "\n\n" . $data[\'feedback\'];
    $data[\'created_user_type\'] = \'guest\';

    $feedback = \\App\\Models\\Backend\\ContentFeedbackMain::create($data);
    $ticketNo = $feedback->ticket_no;
    $success = true;

    session()->flash(\'success\', true);
    session()->flash(\'ticket_no\', $ticketNo);
}
@endphp

<style>
.reports-hero{
  background:linear-gradient(135deg,var(--green-900) 0%,var(--green-800) 100%);
  min-height:320px;
  display:flex;align-items:center;
  position:relative;
  overflow:hidden;
}
.reports-hero::after{
  content:\'\';
  position:absolute;
  inset:0;
  background:url(\'/assets/redd-plus/hero_pattern.png\') center/cover no-repeat;
  opacity:.06;
}
.reports-hero .container{position:relative;z-index:1;}
.reports-hero h1{
  color:#fff;font-weight:700;
  font-size:clamp(2rem,4vw,3rem);
  margin-bottom:.5rem;
}
.reports-hero p{
  color:rgba(255,255,255,.8);
  font-size:1.1rem;max-width:640px;
  font-weight:500;
}

.reports-form-section{
  background:
    url(\'/assets/redd-plus/contact_footer_bg.png\') center bottom / 100% auto no-repeat,
    #fff;
  min-height:calc(100vh - 320px - 64px);
  padding:3rem 0;
}

.reports-form-card{
  background:#fdfcf9;
  border:1px solid #ece8db;
  border-radius:1rem;
  box-shadow:0 16px 40px rgba(46,74,53,.10);
  padding:2.5rem 2.5rem 2.75rem;
  max-width:860px;margin:0 auto;
}
.reports-form-card h2{
  color:var(--green-800);font-weight:700;font-size:1.4rem;
  margin-bottom:.35rem;
}
.reports-form-card .form-label{
  font-weight:600;font-size:.9rem;color:var(--ink);margin-bottom:.35rem;
}
.reports-form-card .form-control,.reports-form-card .form-select{
  border:1px solid #e2ddd0;
  border-radius:.6rem;
  padding:.75rem 1rem;
  font-size:.92rem;
  font-weight:500;
  color:var(--ink);
  background:#fff;
}
.reports-form-card .form-control::placeholder{color:#9aa59c;}
.reports-form-card .form-control:focus,.reports-form-card .form-select:focus{
  border-color:var(--green-800);
  box-shadow:0 0 0 .2rem rgba(46,74,53,.12);
}
.reports-form-card .invalid-feedback{
  display:block;
  font-size:.8rem;
  color:#a94442;
  margin-top:.2rem;
}
.reports-form-card .is-invalid{border-color:#a94442;}
.btn-reports{
  background:var(--green-800);color:#fff;
  border-radius:.6rem;padding:.7rem 2rem;font-weight:600;border:0;
  transition:all .2s;
}
.btn-reports:hover{background:var(--green-900);color:#fff;}
.btn-reports i{font-size:1rem;}

.form-check-input:checked{background-color:var(--green-800);border-color:var(--green-800);}
.form-check-input:focus{border-color:var(--green-800);box-shadow:0 0 0 .2rem rgba(46,74,53,.12);}

.reports-success{
  text-align:center;padding:3rem 1.5rem;
}
.reports-success i{
  font-size:3rem;color:var(--green-800);margin-bottom:1rem;
}
.reports-success h3{
  color:var(--green-800);font-weight:700;font-size:1.4rem;margin-bottom:.5rem;
}
.reports-success p{color:var(--ink);margin:0;}
.reports-success .ticket{
  display:inline-block;
  background:var(--green-100);
  color:var(--green-900);
  padding:.35rem 1rem;
  border-radius:50rem;
  font-weight:700;
  margin-top:.75rem;
}

.footer-redd-article{
  padding:2rem 0 1.5rem;
  background:var(--cream);
}
.footer-redd-article a{
  color:var(--ink);text-decoration:none;font-weight:600;font-size:.9rem;
  display:inline-flex;align-items:center;gap:.5rem;
}
.footer-redd-article a:hover{color:var(--green-800);}
.footer-redd-article .bi{color:var(--green-800);font-size:1.1rem;}
.footer-redd-article .f-divider{width:1px;height:26px;background:#cfc9b8;}
</style>

<div class="reports-hero">
  <div class="container py-5">
    <h1>Reports, Issues &amp; Incidents</h1>
    <p>Submit reports, raise issues or report incidents related to REDD+ safeguards implementation in Malaysia. Your submissions help us improve transparency and accountability.</p>
  </div>
</div>

<div class="reports-form-section">
  <div class="container">
    <div class="reports-form-card">
      @if($success)
        <div class="reports-success">
          <i class="bi bi-check-circle-fill"></i>
          <h3>Thank You!</h3>
          <p>Your report has been submitted successfully. We will review and follow up accordingly.</p>
          @if($ticketNo)
            <span class="ticket">Ticket No: {{ $ticketNo }}</span>
          @endif
        </div>
      @else
        <h2>Submit a Report</h2>
        <p class="text-muted mb-4" style="font-weight:500;font-size:.92rem;">Fill in the form below to report an issue, incident or provide feedback related to REDD+ safeguards.</p>

        <form method="POST" action="{{ request()->url() }}">
          @csrf
          <input type="hidden" name="type" value="REPORT">

          <div class="row g-3">
            <div class="col-md-6">
              <label for="name" class="form-label">Full Name <span class="text-danger">*</span></label>
              <input type="text" class="form-control @error(\'name\') is-invalid @enderror" id="name" name="name" value="{{ old(\'name\') }}" placeholder="Your full name" required>
              @error(\'name\')<span class="invalid-feedback">{{ $message }}</span>@enderror
            </div>

            <div class="col-md-6">
              <label for="email" class="form-label">Email <span class="text-danger">*</span></label>
              <input type="email" class="form-control @error(\'email\') is-invalid @enderror" id="email" name="email" value="{{ old(\'email\') }}" placeholder="Your email address" required>
              @error(\'email\')<span class="invalid-feedback">{{ $message }}</span>@enderror
            </div>

            <div class="col-md-6">
              <label for="contact_number" class="form-label">Contact Number <span class="text-danger">*</span></label>
              <input type="text" class="form-control @error(\'contact_number\') is-invalid @enderror" id="contact_number" name="contact_number" value="{{ old(\'contact_number\') }}" placeholder="e.g. 012-3456789" required>
              @error(\'contact_number\')<span class="invalid-feedback">{{ $message }}</span>@enderror
            </div>

            <div class="col-md-6">
              <label for="subject" class="form-label">Subject <span class="text-danger">*</span></label>
              <input type="text" class="form-control @error(\'subject\') is-invalid @enderror" id="subject" name="subject" value="{{ old(\'subject\') }}" placeholder="Brief subject line" required>
              @error(\'subject\')<span class="invalid-feedback">{{ $message }}</span>@enderror
            </div>

            <div class="col-12">
              <label for="cat" class="form-label">Choose Item <span class="text-danger">*</span></label>
              <select class="form-select @error(\'cat\') is-invalid @enderror" id="cat" name="cat" required>
                <option value="">— Select a safeguard —</option>
                <option value="SAFEGUARD_A" {{ old(\'cat\') == \'SAFEGUARD_A\' ? \'selected\' : \'\' }}>Safeguard A — National Forest Monitoring System</option>
                <option value="SAFEGUARD_B" {{ old(\'cat\') == \'SAFEGUARD_B\' ? \'selected\' : \'\' }}>Safeguard B — National REDD+ Strategy / Forest Reference Level</option>
                <option value="SAFEGUARD_C" {{ old(\'cat\') == \'SAFEGUARD_C\' ? \'selected\' : \'\' }}>Safeguard C — Stakeholder Consultation / Transparency</option>
                <option value="SAFEGUARD_D" {{ old(\'cat\') == \'SAFEGUARD_D\' ? \'selected\' : \'\' }}>Safeguard D — Biodiversity / Ecosystem Services</option>
                <option value="SAFEGUARD_E" {{ old(\'cat\') == \'SAFEGUARD_E\' ? \'selected\' : \'\' }}>Safeguard E — Governance / Forest Law Enforcement</option>
                <option value="SAFEGUARD_F" {{ old(\'cat\') == \'SAFEGUARD_F\' ? \'selected\' : \'\' }}>Safeguard F — Safeguards Information System (SIS)</option>
                <option value="SAFEGUARD_G" {{ old(\'cat\') == \'SAFEGUARD_G\' ? \'selected\' : \'\' }}>Safeguard G — Coordination / Institutional Arrangements</option>
              </select>
              @error(\'cat\')<span class="invalid-feedback">{{ $message }}</span>@enderror
            </div>

            <div class="col-12">
              <label for="feedback" class="form-label">Your Inquiry <span class="text-danger">*</span></label>
              <textarea class="form-control @error(\'feedback\') is-invalid @enderror" id="feedback" name="feedback" rows="6" placeholder="Describe your report, issue or incident in detail..." required>{{ old(\'feedback\') }}</textarea>
              @error(\'feedback\')<span class="invalid-feedback">{{ $message }}</span>@enderror
            </div>

            <div class="col-12">
              <div class="form-check">
                <input class="form-check-input @error(\'data_protection\') is-invalid @enderror" type="checkbox" id="data_protection" name="data_protection" value="1" {{ old(\'data_protection\') ? \'checked\' : \'\' }} required>
                <label class="form-check-label" for="data_protection" style="font-weight:500;font-size:.88rem;">
                  I consent to the collection and processing of my personal data in accordance with the Personal Data Protection Act 2010 for the purpose of processing this report. <span class="text-danger">*</span>
                </label>
                @error(\'data_protection\')<span class="invalid-feedback">{{ $message }}</span>@enderror
              </div>
            </div>
          </div>

          <div class="mt-4">
            <button type="submit" class="btn btn-reports">
              Submit Report <i class="bi bi-arrow-right ms-1"></i>
            </button>
          </div>
        </form>
      @endif
    </div>
  </div>
</div>

<footer class="footer-redd-article">
  <div class="container">
    <div class="d-flex flex-wrap align-items-center justify-content-center gap-4">
      <img src="/assets/redd-plus/logo.png" alt="REDD+ Malaysia" height="46">
      <span class="f-divider d-none d-md-inline-block"></span>
      <a href="https://redd.nres.gov.my"><i class="bi bi-globe2"></i>https://redd.nres.gov.my</a>
      <span class="f-divider d-none d-md-inline-block"></span>
      <a href="mailto:redd@nres.gov.my"><i class="bi bi-envelope"></i>redd@nres.gov.my</a>
      <span class="f-divider d-none d-md-inline-block"></span>
      <a href="tel:+60380008000"><i class="bi bi-telephone"></i>+603 8000 8000</a>
    </div>
  </div>
</footer>
',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 4,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'faq'], [
            'name' => 'FAQ',
            'slug' => 'faq',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>',
            'entry_script' => null,
            'page_content' => '@php
    use App\\Models\\Backend\\ContentArticle;

    $faqs = ContentArticle::where(\'article_category\', \'FAQ\')
        ->where(\'article_status\', \'ACTIVE\')
        ->with(\'translations\')
        ->orderBy(\'article_sorting\')
        ->get();

    $categories = $faqs->pluck(\'article_subcategory\')->unique()->values()->toArray();

    $catLabels = [
        \'GENERAL\'       => \'General\',
        \'IMPLEMENTATION\'=> \'Implementation\',
        \'SIS\'           => \'SIS &amp; Safeguards\',
        \'FINANCE\'       => \'Finance\',
        \'REPORTS\'       => \'Reports\',
    ];
@endphp

<style>
/* ---------- Hero ---------- */
.hero-faq{
  background:url(\'/assets/redd-plus/faq_hero_bg.png\') center/cover no-repeat;
  padding:4rem 0 4.5rem;
}
.hero-faq h1{
  color:var(--green-800);font-weight:700;
  font-size:clamp(2.3rem,4.5vw,3.2rem);line-height:1.15;
}
.hero-faq p{font-size:1.1rem;font-weight:500;max-width:360px;}
.faq-search{
  background:#fff;border:1px solid #e2ddd0;border-radius:.75rem;
  display:flex;align-items:center;
  max-width:380px;padding:.35rem .5rem .35rem 1rem;
  box-shadow:0 6px 18px rgba(46,74,53,.06);
}
.faq-search input{
  border:0;outline:0;flex:1;font-size:.95rem;font-weight:500;
  color:var(--ink);background:transparent;padding:.5rem 0;
}
.faq-search input::placeholder{color:#9aa59c;}
.faq-search .bi{color:var(--green-800);font-size:1.2rem;padding:.4rem .6rem;}

/* ---------- Category pills ---------- */
.cat-pill{
  border:1px solid #e2ddd0;background:#fff;color:var(--green-800);
  border-radius:.6rem;padding:.55rem 1.4rem;font-weight:600;font-size:.92rem;
  transition:all .15s ease;
}
.cat-pill:hover{border-color:var(--green-800);color:var(--green-900);}
.cat-pill.active{
  background:var(--green-800);border-color:var(--green-800);color:#fff;
  box-shadow:0 6px 14px rgba(46,74,53,.25);
}

/* ---------- Accordion ---------- */
.accordion-faq .accordion-item{
  border:0;border-radius:.75rem!important;margin-bottom:1rem;
  box-shadow:0 4px 14px rgba(46,74,53,.05);
  overflow:hidden;
}
.accordion-faq .accordion-button{
  font-family:\'Quicksand\',sans-serif;
  font-weight:700;color:var(--green-900);font-size:1rem;
  background:#fff;padding:1.25rem 1.5rem;
  box-shadow:none;
}
.accordion-faq .accordion-button:not(.collapsed){
  background:var(--green-100);color:var(--green-900);
}
.accordion-faq .accordion-button:focus{box-shadow:0 0 0 .2rem rgba(46,74,53,.15);}
.accordion-faq .accordion-body{
  background:#fff;font-weight:500;font-size:.95rem;line-height:1.7;
  padding:1.25rem 1.5rem;
}

/* ---------- Footer ---------- */
.footer-redd-article{
  background:url(\'/assets/redd-plus/faq_footer_bg.png\') center bottom/cover no-repeat;
  padding:4rem 0 2.5rem;
}
.footer-redd-article a{
  color:var(--ink);text-decoration:none;font-weight:600;font-size:.85rem;
}
.footer-redd-article a:hover{color:var(--green-800);}
.footer-redd-article .bi{color:var(--green-800);font-size:1.1rem;}
.footer-redd-article .f-divider{width:1px;height:26px;background:#cfc9b8;}
</style>

<!-- ===== Hero ===== -->
<header class=\"hero-faq\">
  <div class=\"container\">
    <div class=\"row\">
      <div class=\"col-lg-6\">
        <h1>Frequently Asked<br>Questions</h1>
        <p class=\"mt-3 mb-4\">Find answers to common questions about REDD+ Malaysia.</p>
        <div class=\"faq-search\">
          <input type=\"search\" id=\"faqSearch\" placeholder=\"Search questions...\" aria-label=\"Search questions\">
          <i class=\"bi bi-search\"></i>
        </div>
      </div>
    </div>
  </div>
</header>

<!-- ===== FAQ ===== -->
<main class=\"container py-5\" style=\"max-width:860px;\">

  <!-- Category pills -->
  <div class=\"d-flex flex-wrap gap-2 mb-4\" role=\"tablist\" aria-label=\"FAQ categories\">
    @foreach($categories as $cat)
      <button class=\"cat-pill{{ $loop->first ? \' active\' : \'\' }}\" data-cat=\"{{ $cat }}\">
        {!! $catLabels[$cat] ?? ucfirst($cat) !!}
      </button>
    @endforeach
  </div>

  <div class=\"accordion accordion-faq\" id=\"faqAccordion\">
    @foreach($faqs as $faq)
      @php
        $title = $faq->translations->first()?->article_translation_title ?? \'Untitled\';
        $body  = $faq->translations->first()?->article_translation_content ?? \'\';
        $isFirstCat = ($faq->article_subcategory === $categories[0]);
      @endphp
      <div class=\"accordion-item{{ $isFirstCat ? \'\' : \' d-none\' }}\" data-cat=\"{{ $faq->article_subcategory }}\">
        <h2 class=\"accordion-header\">
          <button class=\"accordion-button collapsed\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#faq{{ $faq->article_id }}\">
            {{ $title }}
          </button>
        </h2>
        <div id=\"faq{{ $faq->article_id }}\" class=\"accordion-collapse collapse\" data-bs-parent=\"#faqAccordion\">
          <div class=\"accordion-body\">{!! $body !!}</div>
        </div>
      </div>
    @endforeach
  </div>

  <p id=\"noResults\" class=\"text-center fw-semibold mt-4 d-none\">No questions match your search. Try a different keyword or category.</p>
</main>

<!-- ===== Footer ===== -->
<footer class=\"footer-redd-article mt-4\">
  <div class=\"container\">
    <div class=\"d-flex flex-wrap align-items-center justify-content-center gap-4\">
      <img src=\"/assets/redd-plus/logo.png\" alt=\"REDD+ Malaysia\" height=\"46\">
      <span class=\"f-divider d-none d-md-inline-block\"></span>
      <a href=\"https://redd.nres.gov.my\"><i class=\"bi bi-globe2\"></i> redd.nres.gov.my</a>
      <span class=\"f-divider d-none d-md-inline-block\"></span>
      <a href=\"mailto:redd@nres.gov.my\"><i class=\"bi bi-envelope\"></i> redd@nres.gov.my</a>
      <span class=\"f-divider d-none d-md-inline-block\"></span>
      <a href=\"tel:+60380008000\"><i class=\"bi bi-telephone\"></i> +603 8000 8000</a>
    </div>
  </div>
</footer>

<script>
const pills = document.querySelectorAll(\'.cat-pill\');
const items = document.querySelectorAll(\'#faqAccordion .accordion-item\');
const searchBox = document.getElementById(\'faqSearch\');
const noResults = document.getElementById(\'noResults\');
let activeCat = \'{{ $categories[0] ?? \"general\" }}\';

function applyFilter(){
  const term = searchBox.value.trim().toLowerCase();
  let visible = 0;
  items.forEach(item => {
    const inCat = item.dataset.cat === activeCat;
    const text = item.textContent.toLowerCase();
    const match = term === \'\' ? inCat : text.includes(term);
    item.classList.toggle(\'d-none\', !match);
    if (match) visible++;
  });
  noResults.classList.toggle(\'d-none\', visible > 0);
}

pills.forEach(p => p.addEventListener(\'click\', () => {
  pills.forEach(x => x.classList.remove(\'active\'));
  p.classList.add(\'active\');
  activeCat = p.dataset.cat;
  searchBox.value = \'\';
  applyFilter();
}));

searchBox.addEventListener(\'input\', applyFilter);
</script>',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 4,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'glossary'], [
            'name' => 'Glossary',
            'slug' => 'glossary',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>
',
            'entry_script' => null,
            'page_content' => '@php
    use App\\Models\\Backend\\ContentArticle;

    $terms = ContentArticle::with(\'translations\')
        ->where(\'article_portal_category\', \'redd-plus\')
        ->where(\'article_category\', \'GLOSSARY\')
        ->where(\'article_status\', \'ACTIVE\')
        ->orderBy(\'article_sorting\')
        ->get();
@endphp

<style>
.hero-glossary{
  background:url(\'/assets/redd-plus/gl_hero_bg.png\') center/cover no-repeat;
  padding:4rem 0 4.5rem;
}
.hero-glossary h1{
  color:var(--green-800);font-weight:700;
  font-size:clamp(2.4rem,4.5vw,3.3rem);
}
.hero-glossary p{font-size:1.1rem;font-weight:500;max-width:340px;}
.term-search{
  background:#fff;border:1px solid #e2ddd0;border-radius:50rem;
  display:flex;align-items:center;
  max-width:400px;padding:.35rem .5rem .35rem 1.2rem;
  box-shadow:0 6px 18px rgba(46,74,53,.06);
}
.term-search input{
  border:0;outline:0;flex:1;font-size:.95rem;font-weight:500;
  color:var(--ink);background:transparent;padding:.5rem 0;
}
.term-search input::placeholder{color:#9aa59c;}
.term-search .divider{width:1px;height:24px;background:#e2ddd0;margin:0 .4rem;}
.term-search .bi{color:var(--green-800);font-size:1.2rem;padding:.4rem .7rem;}

.letter-bar{display:flex;flex-wrap:wrap;gap:.4rem;}
.letter-btn{
  min-width:38px;height:38px;
  border:1px solid #e2ddd0;background:#fff;color:var(--ink);
  border-radius:.5rem;font-weight:600;font-size:.9rem;
  display:inline-flex;align-items:center;justify-content:center;
  transition:all .15s ease;cursor:pointer;
}
.letter-btn:hover{border-color:var(--green-800);color:var(--green-900);}
.letter-btn.active{
  border-color:var(--green-800);color:var(--green-800);
  background:var(--green-100);font-weight:700;
}
.letter-btn:disabled{opacity:.35;pointer-events:none;}

.glossary-card{
  background:#fdfcf9;
  border:1px solid #ece8db;
  border-radius:1rem;
  box-shadow:0 8px 24px rgba(46,74,53,.05);
  padding:.5rem 2rem;
}
.term-row{
  display:flex;gap:1.5rem;
  padding:1.6rem 0;
  border-bottom:1px solid #e8e4d8;
}
.term-row:last-child{border-bottom:0;}
.term-name{
  flex:0 0 150px;
  color:var(--green-800);font-weight:700;font-size:1.1rem;
  border-right:1px solid #e2ddd0;
  padding-right:1rem;
}
.term-def{margin:0;font-weight:500;font-size:.98rem;line-height:1.7;}

.footer-redd-article{
  background:url(\'/assets/redd-plus/faq_footer_bg.png\') center bottom/cover no-repeat;
  padding:4rem 0 2.5rem;
}
.footer-redd-article a{
  color:var(--ink);text-decoration:none;font-weight:600;font-size:.85rem;
}
.footer-redd-article a:hover{color:var(--green-800);}
.footer-redd-article .bi{color:var(--green-800);font-size:1.1rem;}
.footer-redd-article .f-divider{width:1px;height:26px;background:#cfc9b8;}

@media (max-width: 575.98px){
  .term-row{flex-direction:column;gap:.5rem;}
  .term-name{flex:none;border-right:0;border-bottom:1px solid #e2ddd0;padding:0 0 .5rem;}
}
</style><header class=\"hero-glossary\">
  <div class=\"container\">
    <div class=\"row\">
      <div class=\"col-lg-6\">
        <h1>Glossary</h1>
        <p class=\"mt-3 mb-4\">Key terms and definitions used in the context of REDD+ Malaysia.</p>
        <div class=\"term-search\">
          <input type=\"search\" id=\"termSearch\" placeholder=\"Search terms...\" aria-label=\"Search terms\">
          <span class=\"divider\"></span>
          <i class=\"bi bi-search\"></i>
        </div>
      </div>
    </div>
  </div>
</header>

<main class=\"container py-4\" style=\"max-width:900px;\">
  <div class=\"letter-bar py-3\" id=\"letterBar\" role=\"tablist\" aria-label=\"Filter terms by letter\"></div>

  <div class=\"glossary-card mt-2\" id=\"glossaryList\">
    @foreach($terms as $item)
      @php
        $t = $item->translations->first();
        $term = $t?->article_translation_title ?? \'Untitled\';
        $def = strip_tags($t?->article_translation_content ?? \'\');
        $letter = strtoupper(substr(trim($term), 0, 1));
      @endphp
      <div class=\"term-row\" data-letter=\"{{ $letter }}\">
        <div class=\"term-name\">{{ $term }}</div>
        <p class=\"term-def\">{{ $def }}</p>
      </div>
    @endforeach
  </div>

  <p id=\"noResults\" class=\"text-center fw-semibold mt-4 d-none\">No terms match your search.</p>

  <div id=\"paginationControls\" class=\"d-flex align-items-center justify-content-center gap-3 mt-4\">
    <button id=\"prevPage\" class=\"btn btn-sm\" style=\"border:1px solid #e2ddd0;background:#fff;color:var(--ink);border-radius:.5rem;padding:.45rem 1rem;font-weight:600;font-size:.85rem;\" disabled>
      <i class=\"bi bi-chevron-left me-1\"></i> Prev
    </button>
    <span id=\"pageInfo\" class=\"fw-semibold\" style=\"font-size:.88rem;color:var(--ink);\"></span>
    <button id=\"nextPage\" class=\"btn btn-sm\" style=\"border:1px solid #e2ddd0;background:#fff;color:var(--ink);border-radius:.5rem;padding:.45rem 1rem;font-weight:600;font-size:.85rem;\">
      Next <i class=\"bi bi-chevron-right ms-1\"></i>
    </button>
  </div>
</main>

<footer class=\"footer-redd-article mt-4\">
  <div class=\"container\">
    <div class=\"d-flex flex-wrap align-items-center justify-content-center gap-4\">
      <img src=\"/assets/redd-plus/logo.png\" alt=\"REDD+ Malaysia\" height=\"46\">
      <span class=\"f-divider d-none d-md-inline-block\"></span>
      <a href=\"https://redd.nres.gov.my\"><i class=\"bi bi-globe2\"></i> redd.nres.gov.my</a>
      <span class=\"f-divider d-none d-md-inline-block\"></span>
      <a href=\"mailto:redd@nres.gov.my\"><i class=\"bi bi-envelope\"></i> redd@nres.gov.my</a>
      <span class=\"f-divider d-none d-md-inline-block\"></span>
      <a href=\"tel:+60380008000\"><i class=\"bi bi-telephone\"></i> +603 8000 8000</a>
    </div>
  </div>
</footer>

<script>
const rows = document.querySelectorAll(\'.term-row\');
const bar = document.getElementById(\'letterBar\');
const searchBox = document.getElementById(\'termSearch\');
const noResults = document.getElementById(\'noResults\');
const prevBtn = document.getElementById(\'prevPage\');
const nextBtn = document.getElementById(\'nextPage\');
const pageInfo = document.getElementById(\'pageInfo\');
const paginationWrap = document.getElementById(\'paginationControls\');
let activeLetter = \'All\';
let currentPage = 1;
const perPage = 10;

const lettersUsed = new Set([...rows].map(r => r.dataset.letter));
const letters = [\'All\', ...Array.from({length:26}, (_,i) => String.fromCharCode(65+i))];
letters.forEach(l => {
  const b = document.createElement(\'button\');
  b.className = \'letter-btn\' + (l === \'All\' ? \' active\' : \'\');
  b.textContent = l;
  if (l !== \'All\' && !lettersUsed.has(l)) b.disabled = true;
  b.addEventListener(\'click\', () => {
    bar.querySelectorAll(\'.letter-btn\').forEach(x => x.classList.remove(\'active\'));
    b.classList.add(\'active\');
    activeLetter = l;
    searchBox.value = \'\';
    currentPage = 1;
    applyFilter();
  });
  bar.appendChild(b);
});

function applyFilter(){
  const term = searchBox.value.trim().toLowerCase();
  let matched = [];

  rows.forEach(r => {
    const byLetter = activeLetter === \'All\' || r.dataset.letter === activeLetter;
    const byText = term === \'\' || r.textContent.toLowerCase().includes(term);
    const show = term === \'\' ? byLetter : byText;
    r.style.display = \'none\';
    if (show) matched.push(r);
  });

  const total = matched.length;
  const totalPages = Math.max(1, Math.ceil(total / perPage));
  if (currentPage > totalPages) currentPage = totalPages;

  const start = (currentPage - 1) * perPage;
  const end = start + perPage;
  matched.forEach((r, i) => {
    r.style.display = (i >= start && i < end) ? \'\' : \'none\';
  });

  noResults.classList.toggle(\'d-none\', total > 0);

  if (total > perPage) {
    paginationWrap.classList.remove(\'d-none\');
    prevBtn.disabled = currentPage <= 1;
    nextBtn.disabled = currentPage >= totalPages;
    pageInfo.textContent = \'Page \' + currentPage + \' of \' + totalPages;
  } else {
    paginationWrap.classList.add(\'d-none\');
  }
}

prevBtn.addEventListener(\'click\', () => { currentPage--; applyFilter(); });
nextBtn.addEventListener(\'click\', () => { currentPage++; applyFilter(); });
searchBox.addEventListener(\'input\', () => { currentPage = 1; applyFilter(); });

applyFilter();
</script>
',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 5,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'publications'], [
            'name' => 'Publications',
            'slug' => 'publications',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>
',
            'entry_script' => null,
            'page_content' => '@php
    $pubCats = [
        \'STRATEGIC\' => \'Strategic Documents\',
        \'TECHNICAL\' => \'Technical Documents\',
        \'REPORT\'    => \'Reports & Publications\',
        \'COMMS\'     => \'National Communications\',
    ];
    $downloads = \\App\\Models\\Backend\\ContentDownload::where(\'download_status\',\'ACTIVE\')
        ->where(\'download_language\', \'en\')
        ->orderBy(\'download_date\', \'desc\')
        ->get();
    $grouped = $downloads->groupBy(\'download_category\');
@endphp
<style>
.page-hero{background:linear-gradient(135deg,var(--green-800),var(--green-900));padding:3rem 0;color:#fff;margin-bottom:0;}
.page-hero h1{font-weight:700;font-size:clamp(2rem,4vw,2.8rem);}
.page-hero p{font-size:1rem;font-weight:500;max-width:400px;opacity:.9;}
.pub-section{padding:3rem 0;background:var(--cream);min-height:50vh;}
.pub-card{border:1px solid #ece8db;border-radius:.75rem;padding:1.25rem;background:#fff;display:flex;gap:1rem;align-items:flex-start;text-decoration:none;color:inherit;transition:box-shadow .2s;margin-bottom:.75rem;}
.pub-card:hover{box-shadow:0 8px 20px rgba(46,74,53,.08);}
.pub-icon{width:44px;height:44px;background:var(--green-100);border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.2rem;color:var(--green-800);flex:0 0 44px;}
.pub-card h4{font-weight:700;font-size:.9rem;color:var(--green-800);margin-bottom:.2rem;}
.pub-card p{font-size:.8rem;font-weight:500;margin:0;line-height:1.5;color:#5b6a5e;}
.section-title{color:var(--green-800);font-weight:700;font-size:1.35rem;margin-bottom:1.5rem;}
.footer-redd-article{
  background:url(\'/assets/redd-plus/faq_footer_bg.png\') center bottom/cover no-repeat;
  padding:4rem 0 2.5rem;
}
.footer-redd-article a{
  color:var(--ink);text-decoration:none;font-weight:600;font-size:.85rem;
}
.footer-redd-article a:hover{color:var(--green-800);}
.footer-redd-article .bi{color:var(--green-800);font-size:1.1rem;}
.footer-redd-article .f-divider{width:1px;height:26px;background:#cfc9b8;}
</style>

<div style=\"min-height:calc(100vh - 64px);background:#fff;\">
  <header class=\"page-hero\">
    <div class=\"container\">
      <h1>Publications, Documents &amp; Reports</h1>
      <p>Access official documents, reports and publications related to REDD+ Malaysia.</p>
    </div>
  </header>

  <div class=\"pub-section\">
    <div class=\"container\">
      @if($downloads->count())
        @foreach($pubCats as $code => $label)
          @php $items = $grouped->get($code, collect()); @endphp
          @if($items->count())
            <h2 class=\"section-title\">{{ $label }}</h2>
            <div class=\"mb-4\">
              @foreach($items as $d)
                <a href=\"{{ $d->download_file ? image_url($d->download_file) : \'#\' }}\" target=\"_blank\" class=\"pub-card\">
                  <div class=\"pub-icon\"><i class=\"bi bi-file-earmark-pdf\"></i></div>
                  <div>
                    <h4>{{ $d->download_title }}</h4>
                    @if($d->download_date)<p>{{ \\Carbon\\Carbon::parse($d->download_date)->format(\'d M Y\') }}</p>@endif
                  </div>
                </a>
              @endforeach
            </div>
          @endif
        @endforeach
      @else
        <div class=\"text-center py-5\">
          <i class=\"bi bi-folder\" style=\"font-size:3rem;color:var(--green-200);\"></i>
          <h4 class=\"mt-3\" style=\"color:var(--green-800);\">No publications yet</h4>
          <p style=\"color:#8a9a8e;\">Documents will appear here once available.</p>
        </div>
      @endif
    </div>
  </div>

  <footer class=\"footer-redd-article mt-4\">
    <div class=\"container\">
      <div class=\"d-flex flex-wrap align-items-center justify-content-center gap-4\">
        <img src=\"/assets/redd-plus/logo.png\" alt=\"REDD+ Malaysia\" height=\"46\">
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"https://redd.nres.gov.my\"><i class=\"bi bi-globe2\"></i> redd.nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"mailto:redd@nres.gov.my\"><i class=\"bi bi-envelope\"></i> redd@nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"tel:+60380008000\"><i class=\"bi bi-telephone\"></i> +603 8000 8000</a>
      </div>
    </div>
  </footer>
</div>',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 6,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'news'], [
            'name' => 'News & Updates',
            'slug' => 'news',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>
',
            'entry_script' => null,
            'page_content' => '@php
    use App\\Models\\Backend\\ContentArticle;
    $news = ContentArticle::with(\'translations\')
        ->where(\'article_portal_category\', \'redd-plus\')
        ->where(\'article_category\', \'NEWS\')
        ->where(\'article_status\', \'ACTIVE\')
        ->orderBy(\'article_date\', \'desc\')
        ->orderBy(\'article_sorting\')
        ->get();
@endphp
<style>
.page-hero{background:linear-gradient(135deg,var(--green-800),var(--green-900));padding:3rem 0;color:#fff;margin-bottom:0;}
.page-hero h1{font-weight:700;font-size:clamp(2rem,4vw,2.8rem);}
.page-hero p{font-size:1rem;font-weight:500;max-width:400px;opacity:.9;}
.news-section{padding:3rem 0;background:var(--cream);min-height:50vh;}
.news-card{border:1px solid #ece8db;border-radius:.75rem;overflow:hidden;background:#fff;height:100%;text-decoration:none;color:inherit;display:block;transition:box-shadow .2s,transform .2s;}
.news-card:hover{box-shadow:0 8px 24px rgba(46,74,53,.1);transform:translateY(-3px);}
.news-card-img{height:200px;background:var(--green-100);display:flex;align-items:center;justify-content:center;font-size:3rem;color:var(--green-200);}
.news-card-body{padding:1.25rem 1.5rem 1.5rem;}
.news-card-cat{display:inline-block;background:var(--green-100);color:var(--green-800);padding:.25rem .75rem;border-radius:50rem;font-size:.75rem;font-weight:600;margin-bottom:.75rem;}
.news-card h3{font-weight:700;font-size:1.05rem;color:var(--green-900);margin-bottom:.5rem;line-height:1.4;}
.news-card-date{font-size:.82rem;color:#8a9a8e;font-weight:500;}
.news-card p{font-size:.88rem;color:var(--ink);line-height:1.6;margin-top:.5rem;}
.footer-redd-article{
  background:url(\'/assets/redd-plus/faq_footer_bg.png\') center bottom/cover no-repeat;
  padding:4rem 0 2.5rem;
}
.footer-redd-article a{
  color:var(--ink);text-decoration:none;font-weight:600;font-size:.85rem;
}
.footer-redd-article a:hover{color:var(--green-800);}
.footer-redd-article .bi{color:var(--green-800);font-size:1.1rem;}
.footer-redd-article .f-divider{width:1px;height:26px;background:#cfc9b8;}
</style>

<div style=\"min-height:calc(100vh - 64px);background:#fff;\">
  <header class=\"page-hero\">
    <div class=\"container\">
      <h1>News &amp; Updates</h1>
      <p>Latest updates, announcements and news from REDD+ Malaysia.</p>
    </div>
  </header>

  <div class=\"news-section\">
    <div class=\"container\">
      @if($news->count())
        <div class=\"row g-4\">
          @foreach($news as $item)
            @php
              $t = $item->translations->first();
              $title = $t?->article_translation_title ?? \'Untitled\';
              $excerpt = strip_tags($t?->article_translation_content ?? \'\');
              $excerpt = \\Illuminate\\Support\\Str::limit($excerpt, 150);
              $catLabel = \\App\\Models\\Backend\\Ref::where(\'cat\',\'ARTICLE_CAT\')->where(\'code\',$item->article_category)->value(\'descr\') ?? $item->article_category;
              $date = $item->article_date ? \\Carbon\\Carbon::parse($item->article_date)->format(\'d M Y\') : \'\';
            @endphp
            <div class=\"col-md-6 col-lg-4\">
              <a href=\"/{{ request()->segment(1) }}/article?id={{ $item->article_code }}\" class=\"news-card\">
                <div class=\"news-card-img\"><i class=\"bi bi-newspaper\"></i></div>
                <div class=\"news-card-body\">
                  <span class=\"news-card-cat\">{{ $catLabel }}</span>
                  <h3>{{ $title }}</h3>
                  @if($date)<span class=\"news-card-date\"><i class=\"bi bi-calendar3 me-1\"></i>{{ $date }}</span>@endif
                  @if($excerpt)<p>{{ $excerpt }}</p>@endif
                </div>
              </a>
            </div>
          @endforeach
        </div>
      @else
        <div class=\"text-center py-5\">
          <i class=\"bi bi-newspaper\" style=\"font-size:3rem;color:var(--green-200);\"></i>
          <h4 class=\"mt-3\" style=\"color:var(--green-800);\">No news articles yet</h4>
          <p style=\"color:#8a9a8e;\">Check back later for updates.</p>
        </div>
      @endif
    </div>
  </div>

  <footer class=\"footer-redd-article mt-4\">
    <div class=\"container\">
      <div class=\"d-flex flex-wrap align-items-center justify-content-center gap-4\">
        <img src=\"/assets/redd-plus/logo.png\" alt=\"REDD+ Malaysia\" height=\"46\">
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"https://redd.nres.gov.my\"><i class=\"bi bi-globe2\"></i> redd.nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"mailto:redd@nres.gov.my\"><i class=\"bi bi-envelope\"></i> redd@nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"tel:+60380008000\"><i class=\"bi bi-telephone\"></i> +603 8000 8000</a>
      </div>
    </div>
  </footer>
</div>',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 7,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'gallery'], [
            'name' => 'Gallery',
            'slug' => 'gallery',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>
',
            'entry_script' => null,
            'page_content' => '@php
    $galleries = \\App\\Models\\Backend\\ContentPhotoGallery::with([\'translations\',\'photoLists\'])
        ->where(\'gallery_status\', \'ACTIVE\')
        ->where(\'gallery_portal\', \'redd-plus\')
        ->orderBy(\'gallery_sort\')
        ->orderBy(\'gallery_date\', \'desc\')
        ->get();

    $videos = \\App\\Models\\Backend\\ContentVideo::whereRaw(\'1=0\')->get() /* No REDD+ videos */;
@endphp
<style>
.page-hero{background:linear-gradient(135deg,var(--green-800),var(--green-900));padding:3rem 0;color:#fff;margin-bottom:0;}
.page-hero h1{font-weight:700;font-size:clamp(2rem,4vw,2.8rem);}
.page-hero p{font-size:1rem;font-weight:500;max-width:400px;opacity:.9;}
.gallery-section{padding:3rem 0;background:var(--cream);min-height:50vh;}
.tab-bar{display:flex;gap:0;margin-bottom:2rem;border-bottom:2px solid #e8e4d8;}
.tab-btn{padding:.75rem 2rem;font-weight:600;font-size:.9rem;color:#6c7a6e;cursor:pointer;border:none;background:none;border-bottom:3px solid transparent;margin-bottom:-2px;transition:all .2s}
.tab-btn:hover{color:var(--green-800);}
.tab-btn.active{color:var(--green-800);border-bottom-color:var(--green-800);}
.tab-content{display:none}
.tab-content.active{display:block}
.gallery-card{border-radius:.75rem;overflow:hidden;background:#fff;border:1px solid #ece8db;height:100%;transition:transform .2s ease,box-shadow .2s ease}
.gallery-card:hover{transform:translateY(-4px);box-shadow:0 12px 28px rgba(46,74,53,.12)}
.gallery-card .img-wrap{height:220px;background:var(--green-100);display:flex;align-items:center;justify-content:center;overflow:hidden;}
.gallery-card .img-wrap img{width:100%;height:100%;object-fit:cover;}
.gallery-card .img-wrap .placeholder{font-size:3rem;color:var(--green-200);}
.gallery-card .caption{padding:1rem 1.25rem;}
.gallery-card .caption h4{font-weight:700;font-size:.9rem;color:var(--green-800);margin-bottom:.2rem;}
.gallery-card .caption p{font-size:.8rem;font-weight:500;color:#5b6a5e;margin:0;line-height:1.5;}
.video-card{border-radius:.75rem;overflow:hidden;background:#fff;border:1px solid #ece8db;height:100%;transition:transform .2s ease,box-shadow .2s ease}
.video-card:hover{transform:translateY(-4px);box-shadow:0 12px 28px rgba(46,74,53,.12)}
.video-card .vid-wrap{height:220px;background:#1a1a2e;display:flex;align-items:center;justify-content:center;overflow:hidden;position:relative}
.video-card .vid-wrap iframe,.video-card .vid-wrap video{width:100%;height:100%;object-fit:cover}
.video-card .vid-wrap .play-icon{position:absolute;width:56px;height:56px;background:rgba(0,0,0,.5);border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-size:1.5rem;border:2px solid rgba(255,255,255,.6);cursor:pointer;transition:all .2s}
.video-card .vid-wrap .play-icon:hover{background:rgba(0,0,0,.7);transform:scale(1.05)}
.video-card .caption{padding:1rem 1.25rem;}
.video-card .caption h4{font-weight:700;font-size:.9rem;color:var(--green-800);margin-bottom:.2rem;}
.video-card .caption p{font-size:.8rem;font-weight:500;color:#5b6a5e;margin:0;line-height:1.5;}
.coming-soon{text-align:center;padding:4rem 2rem;color:#8a9a8e}
.coming-soon i{font-size:3.5rem;color:var(--green-200);display:block;margin-bottom:1rem}
.coming-soon h3{font-weight:600;color:var(--green-700);margin-bottom:.5rem}
.coming-soon p{font-size:.9rem;font-weight:500;margin:0}
.footer-redd-article{
  background:url(\'/assets/redd-plus/faq_footer_bg.png\') center bottom/cover no-repeat;
  padding:4rem 0 2.5rem;
}
.footer-redd-article a{
  color:var(--ink);text-decoration:none;font-weight:600;font-size:.85rem;
}
.footer-redd-article a:hover{color:var(--green-800);}
.footer-redd-article .bi{color:var(--green-800);font-size:1.1rem;}
.footer-redd-article .f-divider{width:1px;height:26px;background:#cfc9b8;}
</style>

<div style=\"min-height:calc(100vh - 64px);background:#fff;\">
  <header class=\"page-hero\">
    <div class=\"container\">
      <h1>Gallery</h1>
      <p>Photos and videos showcasing REDD+ Malaysia activities and initiatives.</p>
    </div>
  </header>

  <div class=\"gallery-section\">
    <div class=\"container\">
      <div class=\"tab-bar\" id=\"tabBar\">
        <button class=\"tab-btn active\" data-tab=\"photos\">Photos</button>
        <button class=\"tab-btn\" data-tab=\"videos\">Videos</button>
      </div>

      <div id=\"tab-photos\" class=\"tab-content active\">
        @if($galleries->count())
        <div class=\"row g-4\">
          @foreach($galleries as $g)
            @php $t = $g->translations->first(); @endphp
            <div class=\"col-md-6 col-lg-4\">
              <div class=\"gallery-card\">
                <div class=\"img-wrap\">
                  @if($g->gallery_thumbnail)
                    <img src=\"{{ image_url($g->gallery_thumbnail) }}\" alt=\"{{ $t?->gallery_translation_title ?? \'Gallery\' }}\">
                  @else
                    <div class=\"placeholder\"><i class=\"bi bi-image\"></i></div>
                  @endif
                </div>
                <div class=\"caption\">
                  <h4>{{ $t?->gallery_translation_title ?? \'Untitled\' }}</h4>
                  @if($t?->gallery_translation_descr)<p>{{ \\Illuminate\\Support\\Str::limit($t->gallery_translation_descr, 100) }}</p>@endif
                </div>
              </div>
            </div>
          @endforeach
        </div>
        @else
        <div class=\"coming-soon\">
          <i class=\"bi bi-images\"></i>
          <h3>No Photos Yet</h3>
          <p>Photo gallery coming soon.</p>
        </div>
        @endif
      </div>

      <div id=\"tab-videos\" class=\"tab-content\">
        @if($videos->count())
        <div class=\"row g-4\">
          @foreach($videos as $v)
            @php $vt = $v->translations->first(); @endphp
            <div class=\"col-md-6 col-lg-4\">
              <div class=\"video-card\">
                <div class=\"vid-wrap\">
                  @if($v->video_url && str_contains($v->video_url, \'youtube\'))
                    <iframe src=\"https://www.youtube.com/embed/{{ \\Illuminate\\Support\\Str::after($v->video_url, \'v=\') }}\" frameborder=\"0\" allowfullscreen></iframe>
                  @elseif($v->video_upload)
                    <video controls><source src=\"{{ Storage::url($v->video_upload) }}\" type=\"video/mp4\"></video>
                  @elseif($v->video_external)
                    <iframe src=\"{{ $v->video_external }}\" frameborder=\"0\" allowfullscreen></iframe>
                  @else
                    <div class=\"placeholder\"><i class=\"bi bi-play-circle\" style=\"font-size:3rem;color:var(--green-200);\"></i></div>
                  @endif
                </div>
                <div class=\"caption\">
                  <h4>{{ $vt?->video_translation_title ?? \'Untitled\' }}</h4>
                  @if($vt?->video_translation_descr)<p>{{ \\Illuminate\\Support\\Str::limit($vt->video_translation_descr, 100) }}</p>@endif
                </div>
              </div>
            </div>
          @endforeach
        </div>
        @else
        <div class=\"coming-soon\">
          <i class=\"bi bi-camera-reels\"></i>
          <h3>Coming Soon</h3>
          <p>Video gallery is being prepared. Stay tuned for updates on REDD+ Malaysia activities.</p>
        </div>
        @endif
      </div>
    </div>
  </div>

  <footer class=\"footer-redd-article mt-4\">
    <div class=\"container\">
      <div class=\"d-flex flex-wrap align-items-center justify-content-center gap-4\">
        <img src=\"/assets/redd-plus/logo.png\" alt=\"REDD+ Malaysia\" height=\"46\">
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"https://redd.nres.gov.my\"><i class=\"bi bi-globe2\"></i> redd.nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"mailto:redd@nres.gov.my\"><i class=\"bi bi-envelope\"></i> redd@nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"tel:+60380008000\"><i class=\"bi bi-telephone\"></i> +603 8000 8000</a>
      </div>
    </div>
  </footer>
</div>

<script>
document.getElementById(\'tabBar\').addEventListener(\'click\', function(e) {
  var btn = e.target.closest(\'.tab-btn\');
  if (!btn) return;
  var tab = btn.dataset.tab;
  document.querySelectorAll(\'.tab-content\').forEach(function(el) { el.classList.remove(\'active\'); });
  document.querySelectorAll(\'.tab-btn\').forEach(function(el) { el.classList.remove(\'active\'); });
  document.getElementById(\'tab-\' + tab).classList.add(\'active\');
  btn.classList.add(\'active\');
});
</script>',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 8,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'related-links'], [
            'name' => 'Related Links',
            'slug' => 'related-links',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>
',
            'entry_script' => null,
            'page_content' => '@php
    $links = \\App\\Models\\Backend\\ContentApplication::with(\'translations\')
        ->where(\'application_status\', \'ACTIVE\')
        ->where(\'application_url\', \'!=\', \'\')
        ->where(\'application_url\', \'!=\', \'#\')
        ->orderBy(\'application_sort\')
        ->get();
    $grouped = $links->groupBy(\'application_cat\');
    $catLabels = [
        \'MAIN_LINKS\'    => \'International Frameworks\',
        \'NATIONAL\'      => \'National Agencies\',
        \'PARTNER\'       => \'Partners &amp; Organisations\',
    ];
@endphp
<style>
.page-hero{background:linear-gradient(135deg,var(--green-800),var(--green-900));padding:3rem 0;color:#fff;margin-bottom:0;}
.page-hero h1{font-weight:700;font-size:clamp(2rem,4vw,2.8rem);}
.page-hero p{font-size:1rem;font-weight:500;max-width:400px;opacity:.9;}
.link-section{padding:3rem 0;background:var(--cream);min-height:50vh;}
.link-card{border:1px solid #ece8db;border-radius:.75rem;padding:1.25rem;height:100%;background:#fff;display:flex;gap:1rem;align-items:flex-start;text-decoration:none;color:inherit;transition:box-shadow .2s,transform .2s;margin-bottom:.75rem;}
.link-card:hover{box-shadow:0 8px 20px rgba(46,74,53,.08);transform:translateY(-2px);}
.link-icon{width:52px;height:52px;background:var(--green-100);border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.4rem;color:var(--green-800);flex:0 0 52px;}
.link-card h4{font-weight:700;font-size:.9rem;color:var(--green-800);margin-bottom:.2rem;}
.link-card p{font-size:.8rem;font-weight:500;margin:0;line-height:1.5;color:#5b6a5e;}
.section-title{color:var(--green-800);font-weight:700;font-size:1.35rem;margin-bottom:1.5rem;}
.footer-redd-article{
  background:url(\'/assets/redd-plus/faq_footer_bg.png\') center bottom/cover no-repeat;
  padding:4rem 0 2.5rem;
}
.footer-redd-article a{
  color:var(--ink);text-decoration:none;font-weight:600;font-size:.85rem;
}
.footer-redd-article a:hover{color:var(--green-800);}
.footer-redd-article .bi{color:var(--green-800);font-size:1.1rem;}
.footer-redd-article .f-divider{width:1px;height:26px;background:#cfc9b8;}
</style>

<div style=\"min-height:calc(100vh - 64px);background:#fff;\">
  <header class=\"page-hero\">
    <div class=\"container\">
      <h1>Related Links</h1>
      <p>Useful links to international frameworks, partners and related organisations.</p>
    </div>
  </header>

  <div class=\"link-section\">
    <div class=\"container\">
      @if($links->count())
        @foreach($catLabels as $code => $label)
          @php $items = $grouped->get($code, collect()); @endphp
          @if($items->count())
            <h2 class=\"section-title\">{{ $label }}</h2>
            <div class=\"mb-4\">
              @foreach($items as $l)
                @php $t = $l->translations->first(); @endphp
                <a href=\"{{ $l->application_url ?: \'#\' }}\" target=\"{{ str_starts_with($l->application_url ?? \'\', \'#\') ? \'_self\' : \'_blank\' }}\" class=\"link-card\">
                  <div class=\"link-icon\"><i class=\"bi bi-box-arrow-up-right\"></i></div>
                  <div>
                    <h4>{{ $t?->application_translation_title ?? \'Untitled\' }}</h4>
                  </div>
                </a>
              @endforeach
            </div>
          @endif
        @endforeach
      @else
        <div class=\"text-center py-5\">
          <i class=\"bi bi-link-45deg\" style=\"font-size:3rem;color:var(--green-200);\"></i>
          <h4 class=\"mt-3\" style=\"color:var(--green-800);\">No links yet</h4>
          <p style=\"color:#8a9a8e;\">Related links will appear here once available.</p>
        </div>
      @endif
    </div>
  </div>

  <footer class=\"footer-redd-article mt-4\">
    <div class=\"container\">
      <div class=\"d-flex flex-wrap align-items-center justify-content-center gap-4\">
        <img src=\"/assets/redd-plus/logo.png\" alt=\"REDD+ Malaysia\" height=\"46\">
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"https://redd.nres.gov.my\"><i class=\"bi bi-globe2\"></i> redd.nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"mailto:redd@nres.gov.my\"><i class=\"bi bi-envelope\"></i> redd@nres.gov.my</a>
        <span class=\"f-divider d-none d-md-inline-block\"></span>
        <a href=\"tel:+60380008000\"><i class=\"bi bi-telephone\"></i> +603 8000 8000</a>
      </div>
    </div>
  </footer>
</div>',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 9,
        ]);

        DB::table('frontend_pages')->updateOrInsert(['site_fk' => $siteId, 'slug' => 'sitemap'], [
            'name' => 'Sitemap',
            'slug' => 'sitemap',
            'site_fk' => $siteId,
            'layout' => '<!DOCTYPE html>
<html lang=\"en\">
<head>
    <meta charset=\"UTF-8\" />
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
    <title>{!! $siteName !!}</title>

    <!-- Bootstrap 5 -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">
    <!-- Bootstrap Icons -->
    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css\" rel=\"stylesheet\">
    <!-- Fonts -->
    <link href=\"https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">

    <style>
        :root{
            --green-900:#22392a;
            --green-800:#2e4a35;
            --green-700:#3d5c44;
            --green-200:#cddac9;
            --green-100:#e4ecdf;
            --gold:#b9975b;
            --cream:#f7f5ee;
            --olive-bg:#efeee3;
            --ink:#3a4a3f;
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family:\'Quicksand\',sans-serif;
            color:var(--ink);
            background:var(--cream);
        }
        .font-display { font-family:\'Playfair Display\',serif; }
    </style>
</head>
<body>
    {!! $__header__ !!}
    {!! $__page__ !!}

    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js\"></script>
</body>
</html>
',
            'entry_script' => null,
            'page_content' => '<style>
.sitemap-wrap{max-width:900px;margin:0 auto;padding:40px 20px;font-family:\'Quicksand\',sans-serif;color:var(--ink,#3a4a3f)}
.sitemap-wrap h1{font-family:\'Playfair Display\',serif;color:var(--green-900,#22392a);font-weight:700;font-size:2rem;margin-bottom:8px}
.sitemap-wrap .breadcrumb{font-size:.85rem;color:#6c7a6e;margin-bottom:30px}
.sitemap-wrap .breadcrumb a{color:var(--green-800,#2e4a35);text-decoration:none}
.sitemap-wrap .breadcrumb a:hover{text-decoration:underline}
.sitemap-cat{margin-bottom:30px}
.sitemap-cat h2{font-size:1.1rem;font-weight:700;color:var(--green-900,#22392a);border-bottom:2px solid var(--gold,#b9975b);padding-bottom:6px;margin-bottom:12px}
.sitemap-cat ul{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:4px 20px}
.sitemap-cat li{padding:4px 0}
.sitemap-cat li a{color:var(--green-800,#2e4a35);text-decoration:none;font-size:.9rem;font-weight:500;display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:6px;transition:all .15s}
.sitemap-cat li a:hover{background:var(--green-100,#e4ecdf);color:var(--green-900,#22392a);padding-left:12px}
.sitemap-cat li a::before{content:\'\\203A\';color:var(--gold,#b9975b);font-weight:700;font-size:1.1rem}
@media (max-width:600px){.sitemap-cat ul{grid-template-columns:1fr}}
</style>
<div class=\"sitemap-wrap\">
  <h1>Sitemap</h1>
  <div class=\"breadcrumb\"><a href=\"/redd-plus\">Home</a> / Sitemap</div>

  <div class=\"sitemap-cat\">
    <h2>REDD+</h2>
    <ul>
      <li><a href=\"/redd-plus/article?id=about-redd-plus\">About REDD+ Malaysia</a></li>
      <li><a href=\"/redd-plus/article?id=governance\">Governance</a></li>
      <li><a href=\"/redd-plus/article?id=stakeholder-engagement\">Stakeholder Engagement</a></li>
      <li><a href=\"/redd-plus/article?id=national-redd-strategy\">National REDD+ Strategy</a></li>
      <li><a href=\"/redd-plus/article?id=redd-implementation\">REDD+ Implementation</a></li>
      <li><a href=\"/redd-plus/article?id=mrv-framework\">MRV Framework</a></li>
      <li><a href=\"/redd-plus/article?id=related-policies\">Related Policies</a></li>
    </ul>
  </div>

  <div class=\"sitemap-cat\">
    <h2>SIS (Safeguards Information System)</h2>
    <ul>
      <li><a href=\"/redd-plus/article?id=about-sis\">About SIS</a></li>
      <li><a href=\"/redd-plus/article?id=cancun-safeguards\">Cancun Safeguards</a></li>
      <li><a href=\"/redd-plus/article?id=malaysia-safeguards\">Malaysia Safeguards</a></li>
      <li><a href=\"/redd-plus/article?id=safeguards-interpretation\">Safeguards Interpretation</a></li>
      <li><a href=\"/redd-plus/article?id=indicators\">Indicators</a></li>
      <li><a href=\"/redd-plus/article?id=summary-of-information\">Summary of Information</a></li>
    </ul>
  </div>

  <div class=\"sitemap-cat\">
    <h2>Resources</h2>
    <ul>
      <li><a href=\"/redd-plus/publications\">Publications, Documents &amp; Reports</a></li>
      <li><a href=\"/redd-plus/news\">News &amp; Updates</a></li>
      <li><a href=\"/redd-plus/gallery\">Gallery</a></li>
      <li><a href=\"/redd-plus/related-links\">Related Links</a></li>
      <li><a href=\"/redd-plus/faq\">FAQ</a></li>
      <li><a href=\"/redd-plus/glossary\">Glossary</a></li>
    </ul>
  </div>

  <div class=\"sitemap-cat\">
    <h2>Contact</h2>
    <ul>
      <li><a href=\"/redd-plus/contact\">Contact Us</a></li>
      <li><a href=\"/redd-plus/reports-issues\">Reports, Issues &amp; Incidents</a></li>
    </ul>
  </div>
</div>',
            'use_custom_layout' => 1,
            'is_default' => 0,
            'status' => 1,
            'sort_order' => 10,
        ]);

    }
}