import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RoutesPerformanceDashboardComponent } from './routes-performance-dashboard.component';

/**
 * 🎯 Exemplo de Integração do Dashboard de Performance de Rotas
 * 
 * Este componente demonstra como integrar o dashboard na página principal
 * Posiciona o dashboard na parte inferior da tela conforme solicitado
 */
@Component({
  selector: 'app-routes-performance-example',
  standalone: true,
  imports: [CommonModule, RoutesPerformanceDashboardComponent],
  template: `
    <div class="dashboard-integration-example">
      
      <!-- 📊 Seção Superior - KPIs Existentes do Dashboard Principal -->
      <div class="existing-dashboard-section">
        <h2>Dashboard Principal Existente</h2>
        <div class="existing-kpis">
          <div class="kpi-card">
            <h3>Veículos em uso</h3>
            <div class="kpi-value">R$ 135,7M</div>
            <div class="kpi-trend positive">+66,9%</div>
          </div>
          <div class="kpi-card">
            <h3>Veículos a venda</h3>
            <div class="kpi-value">R$ 518,0K</div>
            <div class="kpi-trend positive">+0,3%</div>
          </div>
          <div class="kpi-card">
            <h3>Veículos alugados</h3>
            <div class="kpi-value">R$ 3,3M</div>
            <div class="kpi-trend negative">-1,6%</div>
          </div>
          <div class="kpi-card">
            <h3>Saldo de financiamento</h3>
            <div class="kpi-value">R$ 4,4M</div>
            <div class="kpi-trend positive">+2,2%</div>
          </div>
        </div>
      </div>

      <!-- 🛣️ Seção Inferior - Dashboard de Performance de Rotas -->
      <div class="routes-performance-section">
        <app-routes-performance-dashboard
          [compactMode]="false"
          [showFilters]="true"
          [autoRefresh]="true"
          [refreshInterval]="30000">
        </app-routes-performance-dashboard>
      </div>

    </div>
  `,
  styles: [`
    .dashboard-integration-example {
      width: 100%;
      min-height: 100vh;
      background: #0A0A0F;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 32px;
    }

    .existing-dashboard-section {
      h2 {
        color: #fff;
        font-size: 24px;
        font-weight: 600;
        margin-bottom: 20px;
        text-align: center;
      }

      .existing-kpis {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
        margin-bottom: 20px;

        .kpi-card {
          background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
          border-radius: 12px;
          padding: 24px;
          backdrop-filter: blur(10px);
          border: 1px solid rgba(255, 255, 255, 0.1);
          text-align: center;

          h3 {
            color: rgba(255, 255, 255, 0.8);
            font-size: 14px;
            font-weight: 500;
            margin: 0 0 12px 0;
          }

          .kpi-value {
            color: #fff;
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 8px;
          }

          .kpi-trend {
            font-size: 12px;
            font-weight: 600;

            &.positive {
              color: #00FF88;
            }

            &.negative {
              color: #FF0055;
            }
          }
        }
      }
    }

    .routes-performance-section {
      flex: 1;
      min-height: 600px;
    }

    @media (max-width: 768px) {
      .dashboard-integration-example {
        padding: 16px;
        gap: 24px;
      }

      .existing-kpis {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;

        .kpi-card {
          padding: 20px;

          .kpi-value {
            font-size: 24px;
          }
        }
      }
    }

    @media (max-width: 480px) {
      .existing-kpis {
        grid-template-columns: 1fr;
      }
    }
  `]
})
export class RoutesPerformanceExampleComponent {
  
  constructor() {
    console.log('🎯 Dashboard de Performance de Rotas carregado!');
    console.log('📊 Componente pronto para integração no dashboard principal');
  }
}
