<?php
// Common header for TIM 2026 conference site
if (!isset($page_title) || trim($page_title) === '') {
    $page_title = "TIM 2026 Physics Conference";
}
$current = basename($_SERVER['PHP_SELF']);
// Full navigation (used for sidebar + mobile offcanvas)
$nav = [
    ["Home", "index.php", "house-door"],
    ["Objectives & Topics", "objectives_topics.php", "bullseye"],
    ["Abstract Booklet", "abstract_submission.php", "file-earmark-text"],
    ["Registration Form", "registration_form.php", "pencil-square"],
    ["Registration Fee", "fee.php", "cash-coin"],
    ["Program", "program.php", "calendar-event"],
    ["Conference Proceedings", "conference_proceedings.php", "journal-text"],
    ["Organizing Committee", "organizing_committee.php", "people"],
    ["Scientific Committee", "scientific_committee.php", "mortarboard"],
    ["Past Events", "past_events.php", "clock-history"],
    ["Contact", "contact.php", "envelope"]
];

// Desktop navbar is intentionally compact to prevent wrapping/overlap on medium widths.
$nav_primary = [
    ["Home", "index.php"],
    ["Objectives", "objectives_topics.php"],
    ["Abstracts", "abstract_submission.php"],
    ["Register", "registration_form.php"],
    ["Program", "program.php"],
    ["Proceedings", "conference_proceedings.php"],
];

$nav_committees = [
    ["Organizing Committee", "organizing_committee.php", "people"],
    ["Scientific Committee", "scientific_committee.php", "mortarboard"],
];

$nav_more = [
    ["Fees", "fee.php", "cash-coin"],
    ["Past Events", "past_events.php", "clock-history"],
    ["Contact", "contact.php", "envelope"],
];
?><!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><?php echo htmlspecialchars($page_title); ?></title>

  <!-- Bootstrap (CSS) -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">

  <!-- Bootstrap Icons -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">

  <!-- Site theme -->
  <link rel="stylesheet" href="css/structure.css">

  <meta name="theme-color" content="#0b2a4a">
</head>

<body class="tim-body">
  <a class="visually-hidden-focusable" href="#content">Skip to content</a>

  <header class="tim-header sticky-top">
    <nav class="navbar navbar-expand-lg navbar-dark tim-navbar">
      <div class="container-xxl">
        <a class="navbar-brand d-flex align-items-center gap-2" href="index.php" aria-label="TIM 2026 home">
          <img src="images/w-logo.jpeg" alt="TIM conference logo" class="tim-brand-logo" loading="lazy">
          <div class="lh-sm">
            <div class="fw-semibold tim-brand-title">TIM 2026</div>
            <div class="tim-brand-subtitle">Physics Conference</div>
          </div>
        </a>

        <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNav"
                aria-controls="offcanvasNav" aria-label="Open menu">
          <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse">
          <ul class="navbar-nav ms-auto align-items-lg-center gap-lg-1 tim-navbar-compact">
            <?php foreach ($nav_primary as $item): 
              $active = ($current === $item[1]) ? "active" : "";
            ?>
              <li class="nav-item">
                <a class="nav-link <?php echo $active; ?>" href="<?php echo $item[1]; ?>">
                  <?php echo htmlspecialchars($item[0]); ?>
                </a>
              </li>
            <?php endforeach; ?>

            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle <?php echo ($current === 'organizing_committee.php' || $current === 'scientific_committee.php') ? 'active' : ''; ?>" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                Committees
              </a>
              <ul class="dropdown-menu dropdown-menu-end">
                <?php foreach ($nav_committees as $item): ?>
                  <li>
                    <a class="dropdown-item <?php echo ($current === $item[1]) ? 'active' : ''; ?>" href="<?php echo $item[1]; ?>">
                      <i class="bi bi-<?php echo $item[2]; ?> me-2" aria-hidden="true"></i><?php echo htmlspecialchars($item[0]); ?>
                    </a>
                  </li>
                <?php endforeach; ?>
              </ul>
            </li>

            <li class="nav-item dropdown">
              <a class="nav-link dropdown-toggle <?php echo ($current === 'fee.php' || $current === 'past_events.php' || $current === 'contact.php') ? 'active' : ''; ?>" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                More
              </a>
              <ul class="dropdown-menu dropdown-menu-end">
                <?php foreach ($nav_more as $item): ?>
                  <li>
                    <a class="dropdown-item <?php echo ($current === $item[1]) ? 'active' : ''; ?>" href="<?php echo $item[1]; ?>">
                      <i class="bi bi-<?php echo $item[2]; ?> me-2" aria-hidden="true"></i><?php echo htmlspecialchars($item[0]); ?>
                    </a>
                  </li>
                <?php endforeach; ?>
              </ul>
            </li>

          </ul>
        </div>

        <!-- Offcanvas for mobile -->
        <div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasNav" aria-labelledby="offcanvasNavLabel">
          <div class="offcanvas-header">
            <h5 class="offcanvas-title" id="offcanvasNavLabel">TIM 2026 Menu</h5>
            <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
          </div>
          <div class="offcanvas-body">
            <div class="list-group list-group-flush">
              <?php foreach ($nav as $item):
                $active = ($current === $item[1]) ? "active" : "";
              ?>
                <a class="list-group-item list-group-item-action text-bg-dark <?php echo $active; ?>"
                   href="<?php echo $item[1]; ?>">
                  <i class="bi bi-<?php echo $item[2]; ?> me-2" aria-hidden="true"></i>
                  <?php echo htmlspecialchars($item[0]); ?>
                </a>
              <?php endforeach; ?>
            </div>
          </div>
        </div>

      </div>
    </nav>

    <div class="tim-hero">
      <div class="container-xxl py-3">
        <div class="row align-items-center g-3">
          <div class="col-lg-8">
            <div class="d-flex align-items-start gap-3">
              <img src="images/w-banner_tim26.png" class="tim-hero-banner" alt="TIM 2026 conference banner" loading="lazy">
              <div>
                <div class="tim-hero-kicker">West University of Timișoara • Faculty of Physics</div>
                <h1 class="h3 mb-1 tim-hero-title"><?php echo htmlspecialchars($page_title); ?></h1>
                <p class="mb-0 tim-hero-note">Conference website refreshed for 2026 — streamlined navigation, mobile-first layout, and improved accessibility.</p>
              </div>
            </div>
          </div>
          <div class="col-lg-4">
            <div class="tim-hero-cta">
              <div class="small text-white-50">Quick links</div>
              <div class="d-flex flex-wrap gap-2 mt-2">
                <a class="btn btn-sm btn-light" href="registration_form.php"><i class="bi bi-pencil-square me-1"></i>Register</a>
                <a class="btn btn-sm btn-outline-light" href="abstract_submission.php"><i class="bi bi-file-earmark-text me-1"></i>Abstracts</a>
                <a class="btn btn-sm btn-outline-light" href="program.php"><i class="bi bi-calendar-event me-1"></i>Program</a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </header>

  <main class="container-xxl py-4">
    <div class="row g-4">

      <aside class="col-lg-3">
        <div class="card tim-card sticky-lg-top tim-sidebar">
          <div class="card-body">
            <div class="d-flex align-items-center justify-content-between mb-2">
              <div class="fw-semibold">Navigation</div>
              <span class="badge text-bg-primary">2026</span>
            </div>
            <div class="list-group list-group-flush">
              <?php foreach ($nav as $item):
                $active = ($current === $item[1]) ? "active" : "";
              ?>
                <a class="list-group-item list-group-item-action <?php echo $active; ?>" href="<?php echo $item[1]; ?>">
                  <i class="bi bi-<?php echo $item[2]; ?> me-2" aria-hidden="true"></i>
                  <?php echo htmlspecialchars($item[0]); ?>
                </a>
              <?php endforeach; ?>
            </div>
          </div>
        </div>
      </aside>

      <section class="col-lg-6" id="content">
