import { Link } from 'react-router-dom';
import { useLanguage } from '../context/LanguageContext';
import Footer from '../components/Footer';

function Analytics() {
    const { t } = useLanguage();

    const metrics = [
        {
            id: 1,
            title: 'Engagement Analytics',
            description: t('analytics.metrics.engagement.description'),
            icon: '📊',
            stats: {
                metrics: '15+',
                update: 'Real-time',
                export: 'CSV/PDF'
            }
        },
        {
            id: 2,
            title: 'Audience Insights',
            description: t('analytics.metrics.audience.description'),
            icon: '👥',
            stats: {
                segments: '8+',
                reach: 'Global',
                tracking: '24/7'
            }
        },
        {
            id: 3,
            title: 'Performance Tracking',
            description: t('analytics.metrics.performance.description'),
            icon: '📈',
            stats: {
                kpis: '20+',
                reports: 'Custom',
                history: '12 months'
            }
        }
    ];

    const dashboardSections = [
        {
            title: t('analytics.dashboard.growth'),
            percentage: '+127%',
            trend: 'up'
        },
        {
            title: t('analytics.dashboard.engagement'),
            percentage: '+85%',
            trend: 'up'
        },
        {
            title: t('analytics.dashboard.conversion'),
            percentage: '+45%',
            trend: 'up'
        }
    ];

    return (
        <div className="relative min-h-screen bg-white">
            {/* Technical grid background */}
            <div className="fixed inset-0 technical-grid opacity-50 pointer-events-none"></div>

            <div className="max-w-[1600px] mx-auto px-8 sm:px-12 lg:px-16 pt-32">
                {/* Header section */}
                <div className="grid-layout mb-16">
                    <div className="col-span-12 md:col-span-8">
                        <h1 className="brutalist-heading relative">
                            {t('analytics.title')}
                            <div className="absolute -right-8 -top-8 w-16 h-16">
                                <div className="geometric-shape pentagon w-full h-full bg-black rotate-30"></div>
                            </div>
                        </h1>
                        <p className="monospace text-xl md:text-2xl font-medium tracking-tight max-w-2xl">
                            {t('analytics.description')}
                        </p>
                    </div>
                </div>

                {/* Main content */}
                <div className="grid-layout gap-8">
                    {/* Dashboard Preview */}
                    <div className="col-span-12">
                        <div className="brutalist-card p-8">
                            <h2 className="text-2xl font-black uppercase mb-8">{t('analytics.dashboard.title')}</h2>
                            <div className="grid grid-cols-1 md:grid-cols-3 gap-8">
                                {dashboardSections.map((section) => (
                                    <div key={section.title} className="brutalist-card p-6 relative hover:-translate-y-1 transition-transform">
                                        <h3 className="text-xl font-bold mb-4">{section.title}</h3>
                                        <div className="flex items-center gap-4">
                                            <span className="text-4xl font-bold">{section.percentage}</span>
                                            <div className={`w-8 h-8 ${section.trend === 'up' ? 'rotate-0' : 'rotate-180'}`}>
                                                ↑
                                            </div>
                                        </div>
                                        <div className="mt-4 w-full h-2 bg-gray-200">
                                            <div className="h-full bg-black" style={{ width: section.percentage }}></div>
                                        </div>
                                    </div>
                                ))}
                            </div>
                        </div>
                    </div>

                    {/* Metrics Overview */}
                    <div className="col-span-12 md:col-span-8">
                        <div className="brutalist-card p-8">
                            <h2 className="text-2xl font-black uppercase mb-8">{t('analytics.metrics.title')}</h2>
                            <div className="space-y-8">
                                {metrics.map((metric) => (
                                    <div key={metric.id} className="brutalist-card p-6 relative hover:-translate-y-1 transition-transform">
                                        <div className="absolute -right-2 -top-2 w-8 h-8 bg-black text-white flex items-center justify-center">
                                            <span className="text-xl">{metric.icon}</span>
                                        </div>
                                        <h3 className="text-xl font-bold mb-4">{metric.title}</h3>
                                        <p className="monospace mb-6">{metric.description}</p>
                                        <div className="section-divider"></div>
                                        <div className="grid grid-cols-3 gap-4 mt-4">
                                            {Object.entries(metric.stats).map(([key, value]) => (
                                                <div key={key}>
                                                    <span className="monospace text-sm block capitalize">{key}</span>
                                                    <span className="font-bold">{value}</span>
                                                </div>
                                            ))}
                                        </div>
                                    </div>
                                ))}
                            </div>
                        </div>
                    </div>

                    {/* Quick Actions */}
                    <div className="col-span-12 md:col-span-4">
                        <div className="brutalist-card p-6">
                            <h3 className="text-xl font-bold mb-6">{t('analytics.actions.title')}</h3>
                            <div className="space-y-4">
                                {[
                                    'Generate Report',
                                    'Export Data',
                                    'Set Alerts',
                                    'Share Dashboard',
                                    'Configure KPIs'
                                ].map((action) => (
                                    <div key={action} className="brutalist-card p-3 hover:-translate-x-2 transition-transform cursor-pointer">
                                        <span className="monospace">{action}</span>
                                    </div>
                                ))}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <Footer />
        </div>
    );
}

export default Analytics; 