/* StretchStrong - AI Injury Predictor Dashboard Styles */
/* Advanced styling for AI-powered risk assessment and predictive analytics */

.ai-modal {
  z-index: 10001;
}

.ai-modal-content {
  max-width: 1200px;
  width: 95vw;
  max-height: 95vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* AI Header */
.ai-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 24px 30px;
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-header .modal-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-header .modal-title i {
  color: #3b82f6;
  font-size: 28px;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.ai-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  animation: ai-pulse 2s infinite;
}

.ai-indicator.loading {
  background: #f59e0b;
  animation: ai-loading 1s infinite;
}

@keyframes ai-pulse {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.5;
    transform: scale(1.2);
  }
}

@keyframes ai-loading {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* AI Body */
.ai-body {
  padding: 0;
}

/* Risk Overview Section */
.risk-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 30px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.overall-risk-card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.risk-meter {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.risk-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.risk-value span {
  font-size: 36px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}

.risk-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 600;
  margin-top: 4px;
}

.risk-trend h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 15px 0;
}

.risk-factors-card {
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.risk-factors-card h4 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.risk-factors-card h4 i {
  color: #f59e0b;
}

.risk-factors-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.risk-factor-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 4px solid #ef4444;
}

.risk-factor-name {
  font-weight: 500;
  color: #374151;
}

.risk-factor-impact {
  font-weight: 700;
  color: #ef4444;
  font-size: 14px;
}

/* Injury Predictions Section */
.injury-predictions {
  padding: 30px;
}

.injury-predictions h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 25px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.injury-predictions h3 i {
  color: #3b82f6;
}

.injury-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.injury-prediction-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  border-left: 5px solid #10b981;
  transition: all 0.3s ease;
}

.injury-prediction-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.injury-prediction-card.low-risk {
  border-left-color: #10b981;
}

.injury-prediction-card.moderate-risk {
  border-left-color: #f59e0b;
}

.injury-prediction-card.high-risk {
  border-left-color: #ef4444;
}

.injury-prediction-card.critical-risk {
  border-left-color: #dc2626;
  background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
}

.injury-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.injury-header h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.injury-risk-badge {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.injury-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confidence-bar {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
}

.confidence-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  position: relative;
  z-index: 2;
}

.confidence-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
  border-radius: 8px;
  transition: width 0.6s ease;
}

.time-to-injury {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.time-to-injury i {
  color: #3b82f6;
}

.top-factors {
  font-size: 13px;
}

.top-factors strong {
  color: #374151;
  font-weight: 600;
}

.top-factors ul {
  margin: 6px 0 0 0;
  padding-left: 16px;
  color: #64748b;
}

.top-factors li {
  margin-bottom: 4px;
}

/* Real-time Metrics */
.realtime-metrics {
  padding: 30px;
  background: #fafbfc;
}

.realtime-metrics h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 25px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.realtime-metrics h3 i {
  color: #ef4444;
  animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.metric-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}

.metric-icon.training {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.metric-icon.recovery {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.metric-icon.sleep {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.metric-icon.stress {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.metric-info {
  flex: 1;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}

.metric-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
  margin: 4px 0 6px 0;
}

.metric-trend {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-trend.up {
  color: #10b981;
}

.metric-trend.down {
  color: #ef4444;
}

/* AI Recommendations */
.ai-recommendations {
  padding: 30px;
  background: white;
}

.ai-recommendations h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 25px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-recommendations h3 i {
  color: #fbbf24;
}

.recommendations-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recommendation-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  border-left: 5px solid #3b82f6;
}

.recommendation-card.critical {
  border-left-color: #dc2626;
  background: linear-gradient(135deg, #fee2e2 0%, #fef2f2 100%);
}

.recommendation-card.high {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, #fef3c7 0%, #fffbeb 100%);
}

.recommendation-card.medium {
  border-left-color: #3b82f6;
  background: linear-gradient(135deg, #dbeafe 0%, #f0f9ff 100%);
}

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

.recommendation-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.recommendation-priority {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.recommendation-priority.critical {
  background: #dc2626;
  color: white;
}

.recommendation-priority.high {
  background: #f59e0b;
  color: white;
}

.recommendation-priority.medium {
  background: #3b82f6;
  color: white;
}

.recommendation-description {
  color: #64748b;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.recommendation-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recommendation-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.recommendation-btn:hover {
  background: #2563eb;
}

.recommendation-timeframe {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

/* Predictive Timeline */
.predictive-timeline {
  padding: 30px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.predictive-timeline h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 25px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.predictive-timeline h3 i {
  color: #3b82f6;
}

.timeline-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}

.timeline-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.timeline-btn {
  padding: 8px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  background: white;
  color: #64748b;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timeline-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

.timeline-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

/* AI Footer */
.ai-footer {
  padding: 20px 30px;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
  border-radius: 0 0 20px 20px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.ai-footer .btn {
  padding: 12px 20px;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.ai-footer .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .ai-modal-content {
    width: 95vw;
  }
  
  .risk-overview {
    grid-template-columns: 1fr;
  }
  
  .injury-grid {
    grid-template-columns: 1fr;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .ai-header {
    padding: 20px;
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .ai-header .modal-title {
    font-size: 22px;
  }
  
  .ai-body {
    padding: 0;
  }
  
  .risk-overview,
  .injury-predictions,
  .realtime-metrics,
  .ai-recommendations,
  .predictive-timeline {
    padding: 20px;
  }
  
  .overall-risk-card,
  .risk-factors-card {
    padding: 20px;
  }
  
  .metric-card {
    flex-direction: column;
    text-align: center;
  }
  
  .metric-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .ai-footer {
    padding: 16px 20px;
    flex-direction: column;
  }
  
  .ai-footer .btn {
    width: 100%;
    justify-content: center;
  }
  
  .timeline-controls {
    flex-wrap: wrap;
  }
  
  .timeline-btn {
    flex: 1;
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  .ai-header .modal-title {
    font-size: 18px;
  }
  
  .injury-prediction-card {
    padding: 16px;
  }
  
  .recommendation-action {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .recommendation-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Loading States */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Accessibility */
.metric-card:focus,
.injury-prediction-card:focus,
.recommendation-card:focus {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .ai-modal-content {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .ai-header {
    background: #000;
    color: #fff;
  }
  
  .ai-footer {
    display: none;
  }
}