<?php
if (session_status() === PHP_SESSION_NONE) { session_start(); }
require_once '../db_connect.php'; 

// Security Check
if (!isset($_SESSION['teacher_logged_in']) || $_SESSION['teacher_logged_in'] !== true) {
    header("Location: login.php");
    exit;
}
$current_page = str_replace('.php', '', basename($_SERVER['PHP_SELF']));
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Teacher Portal | Ahmad Academy</title>
    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        :root { --theme-green: #064e3b; --theme-dark: #022c22; --theme-gold: #d4af37; --bg-soft: #f8fafc; }
        body { font-family: 'Outfit', sans-serif; background-color: var(--bg-soft); overflow-x: hidden; }
        
        /* Sidebar Styling */
        .sidebar { width: 260px; height: 100vh; background: var(--theme-dark); position: fixed; left: 0; top: 0; z-index: 1000; transition: 0.4s; }
        .sidebar-header { border-bottom: 1px solid rgba(255,255,255,0.05); padding: 30px 20px; }
        .sidebar nav a { display: flex; align-items: center; padding: 12px 25px; color: rgba(255,255,255,0.7); text-decoration: none; transition: 0.3s; border-left: 4px solid transparent; margin-bottom: 5px; font-weight: 500; }
        .sidebar nav a i { width: 25px; margin-right: 12px; font-size: 18px; }
        .sidebar nav a:hover, .sidebar nav a.active { background: rgba(212, 175, 55, 0.1); color: var(--theme-gold); border-left-color: var(--theme-gold); }
        
        .main-content { margin-left: 260px; padding: 30px; transition: 0.4s; min-height: 100vh; }
        
        @media (max-width: 991px) {
            .sidebar { left: -260px; }
            .sidebar.mobile-show { left: 0; }
            .main-content { margin-left: 0; padding: 20px; }
        }

        .fade-up { animation: fadeInUp 0.5s ease-out forwards; }
        @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
    </style>
</head>
<body>