<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Teacher Multi-Step Form</title>
  <style>
    /* Base Page Style */
    .multi-body {
      font-family: Arial, sans-serif;
      margin: 0;
      padding: 0;
      background-color: #f4f4f4;
      height: 100vh;
      width: 100vw;
      overflow-x: hidden;
    }

    /* Form Container */
    .multi-form-container {
      width: 100%;
      height: 100%;
      max-width: 1200px;
      margin: 0 auto;
      padding: 20px;
      background-color: #ffffff;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
    }

    /* Steps Header */
    .multi-steps-container {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      margin-bottom: 20px;
    }

    .multi-step-box {
      text-align: center;
      flex: 1;
      min-width: 40px;
    }

    .multi-step {
      width: 30px;
      height: 30px;
      margin: 0 auto;
      border-radius: 50%;
      background-color: #ddd;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: bold;
      color: #333;
    }

    .multi-step.active {
      background-color: #4CAF50;
      color: #fff;
    }

    .multi-step.completed {
      background-color: #2196F3;
      color: #fff;
    }

    .multi-step-label {
      font-size: 12px;
      margin-top: 4px;
      color: #666;
    }

    /* Form Step Sections */
    .multi-form-step {
      display: none;
      flex-direction: column;
      align-items: center;
      width: 100%;
    }

    .multi-form-step.active {
      display: flex;
    }

    /* Buttons */
    .multi-btn {
      background-color: #4CAF50;
      color: #fff;
      padding: 10px 20px;
      margin: 10px 5px;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      font-size: 16px;
      font-weight: bold;
      transition: background-color 0.3s ease;
    }

    .multi-btn:hover {
      background-color: #45a049;
    }

    .multi-btn:disabled {
      background-color: #ccc;
      cursor: not-allowed;
    }

    /* Responsive */
    @media (max-width: 768px) {
      .multi-steps-container {
        flex-direction: column;
        align-items: center;
      }

      .multi-step-box {
        margin-bottom: 10px;
      }
    }
  </style>
</head>

<body class="multi-body">
  <div class="multi-form-container">
    <!-- Step Indicators -->
    <div class="multi-steps-container">
      <div class="multi-step-box">
        <div class="multi-step active" id="step1">1</div>
        <div class="multi-step-label">Profile</div>
      </div>
      <div class="multi-step-box">
        <div class="multi-step" id="step2">2</div>
        <div class="multi-step-label">Academic</div>
      </div>
      <div class="multi-step-box">
        <div class="multi-step" id="step3">3</div>
        <div class="multi-step-label">Professional</div>
      </div>
      <div class="multi-step-box">
        <div class="multi-step" id="step4">4</div>
        <div class="multi-step-label">Training</div>
      </div>
      <div class="multi-step-box">
        <div class="multi-step" id="step5">5</div>
        <div class="multi-step-label">Subjects</div>
      </div>
      <div class="multi-step-box">
        <div class="multi-step" id="step6">6</div>
        <div class="multi-step-label">Promotion</div>
      </div>
      <div class="multi-step-box">
        <div class="multi-step" id="step7">7</div>
        <div class="multi-step-label">Transfer</div>
      </div>
    </div>

    <!-- Multi-Step Form -->
    <form id="multiStepForm" action="teacher_multi_save.php" method="POST">
      <!-- Step 1 -->
      <div class="multi-form-step active" id="step-content-1">
        <?php require 'teacher_profile.php'; ?>
        <button type="button" class="multi-btn" onclick="nextStep(1)">Next</button>
      </div>

      <!-- Step 2 -->
      <div class="multi-form-step" id="step-content-2">
        <?php require 'teacher_qualification.php'; ?>
        <div>
          <button type="button" class="multi-btn" onclick="prevStep(2)">Back</button>
          <button type="button" class="multi-btn" onclick="nextStep(2)">Next</button>
        </div>
      </div>

      <!-- Step 3 -->
      <div class="multi-form-step" id="step-content-3">
        <?php require 'teacher_pro_qualification.php'; ?>
        <div>
          <button type="button" class="multi-btn" onclick="prevStep(3)">Back</button>
          <button type="button" class="multi-btn" onclick="nextStep(3)">Next</button>
        </div>
      </div>

      <!-- Step 4 -->
      <div class="multi-form-step" id="step-content-4">
        <?php require 'teacher_training.php'; ?>
        <div>
          <button type="button" class="multi-btn" onclick="prevStep(4)">Back</button>
          <button type="button" class="multi-btn" onclick="nextStep(4)">Next</button>
        </div>
      </div>

      <!-- Step 5 -->
      <div class="multi-form-step" id="step-content-5">
        <?php require 'teacher_subject.php'; ?>
        <div>
          <button type="button" class="multi-btn" onclick="prevStep(5)">Back</button>
          <button type="button" class="multi-btn" onclick="nextStep(5)">Next</button>
        </div>
      </div>

      <!-- Step 6 -->
      <div class="multi-form-step" id="step-content-6">
        <?php require 'teacher_promotion.php'; ?>
        <div>
          <button type="button" class="multi-btn" onclick="prevStep(6)">Back</button>
          <button type="button" class="multi-btn" onclick="nextStep(6)">Next</button>
        </div>
      </div>

      <!-- Step 7 -->
      <div class="multi-form-step" id="step-content-7">
        <?php require 'teacher_transfer.php'; ?>
        <div>
          <button type="button" class="multi-btn" onclick="prevStep(7)">Back</button>
          <button type="submit" class="multi-btn" name="submit_step_7">Submit</button>
        </div>
      </div>
    </form>
  </div>

  <!-- JavaScript to Handle Step Navigation -->
  <script>
    let currentStep = 1;

    function showStep(step) {
      document.getElementById(`step-content-${currentStep}`).classList.remove('active');
      document.getElementById(`step${currentStep}`).classList.remove('active');

      if (step > currentStep) {
        document.getElementById(`step${currentStep}`).classList.add('completed');
      }

      document.getElementById(`step-content-${step}`).classList.add('active');
      document.getElementById(`step${step}`).classList.add('active');

      currentStep = step;
    }

    function nextStep(step) {
      showStep(step + 1);
    }

    function prevStep(step) {
      showStep(step - 1);
    }
  </script>
</body>
</html>
