<!DOCTYPE html>
<html lang="vi">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Verify your email - SSO VietProDev</title>
  <style>
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f5f5; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
    .card { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.1); width: 100%; max-width: 520px; }
    .card h2 { margin-bottom: 8px; color: #1a1a2e; font-size: 24px; }
    .card p { margin-bottom: 16px; color: #444; font-size: 14px; line-height: 1.5; }
    .card p.subtitle { color: #666; }
    .icon { width: 64px; height: 64px; border-radius: 50%; background: #eef2ff; color: #4f46e5; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 32px; }
    .email-badge { background: #f3f4f6; padding: 8px 12px; border-radius: 8px; display: inline-block; font-family: monospace; color: #1f2937; margin: 4px 0; }
    .dev-block { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 12px 14px; border-radius: 8px; margin-top: 16px; font-size: 13px; word-break: break-all; }
    .dev-block a { color: #b45309; }
    .actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
    .actions button, .actions a.button { width: 100%; padding: 11px 12px; background: #4f46e5; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; transition: background 0.2s; }
    .actions button:hover, .actions a.button:hover { background: #4338ca; }
    .actions button.secondary { background: #fff; color: #4f46e5; border: 1px solid #c7d2fe; }
    .actions button.secondary:hover { background: #eef2ff; }
    .error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
    .footer { margin-top: 20px; text-align: center; font-size: 13px; color: #888; }
    .footer a { color: #4f46e5; text-decoration: none; }
  </style>
</head>
<body>
  <div class="card">
    <div class="icon">&#9993;</div>
    <h2>Verify your email</h2>
    <p>We've sent a verification link to <span class="email-badge">{{ email }}</span>.</p>
    <p class="subtitle">Open the link to activate your account and continue signing in to <strong>{{ client }}</strong>. The link expires in {{ ttlHours }} hours.</p>

    {{#if error}}<div class="error">{{ error }}</div>{{/if}}

    {{#if devVerifyUrl}}
      <div class="dev-block">
        <strong>Dev mode:</strong> email delivery is in fallback mode (logged to server console).
        Use this link to verify immediately:
        <br><br>
        <a href="{{ devVerifyUrl }}">{{ devVerifyUrl }}</a>
      </div>
    {{/if}}

    <div class="actions">
      <form method="POST" action="/oidc/interaction/{{ uid }}/resend-verification" style="margin:0;">
        <input type="hidden" name="_csrf" value="{{ csrfToken }}">
        <input type="hidden" name="email" value="{{ email }}">
        <button type="submit" class="secondary">Resend verification email</button>
      </form>
      <a class="button" href="/oidc/interaction/{{ uid }}">Back to sign in</a>
    </div>

    <div class="footer">
      Wrong email? <a href="/oidc/interaction/{{ uid }}/register">Register again</a>
    </div>
  </div>
</body>
</html>