// src/app/components/landing-page/landing-page.component.ts
import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import * as AOS from 'aos';
import { BlogComponent } from './blog.component';
import { Call2ActionComponent } from './call2action.component';
import { ContactComponent } from './contact.component';
import { FeaturesComponent } from './features.component';
import { FooterComponent } from './footer.component';
import { HeaderComponent } from './header.component';
import { HeroComponent } from './hero.component';
import { ServicesComponent } from './services.component';

@Component({
  selector: 'app-landing-page',
  standalone: true,
  imports: [
    CommonModule,
    HeaderComponent,
    HeroComponent,
    ServicesComponent,
    FeaturesComponent,
    Call2ActionComponent,
    BlogComponent,
    ContactComponent,
    FooterComponent
  ],
  template: `
    <app-header></app-header>
    <app-hero></app-hero>
    <app-services></app-services>
    <app-features></app-features>
    <app-call2action></app-call2action>
    <app-blog></app-blog>
    <app-contact></app-contact>
    <app-footer 
      (openPrivacyPolicy)="openPrivacy('privacy')"
      (openTerms)="openPrivacy('terms')"
    ></app-footer>

    <!-- Overlay -->
    <div *ngIf="isDrawerOpen" 
         class="fixed inset-0 bg-black bg-opacity-50 z-40"
         (click)="closeDrawer()"></div>

    <!-- Privacy Policy Drawer -->
    <div 
      [ngClass]="{
        'translate-x-0': activeDrawer === 'privacy',
        '-translate-x-full': activeDrawer !== 'privacy'
      }"
      class="fixed top-0 left-0 h-full w-1/3 bg-white shadow-lg transform transition-transform duration-300 ease-in-out z-50 overflow-y-auto">
      <div class="p-6">
        <button 
          class="absolute top-4 right-4 text-gray-600 hover:text-gray-800 focus:outline-none"
          (click)="closeDrawer()">
          <i class="fas fa-times"></i>
        </button>
        <div class="text-gray-800">
          <h2 class="text-3xl font-bold mb-4">Privacy Policy</h2>
          <p class="text-gray-700 mb-4">
            <!-- Dein Privacy Policy Inhalt hier -->
            At Bay Area Affiliates, Inc., we are committed to protecting your privacy. 
            This Privacy Policy outlines how we collect, use, disclose, and safeguard your 
            information when you visit our website and use our services.
          </p>
            <h3 class="text-2xl font-semibold mb-2">
                Information We Collect
            </h3>
            <p class="text-gray-700 mb-4">
                We may collect personal information such as your name,
                email address, phone number, and other relevant details
                when you contact us for our IT support services.
            </p>
            <h3 class="text-2xl font-semibold mb-2">
                How We Use Your Information
            </h3>
            <p class="text-gray-700 mb-4">
                Your information is used to provide and improve our
                services, respond to your inquiries, and communicate
                important updates. We do not sell or rent your personal
                information to third parties.
            </p>
            <h3 class="text-2xl font-semibold mb-2">Data Security</h3>
            <p class="text-gray-700 mb-4">
                We implement a variety of security measures to maintain
                the safety of your personal information. However, no
                method of transmission over the internet or electronic
                storage is 100% secure.
            </p>
            <h3 class="text-2xl font-semibold mb-2">Your Consent</h3>
            <p class="text-gray-700 mb-4">
                By using our website and services, you consent to our
                Privacy Policy.
            </p>
            <h3 class="text-2xl font-semibold mb-2">
                Changes to Our Privacy Policy
            </h3>
            <p class="text-gray-700 mb-4">
                We reserve the right to update our Privacy Policy at any
                time. Any changes will be effective immediately upon
                posting on this page.
            </p>
            <h3 class="text-2xl font-semibold mb-2">Contact Us</h3>
            <p class="text-gray-700 mb-4">
                If you have any questions regarding this Privacy Policy,
                please contact us at
                <a
                    href="mailto:info&#64;bayareaaffiliates.com"
                    class="text-blue-600 underline"
                    >info&#64;bayareaaffiliates.com</a
                >.
            </p>
        </div>
      </div>
    </div>

    <!-- Terms of Service Drawer -->
    <div 
      [ngClass]="{
        'translate-x-0': activeDrawer === 'terms',
        '-translate-x-full': activeDrawer !== 'terms'
      }"
      class="fixed top-0 left-0 h-full w-1/3 bg-white shadow-lg transform transition-transform duration-300 ease-in-out z-50 overflow-y-auto">
      <div class="p-6">
        <button 
          class="absolute top-4 right-4 text-gray-600 hover:text-gray-800 focus:outline-none"
          (click)="closeDrawer()">
          <i class="fas fa-times"></i>
        </button>
        <div class="text-gray-800">
          <h2 class="text-3xl font-bold mb-4">Terms of Service</h2>
          <p class="text-gray-700 mb-4">
            <!-- Dein Terms of Service Inhalt hier -->
            Welcome to Bay Area Affiliates, Inc. By accessing our website and using our 
            IT support services, you agree to comply with and be bound by the following 
            Terms of Service.
          </p>
            <h3 class="text-2xl font-semibold mb-2">
                Service Description
            </h3>
            <p class="text-gray-700 mb-4">
                Bay Area Affiliates, Inc. provides comprehensive IT
                support services, including hardware and software
                support, network infrastructure, server repair, remote
                support, web services, virtualization solutions, and
                more.
            </p>
            <h3 class="text-2xl font-semibold mb-2">
                User Responsibilities
            </h3>
            <p class="text-gray-700 mb-4">
                Users are responsible for maintaining the
                confidentiality of their account information and for all
                activities that occur under their account. Users agree
                to provide accurate and complete information when using
                our services.
            </p>
            <h3 class="text-2xl font-semibold mb-2">Payment Terms</h3>
            <p class="text-gray-700 mb-4">
                All services rendered by Bay Area Affiliates, Inc. are
                subject to payment terms agreed upon in the service
                contract. Late payments may incur additional fees.
            </p>
            <h3 class="text-2xl font-semibold mb-2">
                Limitation of Liability
            </h3>
            <p class="text-gray-700 mb-4">
                Bay Area Affiliates, Inc. shall not be liable for any
                indirect, incidental, or consequential damages arising
                from the use of our services. Our total liability is
                limited to the amount paid for the services rendered.
            </p>
            <h3 class="text-2xl font-semibold mb-2">Termination</h3>
            <p class="text-gray-700 mb-4">
                Either party may terminate the service agreement at any
                time with written notice. Upon termination, users must
                cease using all services provided by Bay Area
                Affiliates, Inc.
            </p>
            <h3 class="text-2xl font-semibold mb-2">Governing Law</h3>
            <p class="text-gray-700 mb-4">
                These Terms of Service are governed by and construed in
                accordance with the laws of the State of Texas, without
                regard to its conflict of law principles.
            </p>
            <h3 class="text-2xl font-semibold mb-2">
                Changes to Terms
            </h3>
            <p class="text-gray-700 mb-4">
                Bay Area Affiliates, Inc. reserves the right to modify
                these Terms of Service at any time. Any changes will be
                effective immediately upon posting on our website.
                Continued use of our services constitutes acceptance of
                the updated terms.
            </p>
            <h3 class="text-2xl font-semibold mb-2">Contact Us</h3>
            <p class="text-gray-700 mb-4">
                If you have any questions about these Terms of Service,
                please contact us at
                <a
                    href="mailto:info&#64;bayareaaffiliates.com"
                    class="text-blue-600 underline"
                    >info&#64;bayareaaffiliates.com</a
                >.
            </p>
          </div>
      </div>
    </div>
  `,
  styles: [`
    /* Optional: Zusätzliche Styles, falls benötigt */
  `]
})
export class LandingPageComponent implements OnInit {
  activeDrawer: 'privacy' | 'terms' | null = null;

  get isDrawerOpen(): boolean {
    return this.activeDrawer !== null;
  }

  ngOnInit(): void {
    AOS.init();
  }

  openPrivacy(drawer: 'privacy' | 'terms'): void {
    this.activeDrawer = drawer;
    // Optional: Disable scrolling when drawer is open
    document.body.classList.add('overflow-hidden');
  }

  closeDrawer(): void {
    this.activeDrawer = null;
    // Optional: Re-enable scrolling when drawer is closed
    document.body.classList.remove('overflow-hidden');
  }
}
