<?php
/* ============================================================================
 *  company/module_soon.php — placeholder for an enabled-but-unbuilt module.
 *  Usage: module_soon.php?m=stock
 * ==========================================================================*/
session_start();
if (!isset($_SESSION["user_id"]) || $_SESSION["role"] !== "company_admin") {
    header("Location: ../auth/login.php"); exit;
}
require_once '../config/modules.php';

$mods = available_modules();
$key  = $_GET['m'] ?? '';
$m    = $mods[$key] ?? ['icon'=>'🚧','en'=>'Module','lo'=>'ໂມດູນ','desc_en'=>'','desc_lo'=>''];
?>
<!DOCTYPE html>
<html lang="lo">
<head>
    <?php $pwaTheme='#0f766e'; include __DIR__.'/../config/pwa_head.php'; ?>
    <title><?= htmlspecialchars($m['en']) ?></title>
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Lao:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <script src="../assets/lang.js" defer></script>
    <style>
        *,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}
        :root{--primary:#0f766e;--surface:#fff;--bg:#f0f4f8;--border:#e2e8f0;--text:#0f172a;--muted:#64748b;}
        body{font-family:"Noto Sans Lao","Inter",Arial,sans-serif;background:var(--bg);color:var(--text);min-height:100vh;}
        .top-bar{background:var(--surface);border-bottom:1px solid var(--border);
            padding:calc(12px + env(safe-area-inset-top,0px)) 18px 12px;display:flex;justify-content:space-between;
            align-items:center;gap:12px;position:sticky;top:0;z-index:100;box-shadow:0 1px 6px rgba(15,23,42,.06);}
        .back-link{background:#f1f5f9;color:var(--text);border:1.5px solid var(--border);padding:7px 13px;border-radius:8px;text-decoration:none;font-size:13px;font-weight:700;}
        .lang-bar{display:flex;gap:7px;}
        .lang-btn{padding:4px 11px;border-radius:999px;border:1.5px solid var(--border);background:var(--surface);font-size:11px;font-weight:700;color:var(--muted);cursor:pointer;font-family:inherit;}
        .lang-btn.active{background:var(--primary);border-color:var(--primary);color:#fff;}
        .wrap{max-width:520px;margin:auto;padding:40px 20px;text-align:center;}
        .card{background:var(--surface);border:1px solid var(--border);border-radius:20px;padding:44px 26px;box-shadow:0 2px 14px rgba(15,23,42,.09);margin-top:30px;}
        .ic{font-size:64px;margin-bottom:14px;}
        .ft{font-size:22px;font-weight:800;margin-bottom:8px;}
        .cs{display:inline-block;background:#fef3c7;color:#92400e;font-weight:800;font-size:13px;padding:5px 14px;border-radius:999px;margin-bottom:14px;}
        .msg{font-size:14px;color:var(--muted);line-height:1.6;margin-bottom:22px;}
        .btn{display:inline-flex;align-items:center;gap:8px;background:var(--primary);color:#fff;text-decoration:none;padding:13px 22px;border-radius:12px;font-weight:800;font-size:15px;}
    </style>
</head>
<body>

<div class="top-bar">
    <a class="back-link" href="dashboard.php">← <span data-lo="ກັບຄືນ" data-en="Back">Back</span></a>
    <div class="lang-bar">
        <button class="lang-btn" id="btn-lo" onclick="setLang('lo')">🇱🇦 ລາວ</button>
        <button class="lang-btn" id="btn-en" onclick="setLang('en')">🇬🇧 EN</button>
    </div>
</div>

<div class="wrap">
    <div class="card">
        <div class="ic"><?= $m['icon'] ?></div>
        <div class="ft" data-lo="<?= htmlspecialchars($m['lo']) ?>" data-en="<?= htmlspecialchars($m['en']) ?>"><?= htmlspecialchars($m['en']) ?></div>
        <div class="cs" data-lo="🚧 ກຳລັງພັດທະນາ" data-en="🚧 Coming soon">🚧 Coming soon</div>
        <div class="msg" data-lo="ໂມດູນນີ້ຖືກເປີດໃຊ້ໃຫ້ບໍລິສັດຂອງທ່ານ ແລະ ກຳລັງຖືກພັດທະນາ."
             data-en="This module is enabled for your company and is being built.">This module is enabled for your company and is being built.</div>
        <a class="btn" href="dashboard.php">← <span data-lo="ກັບໜ້າຫຼັກ" data-en="Back to dashboard">Back to dashboard</span></a>
    </div>
</div>

<?php require __DIR__ . '/../config/auto_update.php'; ?>
</body>
</html>