<?php
// Mock of Menlo SafeDocs dl_status iframe.
// Displays the file scan status toolbar as seen inside Menlo's #download_monitor iframe.
$filename = isset($_GET['filename']) ? htmlspecialchars($_GET['filename']) : "IT-116_2026050716_45_34363617.csv";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Menlo Document Viewer (Mock)</title>
<style>
   html, body {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
      font-size: 13px;
      background: #e9ecef;
      overflow: auto;
   }
   .toolbar {
      background: #212529;
      color: #fff;
      padding: 6px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      box-shadow: 0 2px 4px rgba(0,0,0,0.2);
   }
   .toolbar-status {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      color: #20c997;
   }
   .badge-clean {
      background: #198754;
      color: #fff;
      padding: 2px 6px;
      border-radius: 3px;
      font-weight: bold;
      font-size: 11px;
   }
   .btn-download {
      background: #0d6efd;
      color: #fff;
      border: none;
      padding: 4px 10px;
      border-radius: 4px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 500;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      gap: 4px;
   }
   .btn-download:hover {
      background: #0b5ed7;
   }
   .preview-area {
      padding: 12px;
      background: #fff;
      margin: 8px;
      border-radius: 4px;
      border: 1px solid #ced4da;
      font-size: 11px;
   }
   .preview-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 11px;
   }
   .preview-table th, .preview-table td {
      border: 1px solid #dee2e6;
      padding: 4px 6px;
      text-align: left;
   }
   .preview-table th {
      background: #f8f9fa;
   }
   .viewport-warning {
      background: #fff3cd;
      color: #664d03;
      padding: 4px 8px;
      font-size: 11px;
      border-bottom: 1px solid #ffe69c;
   }
</style>
</head>
<body>
<div class="viewport-warning">
   ⚠️ Menlo Document Viewer in iframe (Notice how cramped this is in default 300&times;150 viewport!)
</div>
<div class="toolbar">
   <div class="toolbar-status">
      <span class="badge-clean">&#10004; CLEAN</span>
      <span>コンテンツのスキャン完了 (Scan completed)</span>
   </div>
   <a class="btn-download" href="gifocus_create_csv.php?mode=csv" download="<?= $filename ?>">
      &#11123; Download Original
   </a>
</div>
<div class="preview-area">
   <strong>File:</strong> <?= $filename ?><br>
   <table class="preview-table">
      <thead>
         <tr><th>ID</th><th>Name</th><th>Location</th><th>Updated</th></tr>
      </thead>
      <tbody>
         <tr><td>IT-116-0001</td><td>Hub 1</td><td>Tokyo 1</td><td>2026/05/07</td></tr>
         <tr><td>IT-116-0002</td><td>Hub 2</td><td>Tokyo 2</td><td>2026/05/07</td></tr>
      </tbody>
   </table>
</div>
</body>
</html>
