<?php
// email_admin.php - Complete Admin Page with PHP Integration
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}
require_once 'php/adminconfig.php';

// Check if admin is logged in (adjust based on your auth system)
 if (!isset($_SESSION['admin_id'])) {
     header('Location: admin-login.php');
     exit;
 }
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9, user-scalable=no">
    <title>TradeWave PLC - Admin-MAILing</title>
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <!-- Chart.js -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js"></script>
    <!-- ApexCharts -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/apexcharts/3.36.3/apexcharts.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/admin.css">
    <style>
    body {
      margin: 0 !important;
      padding: 0 !important;
      font-family: sans-serif;
      color: #888 !important;
    }

    /* Sticky navbar after some scroll */
    .navbar {
      position: sticky;
      top: 20px;
      background: #f5f5f5;
      padding: 10px;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px;
      z-index: 10;
    }

    .navbar button {
      margin-right: 10px;
      padding: 8px 15px;
      cursor: pointer;
      font-weight: bold;
      border-radius: 20px;
    }

    /* Hide all sections by default */
    .section {
      display: none;
      min-height: 300px;
      color: white;
      font-size: 24px;
    }

    /* Visible section */
    .section.active {
      display: block;
    }

    
  </style>
</head>
<body>

    <?php include "required/admin-nav.php" ?>
<div class="pc">

  <!-- Sticky Nav Buttons -->
  <div class="navbar">
    <button data-section="section1">Customized Mail</button>
    <button data-section="section2">Alert Mails</button>
    <button data-section="section3">AML Tariff Billing</button>
    <button data-section="section4">Email Logs</button>
  </div>

  <!-- Sections -->
  <div id="section1" class="section active">
      
      <?php include "email_admin.php" ?>
  </div>
  <div id="section2" class="section" style="padding: 10px;">
      <?php include "email.php" ?>
  </div>
  <div id="section3" class="section">
      <?php include "billing.php" ?>
  </div>
  <div id="section4" class="section" style="padding: 10px;">
      <?php include "email_logs.php" ?>
  </div>

  <script>
    const buttons = document.querySelectorAll('.navbar button');
    const sections = document.querySelectorAll('.section');

    buttons.forEach(button => {
      button.addEventListener('click', () => {
        const target = button.getAttribute('data-section');

        // Hide all sections
        sections.forEach(section => section.classList.remove('active'));

        // Show selected section
        document.getElementById(target).classList.add('active');
      });
    });
  </script>
</div>
</body>
</html>