use leptos::prelude::*;
use leptos_router::components::A;
use crate::components::card::{Card, CardVariant};
use crate::components::layout::{PageContent, PageTitle, PageDescription};
use crate::page::prelude::*;

#[component]
pub fn TermsAndRulesPage() -> impl IntoView {
    view! {
        <PageContent id="terms-and-rules-page">
            <div class="w-full">
                <PageTitle title=t8s!("Terms And Rules").to_string() id="terms-and-rules-title" />
                <PageDescription 
                    description=t8s!("Access our legal documents and service policies. Choose from the available options below.").to_string() 
                    id="terms-and-rules-description" 
                />
                
                <div class="mt-16 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto">
                    // Rules Card
                    <Card variant=CardVariant::L1 class="text-center hover:scale-105 transition-transform duration-300 cursor-pointer" id="rules-card">
                        <div class="flex flex-col items-center space-y-4">
                            <div class="w-16 h-16 bg-[var(--main-light-80)] rounded-full flex items-center justify-center mb-4">
                                <svg class="w-8 h-8 text-[var(--main-dark-text)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                                </svg>
                            </div>
                            <h3 class="text-xl font-semibold text-[var(--text-primary)] mb-2">{t8s!("Rules")}</h3>
                            <p class="text-[var(--text-secondary)] text-sm mb-6">{t8s!("Service usage guidelines and restrictions")}</p>
                            <A href=t8r!("/en/rules")().get()>
                                <div class="block w-full py-3 px-6 bg-[var(--btn-primary-bg)] text-[var(--main-dark-text)] rounded-lg font-medium hover:opacity-80 transition-opacity text-center">
                                    {t8s!("View Rules")}
                                </div>
                            </A>
                        </div>
                    </Card>

                    // Terms Card
                    <Card variant=CardVariant::L2 class="text-center hover:scale-105 transition-transform duration-300 cursor-pointer" id="terms-card">
                        <div class="flex flex-col items-center space-y-4">
                            <div class="w-16 h-16 bg-[var(--main-light-80)] rounded-full flex items-center justify-center mb-4">
                                <svg class="w-8 h-8 text-[var(--main-dark-text)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
                                </svg>
                            </div>
                            <h3 class="text-xl font-semibold text-[var(--text-primary)] mb-2">{t8s!("Terms of Service")}</h3>
                            <p class="text-[var(--text-secondary)] text-sm mb-6">{t8s!("User agreement and service terms")}</p>
                            <A href=t8r!("/en/terms")().get()>
                                <div class="block w-full py-3 px-6 bg-[var(--btn-primary-bg)] text-[var(--main-dark-text)] rounded-lg font-medium hover:opacity-80 transition-opacity text-center">
                                    {t8s!("View Terms")}
                                </div>
                            </A>
                        </div>
                    </Card>

                    // Privacy Card
                    <Card variant=CardVariant::L3 class="text-center hover:scale-105 transition-transform duration-300 cursor-pointer" id="privacy-card">
                        <div class="flex flex-col items-center space-y-4">
                            <div class="w-16 h-16 bg-[var(--main-light-80)] rounded-full flex items-center justify-center mb-4">
                                <svg class="w-8 h-8 text-[var(--main-dark-text)]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
                                </svg>
                            </div>
                            <h3 class="text-xl font-semibold text-[var(--text-primary)] mb-2">{t8s!("Privacy Policy")}</h3>
                            <p class="text-[var(--text-secondary)] text-sm mb-6">{t8s!("Data protection and privacy information")}</p>
                            <A href=t8r!("/en/privacy")().get()>
                                <div class="block w-full py-3 px-6 bg-[var(--btn-primary-bg)] text-[var(--main-dark-text)] rounded-lg font-medium hover:opacity-80 transition-opacity text-center">
                                    {t8s!("View Privacy Policy")}
                                </div>
                            </A>
                        </div>
                    </Card>
                </div>

                // Additional Info Section
                <div class="mt-16 text-center">
                    <Card variant=CardVariant::L1 class="max-w-4xl mx-auto" id="info-card">
                        <div class="text-center">
                            <h3 class="text-2xl font-semibold text-[var(--text-primary)] mb-4">{t8s!("Need Help?")}</h3>
                            <p class="text-[var(--text-secondary)] mb-6">
                                {t8s!("If you have any questions about our terms, rules, or privacy policy, please don't hesitate to contact our support team.")}
                            </p>
                            <A href="https://t.me/VProxy_Support_bot">
                                <div class="inline-block py-3 px-8 bg-[var(--btn-primary-bg)] text-[var(--main-dark-text)] rounded-xl font-semibold hover:opacity-80 transition-opacity">
                                    {t8s!("Contact Support")}
                                </div>
                            </A>
                        </div>
                    </Card>
                </div>
            </div>
        </PageContent>
    }
}
