<?php
session_start();

require_once __DIR__ . "/Auth/db.php";

$stmt = $pdo->query("
    SELECT maintenance_mode
    FROM site_settings
    WHERE id = 1
");

$settings = $stmt->fetch(PDO::FETCH_ASSOC);

if (empty($settings["maintenance_mode"])) {
    header("Location: Index.php");
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Maintenance - Rewire</title>

<link rel="icon" type="image/png" href="Assets/Logo.png">

<style>
*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Inter, Arial, sans-serif;
}

body{
    min-height:100vh;

    display:flex;
    align-items:center;
    justify-content:center;

    background:
        radial-gradient(circle at top, rgba(0,194,255,0.16), transparent 35%),
        radial-gradient(circle at bottom, rgba(0,194,255,0.08), transparent 30%),
        #020406;

    overflow:hidden;

    color:white;

    padding:40px;
}

/* BACKGROUND GLOW */

body::before{
    content:"";

    position:fixed;
    inset:0;

    background:
        radial-gradient(circle at center,
        rgba(0,194,255,0.12),
        transparent 55%);

    filter:blur(80px);

    z-index:0;
}

.maintenance-wrapper{
    position:relative;
    z-index:2;

    width:100%;
    max-width:620px;
}

.maintenance-card{
    position:relative;

    background:
        linear-gradient(
            180deg,
            rgba(8,12,16,0.98),
            rgba(3,6,8,0.99)
        );

    border:1px solid rgba(0,194,255,0.12);

    border-radius:28px;

    padding:70px 55px;

    text-align:center;

    overflow:hidden;

    box-shadow:
        0 0 120px rgba(0,194,255,0.10),
        0 20px 60px rgba(0,0,0,0.65);
}

/* INNER GLOW */

.maintenance-card::before{
    content:"";

    position:absolute;
    inset:-2px;

    background:
        linear-gradient(
            135deg,
            rgba(0,194,255,0.15),
            transparent,
            rgba(0,194,255,0.08)
        );

    opacity:0.6;

    z-index:-1;
}

/* LOGO */

.logo{
    width:140px;

    margin-bottom:36px;

    filter:
        drop-shadow(0 0 30px rgba(0,194,255,0.18));
}

/* STATUS */

.status{
    display:flex;
    align-items:center;
    justify-content:center;

    width:fit-content;

    gap:10px;

    padding:12px 22px;

    border-radius:999px;

    background:rgba(255,170,0,0.10);

    border:1px solid rgba(255,170,0,0.22);

    color:#ffcc66;

    font-size:0.82rem;
    font-weight:800;
    letter-spacing:0.5px;

    margin:0 auto 34px auto;
}

.status-dot{
    width:10px;
    height:10px;

    border-radius:50%;

    background:#ffb100;

    box-shadow:
        0 0 12px #ffb100,
        0 0 22px #ffb100;
}

/* TITLE */

h1{
    font-size:4.8rem;
    font-weight:900;

    line-height:0.95;

    margin-bottom:26px;

    letter-spacing:-4px;
}

/* TEXT */

p{
    color:#8e99a5;

    font-size:1.08rem;
    line-height:1.9;

    max-width:480px;

    margin:0 auto;
}

/* FOOTER */

.footer{
    margin-top:50px;

    color:#62707d;
    font-size:0.85rem;
}

/* MOBILE */

@media(max-width:768px){

    .maintenance-card{
        padding:55px 30px;
        border-radius:24px;
    }

    h1{
        font-size:2.8rem;
        line-height:1.1;
    }

    p{
        font-size:1rem;
        line-height:1.7;
    }

    .logo{
        width:82px;
        display:block;
        margin:0 auto 28px auto;
        filter:
            drop-shadow(0 0 24px rgba(0,194,255,0.18));
    }
}
</style>
</head>
<body>
<?php include "Preloader.php"; ?>
<div class="maintenance-wrapper">
    <div class="maintenance-card">
        <img
            src="Assets/Logo.png"
            alt="Rewire"
            class="logo"
        >
        <div class="status">
            <span class="status-dot"></span>
            MAINTENANCE MODE ENABLED
        </div>

        <h1>
            We'll Be Back Soon
        </h1>

        <p>
            Rewire is currently undergoing scheduled maintenance and upgrades.
            We're working hard to improve your experience and will be back online shortly.
        </p>
    </div>
</div>
<script src="Security.js"></script>
</body>
</html>