/* Modern Dashboard Styles */
.analytics-dashboard {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f8fafc;
  padding: 2rem 0;
  color: #1e293b;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.dashboard-header {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dashboard-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.dashboard-subtitle {
  font-size: 1rem;
  color: #64748b;
  margin: 0;
}

.dashboard-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.refresh-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-btn:hover {
  background: #f1f5f9;
}

.time-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #64748b;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

.dashboard-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.status-card {
  grid-column: span 3;
}

.metrics-card {
  grid-column: span 3;
}

.activity-card {
  grid-column: span 3;
}

.analytics-card {
  grid-column: span 6;
}

.health-card {
  grid-column: span 6;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  flex-grow: 1;
}

.card-header i {
  color: #64748b;
  font-size: 1.1rem;
}

.card-actions .action-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}

.card-actions .action-btn:hover {
  color: #374151;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: #10b981;
  color: white;
}

.status-badge.active {
  background: #10b981;
}

.health-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: #10b981;
  color: white;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
}

.status-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.online {
  background: #10b981;
}

.status-indicator.warning {
  background: #f59e0b;
}

.status-indicator.offline {
  background: #ef4444;
}

.status-label {
  font-weight: 500;
  font-size: 0.9rem;
}

.status-value {
  font-size: 0.85rem;
  color: #64748b;
}

.status-chart {
  width: 80px;
  height: 30px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-visual {
  width: 100%;
  height: 80px;
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.metric-label {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0.25rem 0;
}

.metric-trend {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.metric-trend.positive {
  background: #ecfdf5;
  color: #10b981;
}

.metric-trend.negative {
  background: #fef2f2;
  color: #ef4444;
}

.metric-trend.neutral {
  background: #f8fafc;
  color: #64748b;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.activity-item:hover {
  background: #f8fafc;
}

.activity-icon {
  font-size: 1.1rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-item.success .activity-icon {
  color: #10b981;
}

.activity-item.info .activity-icon {
  color: #3b82f6;
}

.activity-item.warning .activity-icon {
  color: #f59e0b;
}

.activity-item.error .activity-icon {
  color: #ef4444;
}

.activity-content {
  flex-grow: 1;
}

.activity-content p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.activity-content small {
  font-size: 0.75rem;
  color: #64748b;
}

.analytics-content {
  display: flex;
  gap: 1.5rem;
}

.chart-container {
  flex-grow: 1;
  height: 200px;
}

.stats-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 120px;
}

.stat-item {
  text-align: center;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  display: block;
}

.stat-value.error {
  color: #ef4444;
}

.stat-label {
  font-size: 0.75rem;
  color: #64748b;
}

.time-filter select {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  color: #374151;
}

.health-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.health-metric {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 500;
}

.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .status-card, .metrics-card, .activity-card {
    grid-column: span 4;
  }
  .analytics-card, .health-card {
    grid-column: span 6;
  }
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-card {
    grid-column: span 1 !important;
  }
  .analytics-content {
    flex-direction: column;
  }
  .health-metrics {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* AI Models & Alerts Card Styles */
.ai-alerts-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  min-height: 500px;
  grid-column: span 6;
}

.ai-alerts-card .card-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-alerts-card .card-header h3 {
  color: white;
}

.ai-alerts-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
}

.ai-alerts-content h4 {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* AI Models Section */
.ai-models-section {
  flex: 1;
}

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.model-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.model-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.model-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.model-status.active {
  color: #10f5aa;
}

.model-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #10f5aa;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Alerts Section */
.alerts-section {
  flex: 1;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  border-left: 4px solid;
  transition: all 0.3s ease;
}

.alert-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.alert-item.critical {
  border-left-color: #ff4757;
}

.alert-item.warning {
  border-left-color: #ffa502;
}

.alert-item.info {
  border-left-color: #3742fa;
}

.alert-icon {
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.alert-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.alert-type {
  font-weight: 600;
  font-size: 0.9rem;
}

.alert-time {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.alert-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-weight: 500;
  width: fit-content;
}

.alert-status.sms-sent {
  background: #10f5aa;
  color: #1a1a1a;
}

.alert-status.monitoring {
  background: #ffa502;
  color: white;
}

.alert-status.completed {
  background: #3742fa;
  color: white;
}

/* Response Chart Section */
.response-chart-section {
  flex: 1;
}

.chart-mini-container {
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.chart-stats {
  display: flex;
  justify-content: space-around;
  gap: 1rem;
}

.chart-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.chart-stat .stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #10f5aa;
}

.chart-stat .stat-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Scrollbar Styling for Alerts */
.alerts-list::-webkit-scrollbar {
  width: 4px;
}

.alerts-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.alerts-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.alerts-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Responsive updates for new card */
@media (max-width: 1200px) {
  .ai-alerts-card {
    grid-column: span 12;
  }
}

@media (max-width: 900px) {
  .models-grid {
    grid-template-columns: 1fr;
  }
  
  .ai-alerts-content {
    gap: 1rem;
  }
  
  .alerts-list {
    max-height: 150px;
  }
}
