<?php
session_start();
require_once 'config.php';

// Get school information if user is logged in
$school_name = "School";
$school_logo = "default_school_logo.php";

if (isset($_SESSION["school_id"])) {
    $school_id = $_SESSION["school_id"];
    
    $sql = "SELECT school_name, logo FROM schools WHERE school_id = ?";
    if ($stmt = $conn->prepare($sql)) {
        $stmt->bind_param("i", $school_id);
        if ($stmt->execute()) {
            $stmt->bind_result($name, $logo);
            if ($stmt->fetch()) {
                $school_name = htmlspecialchars($name);
                $school_logo = !empty($logo) ? htmlspecialchars($logo) : $school_logo;
            }
        }
        $stmt->close();
    }
}

$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Subscription Suspended - <?php echo $school_name; ?></title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .suspension-container {
            background: white;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            max-width: 600px;
            width: 100%;
            padding: 50px 40px;
            text-align: center;
            animation: slideIn 0.5s ease-out;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .school-logo {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            object-fit: cover;
            margin: 0 auto 20px;
            border: 4px solid #f0f0f0;
        }

        .icon-warning {
            font-size: 80px;
            color: #ef4444;
            margin-bottom: 20px;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0%, 100% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.1);
            }
        }

        h1 {
            color: #1f2937;
            font-size: 2.5em;
            margin-bottom: 15px;
            font-weight: 700;
        }

        h2 {
            color: #4b5563;
            font-size: 1.3em;
            margin-bottom: 30px;
            font-weight: 400;
        }

        .message-box {
            background: #fef2f2;
            border-left: 4px solid #ef4444;
            padding: 20px;
            border-radius: 8px;
            margin: 30px 0;
            text-align: left;
        }

        .message-box h3 {
            color: #991b1b;
            font-size: 1.1em;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .message-box p {
            color: #7f1d1d;
            line-height: 1.6;
            margin-bottom: 10px;
        }

        .message-box ul {
            color: #7f1d1d;
            margin-left: 20px;
            line-height: 1.8;
        }

        .contact-info {
            background: #f9fafb;
            padding: 25px;
            border-radius: 12px;
            margin-top: 30px;
        }

        .contact-info h3 {
            color: #1f2937;
            margin-bottom: 15px;
            font-size: 1.2em;
        }

        .contact-item {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            margin: 10px 0;
            color: #4b5563;
            font-size: 1.1em;
        }

        .contact-item i {
            color: #667eea;
            font-size: 1.2em;
        }

        .btn-logout {
            display: inline-block;
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white;
            padding: 15px 40px;
            border-radius: 10px;
            text-decoration: none;
            font-weight: 600;
            font-size: 1.1em;
            margin-top: 20px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
        }

        .btn-logout:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
        }

        @media (max-width: 600px) {
            .suspension-container {
                padding: 30px 20px;
            }

            h1 {
                font-size: 2em;
            }

            h2 {
                font-size: 1.1em;
            }

            .icon-warning {
                font-size: 60px;
            }
        }
    </style>
</head>
<body>
    <div class="suspension-container">
        <img src="<?php echo $school_logo; ?>" alt="<?php echo $school_name; ?> Logo" class="school-logo">
        
        <div class="icon-warning">
            <i class="fas fa-exclamation-triangle"></i>
        </div>

        <h1>Subscription Suspended</h1>
        <h2><?php echo $school_name; ?></h2>

        <div class="message-box">
            <h3>
                <i class="fas fa-info-circle"></i>
                Account Access Restricted
            </h3>
            <p><strong>Your school's subscription has expired and your account has been automatically suspended.</strong></p>
            <p>To restore access to the Divine Reports system, you need to:</p>
            <ul>
                <li>Contact our support team to renew your subscription</li>
                <li>Make the necessary payment for subscription renewal</li>
                <li>Wait for account reactivation by our administrators</li>
            </ul>
        </div>

        <div class="contact-info">
            <h3><i class="fas fa-headset"></i> Contact Support</h3>
            <div class="contact-item">
                <i class="fas fa-phone"></i>
                <span>+256 XXX XXX XXX</span>
            </div>
            <div class="contact-item">
                <i class="fas fa-envelope"></i>
                <span>support@divinereports.com</span>
            </div>
            <div class="contact-item">
                <i class="fas fa-globe"></i>
                <span>www.divinereports.com</span>
            </div>
        </div>

        <a href="logout.php" class="btn-logout">
            <i class="fas fa-sign-out-alt"></i> Logout
        </a>
    </div>
</body>
</html>