export const dynamic = 'force-dynamic'
import { redirect } from 'next/navigation'
import { cookies } from 'next/headers'
import { verifySessionToken } from '@/lib/admin-auth'
import PasswortAendern from '@/components/admin/PasswortAendern'

export default async function PasswortPage() {
  const cookieStore = await cookies()
  const token = cookieStore.get('admin_session')?.value
  const session = token ? await verifySessionToken(token) : null
  if (!session) redirect('/admin/login')

  return (
    <div style={{ padding: '32px', maxWidth: '600px' }}>
      <h1 style={{ fontSize: '20px', fontWeight: 800, color: 'var(--text-primary)', marginBottom: '8px' }}>
        Passwort ändern
      </h1>
      <p style={{ fontSize: '13px', color: 'var(--text-muted)', marginBottom: '28px' }}>
        Angemeldet als <strong>{session.email}</strong>
      </p>
      <PasswortAendern />
    </div>
  )
}
