/* =============================================================
   ROUTRELL ANALYTICS - PERFORMANCE STYLES
   ============================================================= */

/* Envelopamento - Todos os estilos dentro do container */
#routrell-analytics-performance * {
  box-sizing: border-box;
}

#routrell-analytics-performance {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================
   PAGE HEADER
   ============================================ */

#routrell-analytics-performance .page-header {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

#routrell-analytics-performance .page-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

#routrell-analytics-performance .page-title i {
  color: #007bff;
}

#routrell-analytics-performance .page-subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  margin: 0;
}

/* ============================================
   FILTROS
   ============================================ */

#routrell-analytics-performance .performance-filters {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-wrap: wrap;
  align-items: center;
}

#routrell-analytics-performance .filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

#routrell-analytics-performance .filter-group label {
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  white-space: nowrap;
}

#routrell-analytics-performance .filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 150px;
}

#routrell-analytics-performance .filter-select:hover {
  border-color: #007bff;
}

#routrell-analytics-performance .filter-select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* ============================================
   CARDS DE RESUMO
   ============================================ */

#routrell-analytics-performance .summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

#routrell-analytics-performance .summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s;
}

#routrell-analytics-performance .summary-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

#routrell-analytics-performance .summary-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0f2fe 0%, #bfdbfe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #0369a1;
  flex-shrink: 0;
}

#routrell-analytics-performance .summary-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#routrell-analytics-performance .summary-label {
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#routrell-analytics-performance .summary-value {
  color: var(--text);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
}

#routrell-analytics-performance .summary-period {
  color: var(--text-light);
  font-size: 0.75rem;
}

#routrell-analytics-performance .summary-trend {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 4px;
}

#routrell-analytics-performance .summary-trend.up {
  color: #059669;
}

#routrell-analytics-performance .summary-trend.down {
  color: #dc2626;
}

/* ============================================
   SECTION TITLE
   ============================================ */

#routrell-analytics-performance .section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

#routrell-analytics-performance .section-title i {
  color: #007bff;
}

/* ============================================
   CHART SECTIONS
   ============================================ */

#routrell-analytics-performance .chart-section {
  margin-bottom: 30px;
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

#routrell-analytics-performance .chart-section.full-width {
  grid-column: 1 / -1;
}

#routrell-analytics-performance .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

#routrell-analytics-performance .chart-controls {
  display: flex;
  gap: 8px;
}

#routrell-analytics-performance .btn-chart-type {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1rem;
}

#routrell-analytics-performance .btn-chart-type:hover {
  background: var(--background);
  border-color: #007bff;
  color: #007bff;
}

#routrell-analytics-performance .btn-chart-type.active {
  background: #007bff;
  border-color: #007bff;
  color: white;
}

#routrell-analytics-performance .chart-container {
  margin-bottom: 20px;
  min-height: 300px;
}

#routrell-analytics-performance .chart-container canvas {
  max-height: 400px;
}

/* ============================================
   CHART STATS
   ============================================ */

#routrell-analytics-performance .chart-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

#routrell-analytics-performance .stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#routrell-analytics-performance .stat-label {
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 500;
}

#routrell-analytics-performance .stat-value {
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 700;
}

/* ============================================
   LEAD TIME BREAKDOWN
   ============================================ */

#routrell-analytics-performance .lead-time-breakdown {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 1px solid var(--border);
}

#routrell-analytics-performance .lead-time-breakdown h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 15px 0;
}

#routrell-analytics-performance .breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#routrell-analytics-performance .breakdown-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-light);
  gap: 10px;
}

#routrell-analytics-performance .breakdown-item {
  display: flex;
  align-items: center;
  gap: 15px;
}

#routrell-analytics-performance .breakdown-label {
  min-width: 120px;
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
}

#routrell-analytics-performance .breakdown-bar-container {
  flex: 1;
  height: 24px;
  background: var(--background);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}

#routrell-analytics-performance .breakdown-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  transition: width 0.5s ease;
}

#routrell-analytics-performance .breakdown-value {
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ============================================
   CFD LEGEND
   ============================================ */

#routrell-analytics-performance .cfd-legend {
  margin-top: 20px;
  padding: 15px;
  background: var(--background);
  border-radius: 8px;
  border-left: 4px solid #007bff;
}

#routrell-analytics-performance .cfd-legend p {
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
}

#routrell-analytics-performance .cfd-legend strong {
  color: var(--text);
}

/* ============================================
   CONTROL CHART INFO
   ============================================ */

#routrell-analytics-performance .control-chart-info {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  background: var(--background);
  border-radius: 8px;
}

#routrell-analytics-performance .info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-light);
  font-size: 0.9rem;
}

#routrell-analytics-performance .info-item i {
  color: #007bff;
  font-size: 1rem;
}

/* ============================================
   VELOCITY INSIGHTS
   ============================================ */

#routrell-analytics-performance .velocity-insights {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#routrell-analytics-performance .insight-item {
  padding: 15px;
  background: var(--background);
  border-left: 4px solid;
  border-radius: 6px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

#routrell-analytics-performance .insight-item.positive {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

#routrell-analytics-performance .insight-item.negative {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.05);
}

#routrell-analytics-performance .insight-item.neutral {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

#routrell-analytics-performance .insight-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

#routrell-analytics-performance .insight-item.positive .insight-icon {
  color: #10b981;
}

#routrell-analytics-performance .insight-item.negative .insight-icon {
  color: #dc2626;
}

#routrell-analytics-performance .insight-item.neutral .insight-icon {
  color: #3b82f6;
}

#routrell-analytics-performance .insight-text {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ============================================
   COMPARISON TABLES
   ============================================ */

#routrell-analytics-performance .comparison-section {
  margin-bottom: 30px;
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

#routrell-analytics-performance .comparison-table-container {
  overflow-x: auto;
}

#routrell-analytics-performance .comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#routrell-analytics-performance .comparison-table thead {
  background: var(--background);
}

#routrell-analytics-performance .comparison-table th {
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

#routrell-analytics-performance .comparison-table td {
  padding: 12px 15px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

#routrell-analytics-performance .comparison-table tbody tr {
  transition: background 0.2s;
}

#routrell-analytics-performance .comparison-table tbody tr:hover {
  background: var(--background);
}

#routrell-analytics-performance .comparison-table tbody tr:last-child td {
  border-bottom: none;
}

#routrell-analytics-performance .loading-cell {
  text-align: center;
  padding: 40px 20px !important;
  color: var(--text-light);
}

#routrell-analytics-performance .loading-cell i {
  margin-right: 8px;
}

#routrell-analytics-performance .table-member-name {
  font-weight: 600;
  color: var(--text);
}

#routrell-analytics-performance .table-board-name {
  font-weight: 600;
  color: var(--text);
}

#routrell-analytics-performance .efficiency-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

#routrell-analytics-performance .efficiency-badge.high {
  background: #d1fae5;
  color: #065f46;
}

#routrell-analytics-performance .efficiency-badge.medium {
  background: #fef3c7;
  color: #92400e;
}

#routrell-analytics-performance .efficiency-badge.low {
  background: #fee2e2;
  color: #991b1b;
}

html.dark-theme #routrell-analytics-performance .efficiency-badge.high {
  background: #064e3b;
  color: #6ee7b7;
}

html.dark-theme #routrell-analytics-performance .efficiency-badge.medium {
  background: #78350f;
  color: #fef3c7;
}

html.dark-theme #routrell-analytics-performance .efficiency-badge.low {
  background: #7f1d1d;
  color: #fca5a5;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  #routrell-analytics-performance .performance-filters {
    flex-direction: column;
    align-items: stretch;
  }

  #routrell-analytics-performance .filter-group {
    width: 100%;
  }

  #routrell-analytics-performance .filter-select {
    flex: 1;
  }

  #routrell-analytics-performance .summary-cards {
    grid-template-columns: 1fr;
  }

  #routrell-analytics-performance .chart-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  #routrell-analytics-performance .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  #routrell-analytics-performance .chart-controls {
    width: 100%;
    justify-content: center;
  }

  #routrell-analytics-performance .comparison-table {
    font-size: 0.8rem;
  }

  #routrell-analytics-performance .comparison-table th,
  #routrell-analytics-performance .comparison-table td {
    padding: 8px 10px;
  }
}