'use client'

import { useState } from 'react'
import JourneyForm from './components/JourneyForm'
import DataPreview from './components/DataPreview'

export default function Home() {
  const [calculatedData, setCalculatedData] = useState(null)
  const [loading, setLoading] = useState(false)
  const [formData, setFormData] = useState(null)

  return (
    <main className="min-h-screen p-8 md:p-12">
      <div className="max-w-7xl mx-auto">
        <div className="mb-8">
          <h1 className="text-3xl font-bold tracking-tight mb-2">
            Kniha Jízd
          </h1>
          <p className="text-muted-foreground">
            Automatizovaný systém pro správu knihy jízd
          </p>
        </div>

        <div className="grid grid-cols-1 xl:grid-cols-2 gap-6">
          <JourneyForm
            onDataCalculated={setCalculatedData}
            setLoading={setLoading}
            onFormDataChange={setFormData}
          />
          <DataPreview data={calculatedData} loading={loading} formData={formData} />
        </div>
      </div>
    </main>
  )
}
