<?php
// Eenvoudige admin-layout (los van publieke header.php).
require_once __DIR__ . '/_auth.php';
$admin_title = $admin_title ?? 'Admin';
?><!doctype html>
<html lang="nl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title><?= e($admin_title) ?> · Admin · <?= e(SITE_NAME) ?></title>
<meta name="robots" content="noindex,nofollow">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght@500;600&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<style>
  *{box-sizing:border-box;margin:0;padding:0}
  body{font-family:'Inter',system-ui,sans-serif;background:#1a201c;color:#ece2cb;font-size:14px;line-height:1.6;min-height:100vh}
  a{color:#c97e3f;text-decoration:none}a:hover{text-decoration:underline}
  .topbar{background:#0f1411;padding:14px 28px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid rgba(236,226,203,.1)}
  .topbar .brand{font-family:'Lora',serif;font-size:20px;font-weight:600}
  .topbar .brand small{font-size:11px;letter-spacing:.25em;text-transform:uppercase;color:#c97e3f;margin-left:10px;font-family:'Inter',sans-serif;font-weight:500}
  .topbar nav{display:flex;gap:20px;align-items:center}
  .topbar nav a{font-size:12px;letter-spacing:.18em;text-transform:uppercase;color:rgba(236,226,203,.85)}
  .container{max-width:1100px;margin:0 auto;padding:36px 28px}
  h1{font-family:'Lora',serif;font-weight:600;font-size:30px;margin-bottom:8px}
  h1 small{font-size:13px;font-weight:400;color:rgba(236,226,203,.6);margin-left:14px;letter-spacing:.05em}
  .lede{color:rgba(236,226,203,.7);margin-bottom:28px}
  .panel{background:#222926;border:1px solid rgba(236,226,203,.1);padding:28px;margin-bottom:24px}
  .panel h2{font-family:'Lora',serif;font-size:20px;margin-bottom:16px}
  .row{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:14px}
  label{display:block;font-size:11px;letter-spacing:.2em;text-transform:uppercase;color:rgba(236,226,203,.65);margin-bottom:6px}
  input,textarea,select{
    width:100%;padding:10px 12px;font:inherit;font-size:14px;
    background:#0f1411;border:1px solid rgba(236,226,203,.18);color:#ece2cb;border-radius:2px
  }
  input:focus,textarea:focus,select:focus{outline:none;border-color:#c97e3f}
  textarea{min-height:110px;resize:vertical;font-family:inherit}
  .field{margin-bottom:14px}
  .btn{display:inline-block;padding:10px 22px;font-size:11px;letter-spacing:.22em;text-transform:uppercase;font-weight:500;cursor:pointer;background:#c97e3f;color:#0f1411;border:none;border-radius:2px}
  .btn:hover{background:#b95a1f;color:#fff}
  .btn-ghost{background:transparent;color:#ece2cb;border:1px solid rgba(236,226,203,.3)}
  .btn-ghost:hover{border-color:#c97e3f;color:#c97e3f;background:transparent}
  .btn-danger{background:transparent;color:#e08070;border:1px solid #a13131}
  .btn-danger:hover{background:#a13131;color:#fff}
  table{width:100%;border-collapse:collapse}
  th,td{padding:12px 14px;text-align:left;border-bottom:1px solid rgba(236,226,203,.1);vertical-align:top}
  th{font-size:11px;letter-spacing:.18em;text-transform:uppercase;color:rgba(236,226,203,.6);font-weight:500;background:#0f1411}
  td .name{font-family:'Lora',serif;font-size:17px;font-weight:500;color:#ece2cb}
  td .meta{color:rgba(236,226,203,.6);font-size:12px;margin-top:2px}
  .actions{display:flex;gap:8px}
  .flash{padding:12px 16px;margin-bottom:18px;font-size:14px;border-left:3px solid #c97e3f;background:#222926}
  .flash.error{border-left-color:#a13131;background:#3a1f1f;color:#f4c0b8}
  .img-list{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
  .img-list .item{position:relative}
  .img-list img{width:80px;height:80px;object-fit:cover;border:1px solid rgba(236,226,203,.15)}
  .img-list .rm{position:absolute;top:2px;right:2px;background:rgba(0,0,0,.7);color:#fff;border:none;width:22px;height:22px;font-size:14px;cursor:pointer;border-radius:50%}
  .img-list .rm:hover{background:#a13131}
  .empty-state{text-align:center;padding:60px 20px;color:rgba(236,226,203,.5)}
</style>
</head>
<body>

<div class="topbar">
  <div class="brand"><?= e(SITE_NAME) ?> <small>Admin</small></div>
  <?php if (admin_logged_in()): ?>
    <nav>
      <a href="te-koop.php">Te koop</a>
      <a href="../index.php" target="_blank">Site bekijken ↗</a>
      <a href="logout.php">Uitloggen</a>
    </nav>
  <?php endif; ?>
</div>

<main class="container">
