/* ========================================
   Intelligence Tab Layout
   ======================================== */
.intelligence-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.intelligence-section {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 24px;
  margin-bottom: 24px;
}

.intelligence-section.full-width {
  width: 100%;
}

.intelligence-section h2 {
  margin-top: 0;
  font-size: 20px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
   Summary Panel
   ======================================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.summary-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  padding: 20px;
  color: white;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.summary-card.critical {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.summary-card.warning {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.summary-card.info {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.summary-label {
  display: block;
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
  font-weight: 500;
}

.summary-value {
  display: block;
  font-size: 36px;
  font-weight: bold;
}

/* ========================================
   Chart Containers
   ======================================== */
.chart-container {
  position: relative;
  width: 100%;
  height: 400px;
  margin-top: 16px;
}

.chart-container canvas {
  max-width: 100%;
  height: 100%;
}

/* ========================================
   Details Panel
   ======================================== */
.details-panel {
  margin-top: 16px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 4px;
  border-left: 4px solid #667eea;
}

.details-panel h3 {
  margin-top: 0;
  font-size: 16px;
  color: #333;
}

.details-panel .metric-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
}

.details-panel .metric-row:last-child {
  border-bottom: none;
}

.details-panel .metric-label {
  font-weight: 500;
  color: #666;
}

.details-panel .metric-value {
  font-weight: bold;
  color: #333;
}

/* ========================================
   Alert Cards Grid
   ======================================== */
.alert-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.alert-card {
  background: #ffffff;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s;
}

.alert-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

.alert-card.critical {
  border-left-color: #f5576c;
}

.alert-card.warning {
  border-left-color: #ffa726;
}

.alert-card.info {
  border-left-color: #29b6f6;
}

.alert-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.alert-card-keyword {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.alert-card-level {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.alert-card-level.critical {
  background: #f5576c;
  color: white;
}

.alert-card-level.warning {
  background: #ffa726;
  color: white;
}

.alert-card-level.info {
  background: #29b6f6;
  color: white;
}

.alert-card-body {
  margin-bottom: 12px;
}

.alert-card-message {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.5;
}

.alert-card-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  font-size: 12px;
}

.alert-card-metric {
  display: flex;
  justify-content: space-between;
}

.alert-card-metric-label {
  color: #999;
}

.alert-card-metric-value {
  font-weight: bold;
  color: #333;
}

.alert-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #e9ecef;
  font-size: 12px;
  color: #999;
}

/* ========================================
   Loading State
   ======================================== */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0,0,0,0.1);
  border-left-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-message {
  text-align: center;
  padding: 40px;
  color: #999;
}

.loading-message::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0,0,0,0.1);
  border-left-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 12px;
  vertical-align: middle;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state-message {
  font-size: 16px;
}

/* ========================================
   Error State
   ======================================== */
.error-state {
  text-align: center;
  padding: 40px 20px;
  color: #f5576c;
  background: #fff5f7;
  border-radius: 8px;
  border: 1px solid #f5576c;
}

.error-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-state-message {
  font-size: 16px;
  font-weight: 500;
}

/* ========================================
   Beta Badge
   ======================================== */
.beta-badge {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
  .intelligence-container {
    padding: 12px;
  }

  .intelligence-section {
    padding: 16px;
  }

  .intelligence-section h2 {
    font-size: 18px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .alert-cards-grid {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 300px;
  }

  .summary-value {
    font-size: 28px;
  }

  .alert-card-keyword {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .intelligence-container {
    padding: 8px;
  }

  .intelligence-section {
    padding: 12px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 250px;
  }

  .summary-card {
    padding: 16px;
  }

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