/* public_html/assets/layout.css : semua gaya global dalam satu file */

:root {
  --bg: #ffffff; --fg: #1a1a1a; --muted: #666666; --line: #e5e5e5;
  --accent: #2563eb; --accent-fg: #ffffff; --header-h: 60px;
  color-scheme: light;
}
html.dark-theme {
  --bg: #111111; --fg: #eeeeee; --muted: #aaaaaa; --line: #2a2a2a;
  --accent: #60a5fa; --accent-fg: #111111;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; padding-top: var(--header-h);   /* ruang untuk header tetap: tidak ada lompatan layout */
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 24px 16px; }
a { color: var(--accent); }
img { max-width: 100%; height: auto; }

.btn, button.btn {
  display: inline-block; padding: 10px 18px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-fg); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }

/* Header */
#site-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 100;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
#site-header .wrap {
  height: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
}
#site-header .brand { font-weight: 700; font-size: 18px; color: var(--fg); text-decoration: none; }
#site-nav { display: flex; align-items: center; gap: 4px; }
#site-nav a, #site-nav button {
  padding: 8px 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--fg); font: inherit; text-decoration: none; cursor: pointer;
}
#site-nav a:hover, #site-nav button:hover { background: var(--line); }
#site-nav a.active { font-weight: 700; color: var(--accent); }
#menu-toggle { display: none; border: 0; background: transparent; color: var(--fg); font-size: 22px; padding: 6px 10px; cursor: pointer; }

@media (max-width: 640px) {
  #menu-toggle { display: block; }
  #site-nav {
    display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; padding: 8px 16px 12px;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  #site-nav.open { display: flex; }
}

/* Footer */
#site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
#site-footer .wrap {
  max-width: 960px; margin: 0 auto; padding: 20px 16px;
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
}
#site-footer a, #site-footer button { color: var(--muted); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

/* Banner cookies */
#cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200; max-width: 560px; margin: 0 auto;
  padding: 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--fg); box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
#cookie-banner p { margin: 0 0 12px; font-size: 14px; }
#cookie-banner .row { display: flex; gap: 8px; justify-content: flex-end; }

/* Banner cookies dikendalikan CSS dari atribut data-consent di <html> (disuntik server): tanpa kedip */
#cookie-banner { display: none; }
html[data-consent="pending"] #cookie-banner { display: block; }

/* Formulir */
.form { display: flex; flex-direction: column; gap: 6px; max-width: 480px; }
.form label { font-weight: 600; margin-top: 10px; }
.form input, .form select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); font: inherit;
}
.form .btn { margin-top: 16px; align-self: flex-start; }
.form small { color: var(--muted); }
.error { color: #dc2626; }
small.error { color: #dc2626; }
#site-nav form { margin: 0; display: flex; }

/* Atribut hidden harus menang atas display:flex milik .form */
[hidden] { display: none !important; }

/* Halaman tamu */
.guest-wrap { max-width: 420px; margin: 0 auto; text-align: center; }
.guest-wrap .form { text-align: left; margin: 0 auto; }

/* Kamera tamu */
.muted { color: var(--muted); font-size: 14px; }
.cam { position: relative; width: 100%; max-width: 480px; margin: 12px auto; background: #000; border-radius: 12px; overflow: hidden; line-height: 0; }
.cam video { width: 100%; height: auto; display: block; min-height: 200px; }
.cam video.mirror { transform: scaleX(-1); }
.cam .vig, .cam .flash { position: absolute; inset: 0; pointer-events: none; }
.cam .flash { background: #fff; opacity: 0; transition: opacity .15s; }
.cam .flash.on { opacity: .85; transition: none; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 480px; margin: 0 auto; }
.cam-bar > * { flex: 1; }
.cam-bar .btn { flex: 0 0 auto; }
.shutter { flex: 0 0 72px !important; width: 72px; height: 72px; border-radius: 50%; border: 4px solid var(--fg); background: var(--bg); box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 40px var(--fg); cursor: pointer; }
.shutter:disabled { opacity: .35; cursor: not-allowed; }
.shutter:active:not(:disabled) { transform: scale(.94); }

/* Galeri */
.gallery-wrap { max-width: 960px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.grid a { display: block; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 6px; background: var(--line); }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; gap: 8px; }

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.93); display: none; flex-direction: column; align-items: center; justify-content: center; padding: 12px; }
.lb img { max-width: 100%; max-height: 78vh; object-fit: contain; }
.lb-cap { color: #ddd; margin: 10px 0; min-height: 1.4em; font-size: 14px; }
.lb-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lb-bar .btn { background: #222; color: #fff; border-color: #444; }

/* Dasbor */
.notice { padding: 10px 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; }
.cards { display: grid; gap: 10px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg); text-decoration: none; }
.card:hover { border-color: var(--accent); }
.card small { color: var(--muted); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--line); font-size: 12px; font-weight: 600; vertical-align: middle; }
.btn.sm { padding: 6px 12px; font-size: 14px; }
.btn.danger, button.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.ghost.danger { background: transparent; color: #dc2626; border: 1px solid #dc2626; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pcard { display: flex; flex-direction: column; gap: 4px; }
.pcard a { display: block; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 8px; background: var(--line); }
.pcard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard.dim img { opacity: .35; }
.pcard small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbtn { display: flex; gap: 4px; flex-wrap: wrap; }
.pbtn form { margin: 0; }

/* QR dan tabel tamu */
#qr { display: inline-block; background: #fff; padding: 12px; border-radius: 8px; line-height: 0; }
#qr img, #qr canvas { width: 220px; height: 220px; max-width: 100%; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl tr.dim td { opacity: .6; }
.tbl form { margin: 0; }

/* Laporan foto */
.chip.warn { background: #fde68a; color: #7c2d12; }
.lb-panel { display: none; flex-direction: column; gap: 8px; width: 100%; max-width: 360px; margin: 6px 0 10px; }
.lb-panel select, .lb-panel textarea { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #444; background: #1c1c1c; color: #fff; font: inherit; }
.lb-panel textarea { min-height: 70px; resize: vertical; }
.lb-msg { color: #ddd; font-size: 14px; min-height: 1.2em; }

/* Halaman hukum */
.legal { max-width: 760px; }
.legal h2 { margin-top: 28px; }
.legal table { border-collapse: collapse; width: 100%; font-size: 15px; }
.legal th, .legal td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }