<template>
  <div class="minimal-landing">
    <!-- Clean Navbar -->
    <nav class="nav-minimal" :class="{ 'scrolled': scrolled }">
      <div class="nav-inner">
        <div class="brand">
          <img src="/icono.png" alt="SIB Logo" class="brand-icon" />
          <span class="brand-name">SIB</span>
        </div>
        <div class="nav-links">
          <button class="nav-btn" @click="scrollToInstall">{{ t('landing.hero.howToInstall') }}</button>
          <button class="btn-yellow-sm" @click="launchApp">{{ t('landing.hero.launchApp') }}</button>
        </div>
      </div>
    </nav>

    <!-- Minimalist Hero -->
    <header class="hero-minimal">
      <div class="hero-overlay"></div>
      
      <div class="hero-content">
        <h1 class="hero-title" data-aos="fade-up">
          {{ t('landing.hero.title') }}
        </h1>
        <p class="hero-subtitle" data-aos="fade-up" data-aos-delay="100">
          {{ t('landing.hero.tagline') }}
        </p>
        <div class="hero-cta" data-aos="fade-up" data-aos-delay="200">
          <button class="btn-yellow-lg" @click="launchApp">
            {{ t('landing.hero.launchApp') }}
            <span class="material-icons">arrow_forward</span>
          </button>
        </div>
      </div>
    </header>

    <!-- Refined Features Grid (No Cards) -->
    <section class="features-minimal">
      <div class="features-grid">
        <div class="feature-item" data-aos="fade-up">
          <span class="material-icons feature-icon">explore</span>
          <h3>{{ t('landing.features.realtime') }}</h3>
          <p>{{ t('landing.features.realtimeDesc') }}</p>
        </div>
        <div class="feature-item" data-aos="fade-up" data-aos-delay="100">
          <span class="material-icons feature-icon">local_offer</span>
          <h3>{{ t('landing.features.localOffers') }}</h3>
          <p>{{ t('landing.features.localOffersDesc') }}</p>
        </div>
        <div class="feature-item" data-aos="fade-up" data-aos-delay="200">
          <span class="material-icons feature-icon">phonelink_setup</span>
          <h3>{{ t('landing.features.noDownload') }}</h3>
          <p>{{ t('landing.features.noDownloadDesc') }}</p>
        </div>
      </div>
    </section>

    <!-- Simple Installation Guide -->
    <section id="install-guide" class="install-section">
      <div class="install-container">
        <h2 class="install-title">{{ t('landing.install.title') }}</h2>
        
        <div class="install-grid">
          <!-- iOS -->
          <div class="install-col">
            <div class="platform-header">
              <span class="material-icons">apple</span>
              <h3>iOS (Safari)</h3>
            </div>
            <ol class="step-list-minimal">
              <li>{{ t('landing.install.iosStep1') }}</li>
              <li>{{ t('landing.install.iosStep2') }}</li>
              <li>{{ t('landing.install.iosStep3') }}</li>
            </ol>
          </div>
          
          <!-- Android -->
          <div class="install-col">
            <div class="platform-header">
              <span class="material-icons">android</span>
              <h3>Android (Chrome)</h3>
            </div>
            <ol class="step-list-minimal">
              <li>{{ t('landing.install.androidStep1') }}</li>
              <li>{{ t('landing.install.androidStep2') }}</li>
              <li>{{ t('landing.install.androidStep3') }}</li>
            </ol>
          </div>
        </div>
      </div>
    </section>

    <!-- Minimal Footer -->
    <footer class="footer-minimal">
      <div class="footer-inner">
        <div class="footer-logo">
          <img src="/icono.png" alt="SIB" class="footer-icon" />
          <span>SIB System</span>
        </div>
        <p class="footer-rights">{{ t('landing.footer.rights') }}</p>
      </div>
    </footer>
  </div>
</template>

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

const router = useRouter()
const { t } = useI18n()
const scrolled = ref(false)

const handleScroll = () => {
  scrolled.value = window.scrollY > 50
}

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

onUnmounted(() => {
  window.removeEventListener('scroll', handleScroll)
})

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

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

<style scoped>
.minimal-landing {
  background-color: #000000;
  color: #ffffff;
  font-family: 'Space Grotesk', sans-serif;
  min-height: 100vh;
}

/* Navbar */
.nav-minimal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.nav-minimal.scrolled {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  height: 70px;
}

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

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

.brand-icon {
  width: 32px;
  height: 32px;
}

.brand-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-btn:hover {
  color: #ffffff;
}

.btn-yellow-sm {
  background: #fee715;
  color: #000000;
  padding: 10px 24px;
  border-radius: 100px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-yellow-sm:hover {
  transform: scale(1.05);
}

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

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
  z-index: -1;
}

.hero-content {
  position: relative;
  z-index: 1;
  padding-top: 140px; /* Bajar el texto más */
}

.hero-title {
  font-size: clamp(3.5rem, 12vw, 8rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.06em;
  margin-bottom: 24px;
}

.hero-subtitle {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: rgba(255, 255, 255, 0.5);
  max-width: 700px;
  margin: 0 auto 56px;
  font-weight: 400;
}

.btn-yellow-lg {
  background: #fee715;
  color: #000000;
  padding: 24px 64px;
  border-radius: 100px;
  font-size: 1.25rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.btn-yellow-lg:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(254, 231, 21, 0.2);
}

/* Features */
.features-minimal {
  padding: 120px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 64px;
}

.feature-item {
  text-align: left;
}

.feature-icon {
  font-size: 40px;
  color: #fee715;
  margin-bottom: 24px;
}

.feature-item h3 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.feature-item p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.15rem;
  line-height: 1.6;
}

/* Install Guide */
.install-section {
  padding: 160px 24px;
  background: #0a0a0a;
}

.install-container {
  max-width: 1000px;
  margin: 0 auto;
}

.install-title {
  font-size: 3.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 80px;
  letter-spacing: -0.04em;
}

.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 80px;
}

.platform-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.platform-header .material-icons {
  font-size: 32px;
  color: #fee715;
}

.platform-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
}

.step-list-minimal {
  list-style: none;
  padding: 0;
  counter-reset: step-counter;
}

.step-list-minimal li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 48px;
  margin-bottom: 24px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  line-height: 1.4;
}

.step-list-minimal li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fee715;
}

/* Footer */
.footer-minimal {
  padding: 80px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
}

.footer-icon {
  width: 24px;
  height: 24px;
  filter: grayscale(1) opacity(0.5);
}

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

@media (max-width: 768px) {
  .hero-title { font-size: 4rem; }
  .features-grid { gap: 48px; }
  .install-grid { gap: 64px; }
  .btn-yellow-lg { width: 100%; justify-content: center; padding: 20px; }
  .footer-inner { flex-direction: column; gap: 24px; text-align: center; }
}
</style>
