import Navigation from "@/components/Navigation";
import Footer from "@/components/Footer";
import ScrollToTop from "@/components/ScrollToTop";
import { Card, CardContent } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { 
  Newspaper, 
  AlertTriangle, 
  FileText, 
  Calendar,
  ExternalLink,
  Download,
  Clock
} from "lucide-react";

const Newsletters = () => {
  const taxAlerts = [
    {
      title: "One Big Beautiful Bill Act (Signed Into Law July 4, 2025)",
      date: "July 4, 2025",
      type: "alert",
      summary: "Major tax legislation signed into law affecting multiple areas of tax policy.",
      content: "The One Big Beautiful Bill Act represents significant changes to the tax code that will impact both individual and business taxpayers. This comprehensive legislation includes provisions affecting tax rates, deductions, credits, and compliance requirements."
    },
    {
      title: "2025 Post-Filing Season Update",
      date: "April 15, 2025",
      type: "update",
      summary: "Important updates and reminders following the 2024 tax filing season.",
      content: "As we move past the 2024 filing season, there are several important updates and reminders for taxpayers to consider for the 2025 tax year."
    },
    {
      title: "2024 Post-Election Tax Policy Update",
      date: "November 15, 2024",
      type: "update",
      summary: "Analysis of potential tax policy changes following the 2024 elections.",
      content: "Following the 2024 elections, we provide analysis of potential tax policy changes and their implications for taxpayers."
    }
  ];

  const taxBriefings = [
    {
      title: "IRS Promises to Propose Regulations on Transfers of U.S. Real Property Interests (Notice 2025-45)",
      date: "January 15, 2025",
      type: "briefing",
      summary: "Treasury and the IRS intend to issue proposed regulations under sections 897(d) and (e) to modify the rules under §§1.897-5T and 1.897-6T, Notice 89-85, 1989-31 I.R.B. 9, and Notice 2006-46, 2006-1 C.B. 896.",
      content: "The IRS has announced its intention to propose new regulations that will significantly impact how transfers of U.S. real property interests are handled for tax purposes. These changes will affect both domestic and foreign investors in U.S. real estate."
    },
    {
      title: "IRS Reminds Employers Student Loan Repayments Are Excludable Through 2025 (IR-2025-81)",
      date: "January 10, 2025",
      type: "briefing",
      summary: "The IRS has reminded employers that they may continue to offer student loan repayment assistance through educational assistance programs until the end of the tax year at issue, December 31, 2025.",
      content: "Employers can continue to provide tax-free student loan repayment assistance to employees through educational assistance programs. This benefit can be up to $5,250 per employee per year and is excluded from the employee's gross income."
    },
    {
      title: "IRS Whistleblower Office Celebrates National Whistleblower Day (IR-2025-78)",
      date: "July 30, 2025",
      type: "briefing",
      summary: "The IRS Whistleblower Office emphasized the role whistleblowers continue to play in supporting the nation's tax administration ahead of National Whistleblower Appreciation Day on July 30.",
      content: "The IRS Whistleblower Office highlighted the important role that whistleblowers play in identifying tax fraud and non-compliance. The program has been instrumental in recovering billions of dollars in unpaid taxes."
    },
    {
      title: "Rates Used in Computing Special Use Value Issued, Rev. Rul. 2025-16",
      date: "January 5, 2025",
      type: "briefing",
      summary: "The 2025 interest rates to be used in computing the special use value of farm real property for which an election is made under Code Sec. 2032A were issued by the IRS.",
      content: "The IRS has released the 2025 interest rates for computing special use value under Section 2032A. These rates are used for estate tax purposes when valuing farm and closely held business real property."
    },
    {
      title: "TX - Telehealth services",
      date: "December 20, 2024",
      type: "briefing",
      summary: "The Texas Comptroller issued a private letter ruling stating that a taxpayer's telehealth services are not subject to sales and use tax.",
      content: "The Texas Comptroller has clarified that telehealth services provided in a bundle that includes various components are not subject to Texas sales and use tax. This ruling provides important guidance for healthcare providers offering telehealth services in Texas."
    },
    {
      title: "IRS Announces No Changes to 2025 Returns or Withholding Under OBBBA (IR-2025-82)",
      date: "January 20, 2025",
      type: "briefing",
      summary: "The IRS has announced that, under the phased implementation of the One Big Beautiful Bill Act (OBBBA), there will be no changes to individual information returns or federal income tax withholding tables for the tax year at issue.",
      content: "Despite the passage of the One Big Beautiful Bill Act, the IRS has confirmed that there will be no immediate changes to withholding tables or information returns for 2025, providing stability for taxpayers and employers."
    },
    {
      title: "IRS Lists FAQs on Expiration of Energy Credits and Deductions Under OBBB and More (FS-2025-5; IR-2025-86)",
      date: "January 25, 2025",
      type: "briefing",
      summary: "The IRS issued frequently asked questions (FAQs) relating to several energy credits and deductions that are expiring under the One, Big, Beautiful Bill Act (OBBB) and their termination dates.",
      content: "The IRS has provided comprehensive guidance on energy-related tax credits and deductions that are expiring under the new legislation, including clarification on the energy efficient home improvement credit and residential clean energy credit."
    },
    {
      title: "IRS Provides Guidance for 'Beginning of Construction' for Applicable Wind and Solar Facilities (Notice 2025-42)",
      date: "February 1, 2025",
      type: "briefing",
      summary: "The IRS has provided guidance regarding what is considered 'beginning of constructions' for purposes of the termination of the Code Sec. 45Y clean electricity production credit and the Code Sec. 48E clean electricity investment credit.",
      content: "The One Big Beautiful Bill (OBBB) Act terminated the Code Secs. 45Y and 48E credits for applicable wind and solar facilities placed in service after December 31, 2027. This notice provides important guidance on what constitutes 'beginning of construction' for these facilities."
    },
    {
      title: "TIGTA Critical of IRS Level of Service and Wait Time Reporting",
      date: "January 30, 2025",
      type: "briefing",
      summary: "The Treasury Inspector General for Tax Administration suggested the way the Internal Revenue Service reports level of service (ability to reach an operator when requested) and wait times does not necessarily reflect the actual times taxpayers are waiting to reach a representative at the agency.",
      content: "TIGTA has raised concerns about the accuracy of IRS reporting on customer service metrics, suggesting that the reported wait times may not accurately reflect the actual experience of taxpayers trying to reach IRS representatives."
    },
    {
      title: "FinCEN Delays Investment Adviser Rules Until 2028 (FinCEN Exemptive Relief Order)",
      date: "February 5, 2025",
      type: "briefing",
      summary: "The Financial Crimes Enforcement Network (FinCEN) has granted exemptive relief to covered investment advisers from the requirements the final regulations in FinCEN Final Rule RIN 1506-AB58 (also called the 'IA AML Rule'), which were set to become effective January 1, 2026.",
      content: "FinCEN has extended the compliance deadline for investment advisers under the Anti-Money Laundering (AML) rule until January 1, 2028, providing additional time for advisers to implement the required compliance procedures."
    }
  ];

  const getTypeColor = (type: string) => {
    switch (type) {
      case 'alert': return 'destructive';
      case 'update': return 'default';
      case 'briefing': return 'secondary';
      default: return 'outline';
    }
  };

  const getTypeIcon = (type: string) => {
    switch (type) {
      case 'alert': return AlertTriangle;
      case 'update': return Clock;
      case 'briefing': return FileText;
      default: return Newspaper;
    }
  };

  return (
    <div className="min-h-screen">
      <Navigation />
      <main className="pt-16">
        {/* Hero Section */}
        <section 
          className="relative py-24 flex items-center justify-center text-center"
          style={{
            backgroundImage: "url('/lovable-uploads/f8f08a1a-0132-4376-af8a-c5bb86f0627e.png')",
            backgroundSize: "90% 80%",
            backgroundPosition: "center",
            backgroundRepeat: "no-repeat"
          }}
        >
          <div className="absolute inset-0 bg-forest/60"></div>
          <div className="relative z-10 container mx-auto px-4 text-center">
            <h1 className="text-display-xl font-display font-bold text-cream mb-6">
              Newsletters
            </h1>
            <p className="text-body-lg text-cream/90 max-w-3xl mx-auto">
              Stay informed with the latest tax alerts, briefings, and updates. Our comprehensive coverage ensures you're always up-to-date with the most important tax developments affecting your financial situation.
            </p>
          </div>
        </section>

        {/* Tax Alerts */}
        <section className="py-24 bg-background">
          <div className="container mx-auto px-4">
            <div className="max-w-4xl mx-auto">
              <div className="text-center mb-12">
                <h2 className="text-display-lg font-display font-semibold text-forest mb-4">
                  Tax Alerts
                </h2>
                <p className="text-body-lg text-sage">
                  Critical tax updates and legislative changes that require immediate attention.
                </p>
              </div>

              <div className="space-y-6">
                {taxAlerts.map((alert, index) => {
                  const Icon = getTypeIcon(alert.type);
                  return (
                    <Card key={index} className="rounded-2xl card-elevation hover:shadow-lg gentle-transition">
                      <CardContent className="p-8">
                        <div className="flex items-start gap-4">
                          <div className="flex-shrink-0">
                            <div className="w-12 h-12 bg-brass/20 rounded-2xl flex items-center justify-center">
                              <Icon className="w-6 h-6 text-brass" strokeWidth={1.5} />
                            </div>
                          </div>
                          <div className="flex-1">
                            <div className="flex items-center gap-3 mb-3">
                              <Badge variant={getTypeColor(alert.type)}>
                                {alert.type.toUpperCase()}
                              </Badge>
                              <span className="text-sm text-sage flex items-center gap-1">
                                <Calendar className="w-4 h-4" />
                                {alert.date}
                              </span>
                            </div>
                            <h3 className="text-display-md font-display font-semibold text-forest mb-3">
                              {alert.title}
                            </h3>
                            <p className="text-sage mb-4 leading-relaxed">
                              {alert.summary}
                            </p>
                            <p className="text-sage leading-relaxed">
                              {alert.content}
                            </p>
                            <div className="flex gap-3 mt-6">
                              <Button size="sm" variant="outline">
                                <Download className="mr-2 w-4 h-4" />
                                Download PDF
                              </Button>
                              <Button size="sm" variant="outline">
                                <ExternalLink className="mr-2 w-4 h-4" />
                                Read More
                              </Button>
                            </div>
                          </div>
                        </div>
                      </CardContent>
                    </Card>
                  );
                })}
              </div>
            </div>
          </div>
        </section>

        {/* Tax Briefings */}
        <section className="py-24 bg-muted/30">
          <div className="container mx-auto px-4">
            <div className="max-w-4xl mx-auto">
              <div className="text-center mb-12">
                <h2 className="text-display-lg font-display font-semibold text-forest mb-4">
                  Tax Briefings
                </h2>
                <p className="text-body-lg text-sage">
                  Detailed analysis and insights on tax law changes, IRS guidance, and regulatory updates.
                </p>
              </div>

              <div className="space-y-6">
                {taxBriefings.map((briefing, index) => {
                  const Icon = getTypeIcon(briefing.type);
                  return (
                    <Card key={index} className="rounded-2xl card-elevation hover:shadow-lg gentle-transition">
                      <CardContent className="p-8">
                        <div className="flex items-start gap-4">
                          <div className="flex-shrink-0">
                            <div className="w-12 h-12 bg-brass/20 rounded-2xl flex items-center justify-center">
                              <Icon className="w-6 h-6 text-brass" strokeWidth={1.5} />
                            </div>
                          </div>
                          <div className="flex-1">
                            <div className="flex items-center gap-3 mb-3">
                              <Badge variant={getTypeColor(briefing.type)}>
                                {briefing.type.toUpperCase()}
                              </Badge>
                              <span className="text-sm text-sage flex items-center gap-1">
                                <Calendar className="w-4 h-4" />
                                {briefing.date}
                              </span>
                            </div>
                            <h3 className="text-display-md font-display font-semibold text-forest mb-3">
                              {briefing.title}
                            </h3>
                            <p className="text-sage mb-4 leading-relaxed">
                              {briefing.summary}
                            </p>
                            <p className="text-sage leading-relaxed">
                              {briefing.content}
                            </p>
                            <div className="flex gap-3 mt-6">
                              <Button size="sm" variant="outline">
                                <Download className="mr-2 w-4 h-4" />
                                Download PDF
                              </Button>
                              <Button size="sm" variant="outline">
                                <ExternalLink className="mr-2 w-4 h-4" />
                                Read More
                              </Button>
                            </div>
                          </div>
                        </div>
                      </CardContent>
                    </Card>
                  );
                })}
              </div>
            </div>
          </div>
        </section>

        {/* Newsletter Signup */}
        <section className="py-24 bg-background">
          <div className="container mx-auto px-4">
            <div className="max-w-2xl mx-auto text-center">
              <Card className="rounded-2xl card-elevation">
                <CardContent className="p-8">
                  <div className="w-16 h-16 bg-brass/20 rounded-2xl flex items-center justify-center mx-auto mb-6">
                    <Newspaper className="w-8 h-8 text-brass" strokeWidth={1.5} />
                  </div>
                  
                  <h3 className="text-display-lg font-display font-semibold text-forest mb-4">
                    Stay Updated
                  </h3>
                  
                  <p className="text-body-lg text-sage mb-8">
                    Subscribe to our newsletter to receive the latest tax alerts, briefings, and updates directly in your inbox.
                  </p>
                  
                  <div className="flex flex-col sm:flex-row gap-4 max-w-md mx-auto">
                    <input 
                      type="email" 
                      placeholder="Enter your email address"
                      className="flex-1 px-4 py-3 rounded-xl border border-sage/20 focus:outline-none focus:ring-2 focus:ring-brass/50 focus:border-transparent"
                    />
                    <Button className="btn-shadow">
                      Subscribe
                    </Button>
                  </div>
                  
                  <p className="text-sm text-sage mt-4">
                    No spam • Unsubscribe anytime • We respect your privacy
                  </p>
                </CardContent>
              </Card>
            </div>
          </div>
        </section>
      </main>
      <Footer />
      <ScrollToTop />
    </div>
  );
};

export default Newsletters;
