<template>
  <div class="landing-page">
    <!-- Navbar -->
    <nav class="nav-glass">
      <div class="nav-content">
        <div class="brand">
          <img src="/icono.png" alt="SIB" class="nav-logo" />
          <span class="logo-text">SIB</span>
        </div>
        <button class="btn-primary-sm" @click="launchApp">
          {{ t('landing.hero.launchApp') }}
        </button>
      </div>
    </nav>

    <!-- Hero Section -->
    <header class="hero">
      <div class="hero-bg-overlay"></div>
      <div class="hero-content">
        <div class="logo-box-main" data-aos="zoom-in">
          <img src="/icono.png" alt="SIB Logo" class="main-logo" />
        </div>
        <h1 class="hero-title" data-aos="fade-up">{{ t('landing.hero.title') }}</h1>
        <p class="hero-tagline" data-aos="fade-up" data-aos-delay="100">{{ t('landing.hero.tagline') }}</p>
        
        <div class="hero-actions" data-aos="fade-up" data-aos-delay="200">
          <button class="btn-primary-lg shadow-glow" @click="launchApp">
            <span class="material-icons">rocket_launch</span>
            {{ t('landing.hero.launchApp') }}
          </button>
          <button class="btn-outline-lg" @click="scrollToInstall">
            <span class="material-icons">install_mobile</span>
            {{ t('landing.hero.howToInstall') }}
          </button>
        </div>
      </div>
    </header>

    <!-- Features -->
    <section class="features">
      <div class="feature-card" data-aos="fade-up">
        <div class="icon-circle">
          <span class="material-icons">directions_bus</span>
        </div>
        <h3>{{ t('landing.features.realtime') }}</h3>
        <p>{{ t('landing.features.realtimeDesc') }}</p>
      </div>
      
      <div class="feature-card" data-aos="fade-up" data-aos-delay="100">
        <div class="icon-circle">
          <span class="material-icons">payments</span>
        </div>
        <h3>{{ t('landing.features.localOffers') }}</h3>
        <p>{{ t('landing.features.localOffersDesc') }}</p>
      </div>
      
      <div class="feature-card" data-aos="fade-up" data-aos-delay="200">
        <div class="icon-circle">
          <span class="material-icons">bolt</span>
        </div>
        <h3>{{ t('landing.features.noDownload') }}</h3>
        <p>{{ t('landing.features.noDownloadDesc') }}</p>
      </div>
    </section>

    <!-- Installation Guide -->
    <section id="install-guide" class="install-guide">
      <div class="glass-container">
        <h2 class="section-title">{{ t('landing.install.title') }}</h2>
        
        <div class="guide-tabs">
          <button 
            class="tab-btn"
            :class="{ active: activeTab === 'ios' }" 
            @click="activeTab = 'ios'"
          >
            <span class="material-icons">apple</span> iOS
          </button>
          <button 
            class="tab-btn"
            :class="{ active: activeTab === 'android' }" 
            @click="activeTab = 'android'"
          >
            <span class="material-icons">android</span> Android
          </button>
        </div>

        <div class="guide-content">
          <Transition name="fade-slide" mode="out-in">
            <div :key="activeTab" class="step-list">
              <template v-if="activeTab === 'ios'">
                <div class="step">
                  <div class="step-num">1</div>
                  <div class="step-text">
                    <strong>Paso 1</strong>
                    <p>{{ t('landing.install.iosStep1') }}</p>
                  </div>
                </div>
                <div class="step">
                  <div class="step-num">2</div>
                  <div class="step-text">
                    <strong>Paso 2</strong>
                    <p>{{ t('landing.install.iosStep2') }}</p>
                  </div>
                </div>
                <div class="step">
                  <div class="step-num">3</div>
                  <div class="step-text">
                    <strong>Paso 3</strong>
                    <p>{{ t('landing.install.iosStep3') }}</p>
                  </div>
                </div>
              </template>
              <template v-else>
                <div class="step">
                  <div class="step-num">1</div>
                  <div class="step-text">
                    <strong>Paso 1</strong>
                    <p>{{ t('landing.install.androidStep1') }}</p>
                  </div>
                </div>
                <div class="step">
                  <div class="step-num">2</div>
                  <div class="step-text">
                    <strong>Paso 2</strong>
                    <p>{{ t('landing.install.androidStep2') }}</p>
                  </div>
                </div>
                <div class="step">
                  <div class="step-num">3</div>
                  <div class="step-text">
                    <strong>Paso 3</strong>
                    <p>{{ t('landing.install.androidStep3') }}</p>
                  </div>
                </div>
              </template>
            </div>
          </Transition>
        </div>
      </div>
    </section>

    <!-- Footer -->
    <footer class="footer">
      <div class="footer-content">
        <div class="footer-brand">
          <span class="logo-text">SIB</span>
          <p>{{ t('landing.footer.dev') }}</p>
        </div>
        <div class="footer-divider"></div>
        <p class="rights">{{ t('landing.footer.rights') }}</p>
      </div>
    </footer>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'

const router = useRouter()
const { t } = useI18n()
const activeTab = ref('ios')

onMounted(() => {
  // PWA Detection
  const isStandalone = window.matchMedia('(display-mode: standalone)').matches || (window.navigator as any).standalone === true;
  if (isStandalone) {
    router.replace('/splash')
  }
})

const launchApp = () => {
  router.push('/splash')
}

const scrollToInstall = () => {
  document.getElementById('install-guide')?.scrollIntoView({ behavior: 'smooth' })
}
</script>

<style scoped>
.landing-page {
  background-color: #0F1115;
  color: white;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Space Grotesk', sans-serif;
}

/* Navbar */
.nav-glass {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(15, 17, 21, 0.7);
  backdrop-filter: blur(15px);
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  height: 32px;
  width: 32px;
}

.logo-text {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fee715;
}

/* Hero */
.hero {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  background-image: url('/landing-bg.png');
  background-size: cover;
  background-position: center;
}

.hero-bg-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(15, 17, 21, 0.4) 0%, #0F1115 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.logo-box-main {
  width: 120px;
  height: 120px;
  margin: 0 auto 32px;
  background: rgba(254, 231, 21, 0.1);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 1px solid rgba(254, 231, 21, 0.2);
  backdrop-filter: blur(10px);
}

.main-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
  letter-spacing: -0.05em;
  text-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.hero-tagline {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 48px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn-primary-lg {
  background: #fee715;
  color: #101820;
  padding: 18px 40px;
  border-radius: 16px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary-lg:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 30px rgba(254, 231, 21, 0.3);
}

.btn-outline-lg {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  padding: 18px 40px;
  border-radius: 16px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.btn-outline-lg:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary-sm {
  background: #fee715;
  color: #101820;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

/* Features */
.features {
  padding: 100px 24px;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
}

.feature-card {
  background: rgba(28, 31, 38, 0.5);
  padding: 48px 32px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-10px);
  background: rgba(28, 31, 38, 0.8);
}

.icon-circle {
  width: 80px;
  height: 80px;
  background: rgba(254, 231, 21, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.icon-circle .material-icons {
  font-size: 36px;
  color: #fee715;
}

.feature-card h3 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.feature-card p {
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.6;
}

/* Install Guide */
.install-guide {
  padding: 100px 24px;
  background: linear-gradient(to bottom, transparent, rgba(254, 231, 21, 0.03));
}

.glass-container {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 40px;
  padding: 60px;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 48px;
}

.guide-tabs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 40px;
  background: rgba(0,0,0,0.2);
  padding: 8px;
  border-radius: 20px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.tab-btn {
  padding: 12px 32px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn.active {
  background: #fee715;
  color: #101820;
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 20px;
}

.step-num {
  width: 36px;
  height: 36px;
  background: #fee715;
  color: #101820;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

.step-text strong {
  display: block;
  font-size: 0.9rem;
  color: #fee715;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.step-text p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
}

/* Footer */
.footer {
  padding: 80px 24px 40px;
  text-align: center;
}

.logo-text-footer {
  font-size: 32px;
  font-weight: 800;
  color: #fee715;
  margin-bottom: 12px;
}

.footer-divider {
  max-width: 1200px;
  height: 1px;
  background: rgba(255,255,255,0.05);
  margin: 40px auto;
}

.rights {
  color: rgba(255,255,255,0.4);
  font-size: 0.9rem;
}

/* Animations */
.fade-slide-enter-active,
.fade-slide-leave-active {
  transition: all 0.3s ease;
}

.fade-slide-enter-from {
  opacity: 0;
  transform: translateX(20px);
}

.fade-slide-leave-to {
  opacity: 0;
  transform: translateX(-20px);
}

@media (max-width: 768px) {
  .hero-title { font-size: 3rem; }
  .glass-container { padding: 40px 24px; }
  .btn-primary-lg, .btn-outline-lg { width: 100%; justify-content: center; }
}
</style>
