package main

import "strings"

const SharedCSS = `
  :root { color-scheme: dark; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1e1e1e; color: #ddd;
    margin: 0; padding: 0;
  }
  .topbar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; background: #252526; border-bottom: 1px solid #333;
    font-size: 13px;
  }
  .topbar a { color: #9cdcfe; text-decoration: none; padding: 4px 10px; border-radius: 3px; }
  .topbar a:hover { background: #2a2d2e; }
  .topbar a.active { background: #094771; color: #fff; }
  .content { padding: 16px; max-width: 980px; margin: 0 auto; }
  h2 { margin-top: 0; font-weight: 500; }
  input[type=text], input[type=date], select, textarea {
    box-sizing: border-box; padding: 6px 8px;
    background: #3c3c3c; color: #ddd;
    border: 1px solid #3c3c3c; border-radius: 2px;
    font-family: inherit; font-size: 13px;
  }
  input[type=text]:focus, input[type=date]:focus, select:focus, textarea:focus {
    outline: 1px solid #007fd4; border-color: #007fd4;
  }
  button {
    background: #0e639c; color: #fff;
    border: none; padding: 6px 14px; border-radius: 2px; cursor: pointer; font-size: 13px;
  }
  button:hover { background: #1177bb; }
  button.secondary { background: #3a3d41; color: #ddd; }
  button.secondary:hover { background: #45494e; }
  button:disabled { opacity: 0.5; cursor: not-allowed; }
  .err { color: #f48771; white-space: pre-wrap; }
  .ok { color: #89d185; }
  .hint { font-size: 12px; opacity: 0.7; }
`

type navItem struct{ Path, Label string }

var navItems = []navItem{
	{"/", "Home"},
	{"/plec", "PLEC Upload"},
	{"/applovin", "AppLovin Upload"},
	{"/base64", "Base64 Scanner"},
	{"/daily", "Daily Update"},
	{"/mobile", "Send To Mobile"},
}

func Page(activePath, title, body string) string {
	var tabs strings.Builder
	for _, n := range navItems {
		cls := ""
		if n.Path == activePath {
			cls = " class=\"active\""
		}
		tabs.WriteString(`<a href="` + n.Path + `"` + cls + `>` + n.Label + `</a>`)
	}
	return `<!DOCTYPE html>
<html><head>
<meta charset="UTF-8" />
<title>` + title + ` — HPL Toolbox</title>
<style>` + SharedCSS + `</style>
</head><body>
<div class="topbar">` + tabs.String() + `</div>
<div class="content">` + body + `</div>
</body></html>`
}
