{{define "layout"}}<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="color-scheme" content="light">
  <meta name="supported-color-schemes" content="light">
  <title>{{.AppName}}</title>
  <style>
    /* Reset */
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body { background-color: #f9fafb; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; font-size: 16px; line-height: 1.6; color: #374151; }

    /* Page wrapper */
    .email-wrapper { width: 100%; background-color: #f9fafb; padding: 32px 16px; }

    /* Card */
    .email-card { max-width: 600px; margin: 0 auto; background-color: #ffffff; border-radius: 8px; border: 1px solid #e5e7eb; overflow: hidden; }

    /* Preheader — visually hidden but visible in inbox preview text */
    .preheader { display: none; max-height: 0; overflow: hidden; mso-hide: all; font-size: 1px; line-height: 1px; color: #f9fafb; opacity: 0; }

    /* Header */
    .email-header { padding: 24px 32px; border-bottom: 1px solid #e5e7eb; background-color: #ffffff; }
    .app-name { font-size: 20px; font-weight: 700; color: {{.PrimaryColor}}; text-decoration: none; letter-spacing: -0.01em; display: inline-block; }
    .app-logo { max-height: 36px; max-width: 160px; display: block; }

    /* Body */
    .email-body { padding: 40px 32px; }

    /* Typography */
    h1 { font-size: 24px; font-weight: 700; line-height: 1.3; color: #111827; margin-bottom: 12px; }
    h2 { font-size: 20px; font-weight: 600; line-height: 1.4; color: #111827; margin-bottom: 12px; }
    p { font-size: 16px; line-height: 1.6; color: #374151; margin-bottom: 16px; }
    p:last-child { margin-bottom: 0; }
    a { color: {{.PrimaryColor}}; text-decoration: underline; }
    .text-muted { color: #6b7280; font-size: 14px; }

    /* Divider */
    .divider { border: none; border-top: 1px solid #e5e7eb; margin: 28px 0; }

    /* OTP code box */
    .code-box { background-color: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 8px; padding: 24px; text-align: center; margin: 28px 0; }
    .code-box-value { font-family: 'Courier New', Courier, monospace; font-size: 48px; font-weight: 700; letter-spacing: 0.15em; color: #111827; display: block; line-height: 1; }

    /* CTA button */
    .btn-wrapper { margin: 28px 0; text-align: left; }
    .btn { display: inline-block; padding: 14px 28px; border-radius: 8px; font-size: 16px; font-weight: 600; text-decoration: none; text-align: center; line-height: 1.4; }
    .btn-primary { background-color: {{.PrimaryColor}}; color: #ffffff; }

    /* Footer */
    .email-footer { padding: 24px 32px; border-top: 1px solid #e5e7eb; background-color: #f9fafb; }
    .email-footer p { font-size: 14px; color: #6b7280; margin-bottom: 4px; line-height: 1.5; }
    .email-footer p:last-child { margin-bottom: 0; }
    .email-footer a { color: #6b7280; }

    /* Responsive */
    @media only screen and (max-width: 600px) {
      .email-wrapper { padding: 0; }
      .email-card { border-radius: 0; border-left: none; border-right: none; }
      .email-body { padding: 28px 20px; }
      .email-header { padding: 20px; }
      .email-footer { padding: 20px; }
      .code-box-value { font-size: 36px; }
    }
  </style>
</head>
<body>
  <div class="email-wrapper">
    <!-- Preheader: visible in inbox preview, invisible in email body -->
    <span class="preheader">{{.Preheader}}&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;</span>
    <div class="email-card">
      {{template "header" .}}
      <div class="email-body">
        {{template "body" .}}
      </div>
      {{template "footer" .}}
    </div>
  </div>
</body>
</html>
{{end}}
