<script setup lang="ts">
interface PasswordResetEmailProps {
  name?: string
  url?: string
  appName?: string
}

withDefaults(defineProps<PasswordResetEmailProps>(), {
  name: '',
  url: '',
  appName: 'Harmonic SaaS'
})

const main = {
  backgroundColor: '#ffffff',
  fontFamily:
    'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"'
}

const container = {
  paddingLeft: '16px',
  paddingRight: '16px',
  margin: '0 auto',
  maxWidth: '600px'
}

const contentBox = {
  backgroundColor: '#fafafa',
  borderRadius: '12px',
  padding: '32px',
  marginBottom: '24px',
  border: '1px solid #e5e5e5'
}

const heading = {
  color: '#09090b',
  margin: '0 0 24px 0',
  fontSize: '28px',
  fontWeight: '700',
  letterSpacing: '-0.025em'
}

const text = {
  margin: '0 0 16px 0',
  fontSize: '16px',
  color: '#52525b',
  lineHeight: '1.75'
}

const buttonContainer = {
  textAlign: 'center' as const,
  margin: '32px 0'
}

const button = {
  backgroundColor: '#16a34a',
  color: '#ffffff',
  padding: '12px 24px',
  textDecoration: 'none',
  borderRadius: '8px',
  fontWeight: '600',
  display: 'inline-block',
  fontSize: '15px'
}

const linkText = {
  margin: '24px 0 0 0',
  fontSize: '14px',
  color: '#71717a'
}

const urlText = {
  margin: '12px 0 0 0',
  fontSize: '13px',
  color: '#16a34a',
  wordBreak: 'break-all' as const,
  fontFamily: 'ui-monospace, monospace'
}

const warningText = {
  margin: '24px 0 0 0',
  fontSize: '14px',
  color: '#71717a'
}

const footer = {
  fontSize: '13px',
  color: '#a1a1aa',
  textAlign: 'center' as const,
  margin: '24px 0 0 0'
}
</script>

<template>
  <EHtml>
    <EHead />
    <EPreview>Reset your {{ appName }} password</EPreview>
    <EBody :style="main">
      <EContainer :style="container">
        <ESection :style="contentBox">
          <EHeading :style="heading">
            Reset Your Password
          </EHeading>
          <EText :style="text">
            Hi {{ name }},
          </EText>
          <EText :style="text">
            We received a request to reset your password. Click the button below to create a new password:
          </EText>
          <ESection :style="buttonContainer">
            <EButton
              :href="url"
              :style="button"
            >
              Reset Password
            </EButton>
          </ESection>
          <EText :style="linkText">
            Or copy and paste this link into your browser:
          </EText>
          <EText :style="urlText">
            {{ url }}
          </EText>
          <EText :style="warningText">
            This link will expire in 1 hour for security reasons.
          </EText>
        </ESection>
        <EText :style="footer">
          If you didn't request a password reset, you can safely ignore this email. Your password won't be changed.
        </EText>
      </EContainer>
    </EBody>
  </EHtml>
</template>
