<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>URL Shortened - Shorty</title>
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 15% 20%, rgba(99,102,241,.25), transparent 60%),
    radial-gradient(900px 500px at 85% 75%, rgba(34,197,94,.18), transparent 55%),
    linear-gradient(180deg, #070b14, #0b1220 35%, #070b14);
}

.container {
  width: 90%;
  max-width: 600px;
  text-align: center;
}

h1 {
  font-size: 2rem;
  margin-bottom: 2rem;
}

.url-box {
  padding: 1.5rem;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.short-url {
  font-size: 1.3rem;
  font-weight: bold;
  word-break: break-all;
}

button {
  padding: 1rem;
  font-size: 1.1rem;
  background: linear-gradient(135deg, rgba(99,102,241,.95), rgba(34,197,94,.75));
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

button:hover{
  filter: brightness(1.06);
  box-shadow: 0 16px 42px rgba(0,0,0,.42);
}

.back-link {
  display: inline-block;
  margin-top: 2rem;
  color: cyan;
  text-decoration: none;
}

.back-link:hover {
  color: #1E90FF;
}
</style>
</head>
<body>
<div class="container">
  <div class="url-box">
    <div class="short-url" id="shortUrl">{{ url_root }}{{ short_id }}</div>
  </div>
    <button class="copy-btn" onclick="copyUrl()">Copy Link</button>
  <br>
  <a href="/" class="back-link">← Shorten another</a>
</div>

<script>
function copyUrl() {
  const url = document.getElementById('shortUrl').textContent;
  navigator.clipboard.writeText(url).then(() => {
    const btn = document.querySelector('.copy-btn');
    btn.textContent = 'Copied!';
    setTimeout(() => btn.textContent = 'Copy Link', 2000);
  });
}
</script>
</body>
</html>
