'use client';

import Link from 'next/link';
import { FileText, Shield, ArrowRight } from 'lucide-react';
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { useSystemConfig } from '@/hooks/useSystemConfig';

export default function TermsPage() {
  const sysConfig = useSystemConfig();
  return (
    <div className="bg-surface-sunken min-h-screen">
      <div className="mx-auto max-w-3xl px-4 py-12">
        <div className="mb-8 text-center">
          <div className="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-primary-100 text-primary-600 dark:bg-primary-500/15 dark:text-primary-300">
            <FileText className="h-6 w-6" />
          </div>
          <h1 className="text-3xl font-bold text-ink">Terms of Service</h1>
          <p className="mt-2 text-ink-muted">Last updated: August 2026</p>
        </div>

        <div className="space-y-6">
          <Card>
            <CardHeader>
              <CardTitle>1. Acceptance of Terms</CardTitle>
            </CardHeader>
            <CardContent>
              <p className="text-sm text-ink-muted leading-relaxed">
                By accessing or using {sysConfig.projectName}, you agree to be bound by these Terms of Service. If you do not agree to these terms, please do not use our platform.
              </p>
            </CardContent>
          </Card>

          <Card>
            <CardHeader>
              <CardTitle>2. Eligibility</CardTitle>
            </CardHeader>
            <CardContent>
              <p className="text-sm text-ink-muted leading-relaxed">
                You must be at least 18 years old and have the legal capacity to enter into a binding agreement to use {sysConfig.projectName}. You are responsible for maintaining the confidentiality of your account credentials.
              </p>
            </CardContent>
          </Card>

          <Card>
            <CardHeader>
              <CardTitle>3. Account Security</CardTitle>
            </CardHeader>
            <CardContent>
              <p className="text-sm text-ink-muted leading-relaxed">
                You are responsible for all activities under your account. We recommend enabling two-factor authentication and using strong passwords. Notify us immediately of any unauthorized access.
              </p>
            </CardContent>
          </Card>

          <Card>
            <CardHeader>
              <CardTitle>4. Trading & Transactions</CardTitle>
            </CardHeader>
            <CardContent>
              <p className="text-sm text-ink-muted leading-relaxed">
                All trades are subject to our business rules and limits. Market orders are executed based on availability. We are not responsible for losses due to market volatility or delayed executions.
              </p>
            </CardContent>
          </Card>

          <Card>
            <CardHeader>
              <CardTitle>5. Fees</CardTitle>
            </CardHeader>
            <CardContent>
              <p className="text-sm text-ink-muted leading-relaxed">
                Fees are clearly displayed before transaction confirmation. We reserve the right to adjust fees with prior notice. All fee structures are available in your dashboard.
              </p>
            </CardContent>
          </Card>

          <Card>
            <CardHeader>
              <CardTitle>6. Limitation of Liability</CardTitle>
            </CardHeader>
            <CardContent>
              <p className="text-sm text-ink-muted leading-relaxed">
                {sysConfig.projectName} shall not be liable for any indirect, incidental, special, or consequential damages arising from your use of the platform.
              </p>
            </CardContent>
          </Card>

          <Card>
            <CardHeader>
              <CardTitle>7. Contact</CardTitle>
            </CardHeader>
            <CardContent>
              <p className="text-sm text-ink-muted leading-relaxed">
                For questions about these terms, please contact us at {sysConfig.supportEmail} or create a support ticket from your dashboard.
              </p>
            </CardContent>
          </Card>
        </div>

        <div className="mt-8 flex justify-center">
          <Link href="/privacy-policy">
            <Button variant="outline" size="lg">
              Privacy Policy <ArrowRight className="h-4 w-4" />
            </Button>
          </Link>
        </div>
      </div>
    </div>
  );
}
