<template>
  <div class="admin-panel">
    <div class="header-section">
      <div class="badge">SISTEMA CENTRAL</div>
      <h1>Panel de Control</h1>
      <p class="subtitle">Ecosistema Administrativo SIB</p>
    </div>

    <div class="dashboard-sections">
      <!-- Sector: Inteligencia y Control -->
      <section class="admin-section">
        <div class="section-header">
          <span class="material-icons">insights</span>
          <h2>Inteligencia y Control</h2>
        </div>
        <div class="category-grid">
          <div class="action-card" @click="router.push('/admin/analytics')">
            <div class="card-icon"><span class="material-icons">analytics</span></div>
            <div class="card-content">
              <h3>Análisis</h3>
              <p>Métricas en tiempo real.</p>
            </div>
          </div>
          <div class="action-card" @click="router.push('/admin/reports')">
            <div class="card-icon"><span class="material-icons">report_problem</span></div>
            <div class="card-content">
              <h3>Reportes</h3>
              <p>Incidencias de usuarios.</p>
            </div>
          </div>
        </div>
      </section>

      <!-- Sector: Infraestructura de Transporte -->
      <section class="admin-section">
        <div class="section-header">
          <span class="material-icons">settings_input_component</span>
          <h2>Infraestructura</h2>
        </div>
        <div class="category-grid">
          <div class="action-card" @click="router.push('/admin/routes')">
            <div class="card-icon"><span class="material-icons">navigation</span></div>
            <div class="card-content">
              <h3>Rutas</h3>
              <p>Gestión de trayectos.</p>
            </div>
          </div>
          <div class="action-card" @click="router.push('/admin/bus-stops')">
            <div class="card-icon"><span class="material-icons">location_on</span></div>
            <div class="card-content">
              <h3>Paradas</h3>
              <p>Puntos de abordaje.</p>
            </div>
          </div>
          <div class="action-card" @click="router.push('/admin/schedules')">
            <div class="card-icon"><span class="material-icons">schedule</span></div>
            <div class="card-content">
              <h3>Horarios</h3>
              <p>Frecuencias y salidas.</p>
            </div>
          </div>
        </div>
      </section>

      <!-- Sector: Flota y Servicios -->
      <section class="admin-section">
        <div class="section-header">
          <span class="material-icons">delivery_dining</span>
          <h2>Flota y Servicios</h2>
        </div>
        <div class="category-grid">
          <div class="action-card" @click="router.push('/admin/shuttles')">
            <div class="card-icon"><span class="material-icons">airport_shuttle</span></div>
            <div class="card-content">
              <h3>Shuttles</h3>
              <p>Viajes turísticos.</p>
            </div>
          </div>

          <div class="action-card" @click="router.push('/admin/drivers')">
            <div class="card-icon"><span class="material-icons">badge</span></div>
            <div class="card-content">
              <h3>Conductores</h3>
              <p>Gestión de personal.</p>
            </div>
          </div>
        </div>
      </section>

      <!-- Sector: Comercial -->
      <section class="admin-section">
        <div class="section-header">
          <span class="material-icons">hub</span>
          <h2>Ecosistema Comercial</h2>
        </div>
        <div class="category-grid">
          <div class="action-card promoter-card" @click="router.push('/promoter')">
            <div class="card-icon"><span class="material-icons">storefront</span></div>
            <div class="card-content">
              <h3>Negocios</h3>
              <p>Promos y locales.</p>
            </div>
          </div>
        </div>
      </section>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
const router = useRouter()
</script>

<style scoped>
.admin-panel {
  padding: 60px 24px 120px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
}

.header-section {
  text-align: center;
  margin-bottom: 60px;
}

.badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(254, 231, 21, 0.1);
  color: var(--active-color);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  margin-bottom: 16px;
  border: 1px solid rgba(254, 231, 21, 0.2);
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  margin: 0;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  margin-top: 6px;
  letter-spacing: 0.05em;
}

.dashboard-sections {
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center; /* Centra el contenido de la sección */
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--active-color);
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  max-width: 800px; /* Línea de división elegante y no tan larga */
  justify-content: center;
}

.section-header .material-icons {
  font-size: 1.2rem;
}

.section-header h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  margin: 0;
  color: var(--text-secondary);
}

.category-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* ESTO CENTRA LAS TARJETAS */
  gap: 24px;
  width: 100%;
}

.action-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 24px 28px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 340px; /* Ancho fijo para mantener la simetría */
  min-height: 110px;
}

.action-card:hover {
  transform: translateY(-5px);
  border-color: var(--active-color);
  background: rgba(254, 231, 21, 0.03);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.card-icon {
  width: 52px;
  height: 52px;
  background: var(--bg-secondary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s;
}

.action-card:hover .card-icon {
  background: var(--active-color);
  transform: rotate(-10deg);
}

.card-icon .material-icons {
  font-size: 24px;
  color: var(--active-color);
}

.action-card:hover .card-icon .material-icons {
  color: #101820;
}

.card-content h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.card-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

.promoter-card {
  background: linear-gradient(135deg, rgba(254, 231, 21, 0.05) 0%, rgba(30, 41, 59, 0.2) 100%);
}

@media (max-width: 600px) {
  .admin-panel { padding: 30px 16px 120px; }
  .category-grid {
    flex-direction: column;
    align-items: center;
  }
  .action-card {
    width: 100%;
    max-width: 340px;
  }
  .header-section { text-align: center; padding: 0; }
}
</style>
