/* StretchStrong - Movement Assessment Styles */
/* Advanced styling for interactive movement analysis system */

.movement-modal {
  z-index: 10000;
}

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

.movement-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border-radius: 16px 16px 0 0;
}

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

.assessment-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

/* Camera Container */
.camera-container {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin: 20px;
  aspect-ratio: 4/3;
  max-height: 400px;
}

#movement-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror video for better UX */
}

#movement-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scaleX(-1); /* Mirror canvas to match video */
}

.pose-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Exercise Instructions */
.exercise-instructions {
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  margin: 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.exercise-info {
  margin-bottom: 20px;
}

.exercise-info h3 {
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.exercise-info p {
  color: #64748b;
  margin: 0;
  font-size: 16px;
}

/* Real-time Feedback */
.real-time-feedback {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.feedback-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #2563eb;
}

.feedback-item i {
  color: #2563eb;
  font-size: 18px;
}

.feedback-item span {
  font-weight: 500;
  color: #374151;
}

/* Movement Guide */
.movement-guide {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.guide-figure {
  text-align: center;
}

.guide-figure h4 {
  margin: 0 0 12px 0;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
}

/* Progress Steps */
.assessment-progress {
  display: flex;
  justify-content: center;
  padding: 20px;
  margin-top: 20px;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 80px;
}

.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 70%;
  width: 60px;
  height: 3px;
  background: #e5e7eb;
  z-index: 1;
}

.progress-step.completed:not(:last-child)::after,
.progress-step.active:not(:last-child)::after {
  background: #2563eb;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: #9ca3af;
  font-weight: 600;
  font-size: 18px;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.progress-step.active .step-number {
  background: #2563eb;
  color: white;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.progress-step.completed .step-number {
  background: #10b981;
  color: white;
}

.step-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  text-align: center;
}

.progress-step.active .step-label {
  color: #2563eb;
  font-weight: 600;
}

/* Assessment Results */
.assessment-results {
  padding: 0;
}

.results-header {
  display: flex;
  gap: 40px;
  padding: 30px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  align-items: center;
}

.overall-score {
  position: relative;
}

.score-circle {
  position: relative;
  width: 120px;
  height: 120px;
}

.score-ring {
  transform: rotate(-90deg);
}

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

.score-number {
  font-size: 28px;
  font-weight: 700;
  color: #2563eb;
  line-height: 1;
}

.score-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.score-breakdown {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.area-score {
  display: flex;
  align-items: center;
  gap: 16px;
}

.area-name {
  min-width: 80px;
  font-weight: 600;
  color: #374151;
}

.area-value {
  min-width: 50px;
  font-weight: 700;
  color: #2563eb;
}

.area-bar {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.area-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #2563eb 100%);
  transition: width 0.6s ease;
}

/* Results Details */
.results-details {
  padding: 30px;
}

.results-section {
  margin-bottom: 40px;
}

.results-section:last-child {
  margin-bottom: 0;
}

.results-section h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 20px 0;
}

.analysis-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.analysis-item h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.analysis-feedback {
  color: #64748b;
  margin: 0 0 16px 0;
  line-height: 1.6;
}

.recommendations {
  background: white;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid #2563eb;
}

.recommendations strong {
  color: #2563eb;
  font-weight: 600;
}

.recommendations ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.recommendations li {
  color: #374151;
  margin-bottom: 4px;
}

/* Risk Factors */
.risk-factors {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.risk-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-left: 4px solid transparent;
}

.risk-item.low {
  border-left-color: #10b981;
}

.risk-item.moderate {
  border-left-color: #f59e0b;
}

.risk-item.high {
  border-left-color: #ef4444;
}

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

.risk-level {
  display: flex;
  align-items: center;
  gap: 12px;
}

.risk-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.risk-badge.low {
  background: #d1fae5;
  color: #065f46;
}

.risk-badge.moderate {
  background: #fef3c7;
  color: #92400e;
}

.risk-badge.high {
  background: #fee2e2;
  color: #991b1b;
}

.risk-score {
  font-weight: 700;
  color: #2563eb;
  font-size: 14px;
}

/* Program Recommendation */
.program-recommendation {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  padding: 24px;
  border-radius: 12px;
}

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

.program-header h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.program-duration {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

.program-exercises {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.program-exercise {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.program-exercise i {
  color: #93c5fd;
  font-size: 16px;
}

/* Fallback Assessment */
.fallback-assessment {
  padding: 30px;
  text-align: center;
}

.fallback-header {
  margin-bottom: 30px;
}

.fallback-header i {
  font-size: 48px;
  color: #2563eb;
  margin-bottom: 16px;
}

.fallback-header h3 {
  font-size: 24px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.fallback-questions {
  text-align: left;
  max-width: 600px;
  margin: 0 auto 30px auto;
}

.question {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.question label {
  font-weight: 600;
  color: #1e293b;
  display: block;
  margin-bottom: 12px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-group label {
  font-weight: 400;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.radio-group label:hover {
  background: #e2e8f0;
}

.radio-group input[type="radio"] {
  margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .movement-modal-content {
    width: 95vw;
    margin: 20px auto;
  }
  
  .results-header {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  .score-breakdown {
    width: 100%;
  }
  
  .assessment-progress {
    overflow-x: auto;
    justify-content: flex-start;
    padding: 20px 10px;
  }
  
  .progress-step {
    min-width: 60px;
  }
  
  .progress-step:not(:last-child)::after {
    width: 40px;
    left: 80%;
  }
  
  .camera-container {
    margin: 10px;
  }
  
  .exercise-instructions {
    margin: 10px;
    padding: 16px;
  }
  
  .real-time-feedback {
    grid-template-columns: 1fr;
  }
  
  .movement-guide {
    position: static;
    margin: 10px;
  }
}

@media (max-width: 480px) {
  .movement-modal .modal-title {
    font-size: 20px;
  }
  
  .area-score {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .area-name {
    min-width: auto;
  }
  
  .area-value {
    min-width: auto;
  }
  
  .program-exercises {
    grid-template-columns: 1fr;
  }
  
  .risk-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Animations */
@keyframes pulse-ring {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

.score-circle::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 2px solid #2563eb;
  border-radius: 50%;
  opacity: 0;
  animation: pulse-ring 2s infinite;
}

.feedback-item {
  transform: translateX(-10px);
  animation: slide-in 0.3s ease forwards;
}

@keyframes slide-in {
  to {
    transform: translateX(0);
  }
}

.analysis-item {
  transform: translateY(20px);
  opacity: 0;
  animation: fade-in-up 0.4s ease forwards;
}

.analysis-item:nth-child(2) { animation-delay: 0.1s; }
.analysis-item:nth-child(3) { animation-delay: 0.2s; }

@keyframes fade-in-up {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}