/* Advanced Video Coach - Modern Professional Design */

/* Enhanced Video Coach Container */
.advanced-video-coach-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Real-time Metrics Dashboard */
.metrics-dashboard {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  color: #fff;
}

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

.metric-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.metric-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(94, 129, 244, 0.3);
  border-color: #5e81f4;
}

.metric-value {
  font-size: 2.5em;
  font-weight: bold;
  background: linear-gradient(45deg, #5e81f4, #c67ace);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 5px;
}

.metric-label {
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px; /* Reduced gap for smaller screens */
  }

  .metric-card {
    padding: 15px; /* Slightly reduce padding */
  }

  .metric-value {
    font-size: 2em; /* Adjust font size */
  }

  .metric-label {
    font-size: 0.8em; /* Adjust font size */
  }
}

/* Enhanced Video Display Area */
.enhanced-video-container {
  position: relative;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  margin-bottom: 30px;
}

.enhanced-video-container video {
  width: 100%;
  height: auto;
  display: block;
}

#poseOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Real-time Feedback Display */
.realtime-feedback-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 20px;
  min-width: 300px;
  max-width: 400px;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.feedback-header h3 {
  margin: 0;
  color: #fff;
  font-size: 1.2em;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
}

.live-dot {
  width: 10px;
  height: 10px;
  background: #ff3838;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Enhanced Feedback Display */
.feedback-display {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  text-align: center;
  transition: all 0.3s ease;
}

.feedback-display.feedback-critical {
  background: rgba(255, 56, 56, 0.2);
  border: 1px solid #ff3838;
  color: #ff6b6b;
  animation: shake 0.5s;
}

.feedback-display.feedback-high {
  background: rgba(255, 171, 0, 0.2);
  border: 1px solid #ffab00;
  color: #ffc947;
}

.feedback-display.feedback-medium {
  background: rgba(94, 129, 244, 0.2);
  border: 1px solid #5e81f4;
  color: #8da4ff;
}

.feedback-display.feedback-low {
  background: rgba(0, 255, 136, 0.2);
  border: 1px solid #00ff88;
  color: #4dffa6;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Rep Counter Display */
#repCounter {
  font-size: 2em;
  font-weight: bold;
  text-align: center;
  margin-bottom: 10px;
  color: #5e81f4;
}

#repPhase {
  text-align: center;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-block;
  margin: 0 auto;
}

.phase-eccentric {
  background: rgba(255, 171, 0, 0.2);
  color: #ffab00;
}

.phase-concentric {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
}

.phase-idle {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
}

/* Injury Risk Indicator */
#injuryRiskIndicator {
  margin-top: 15px;
  padding: 10px;
  border-radius: 10px;
  text-align: center;
  font-weight: bold;
  transition: all 0.3s ease;
}

.risk-low {
  background: rgba(0, 255, 136, 0.1);
  color: #00ff88;
}

.risk-medium {
  background: rgba(255, 171, 0, 0.1);
  color: #ffab00;
}

.risk-high {
  background: rgba(255, 56, 56, 0.2);
  color: #ff6b6b;
}

.risk-critical {
  background: rgba(255, 0, 0, 0.3);
  color: #ff3838;
  animation: pulse 1s infinite;
}

/* Compensation Warning */
#compensationWarning {
  display: none;
  background: rgba(255, 56, 56, 0.2);
  border: 1px solid #ff3838;
  color: #ff6b6b;
  padding: 10px;
  border-radius: 10px;
  margin-top: 10px;
  text-align: center;
  font-size: 0.9em;
}

/* Session Summary Modal */
#sessionSummary {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  color: #fff;
}

#sessionSummary h3 {
  margin-top: 0;
  color: #5e81f4;
}

/* Responsive adjustments for .realtime-feedback-panel */
@media (max-width: 768px) {
  .realtime-feedback-panel {
    position: relative; /* Change from absolute */
    top: auto;
    right: auto;
    margin: 20px auto; /* Center it and add some margin */
    width: 90%; /* Allow it to take most of the width */
    max-width: 400px; /* But not exceed its max-width */
    min-width: unset; /* Remove min-width on small screens */
  }
  font-size: 1.8em;
  text-align: center;
}

#sessionSummary p {
  margin: 15px 0;
  font-size: 1.1em;
}

#sessionSummary .warning {
  background: rgba(255, 56, 56, 0.2);
  border: 1px solid #ff3838;
  color: #ff6b6b;
  padding: 10px;
  border-radius: 10px;
  margin: 20px 0;
}

/* Advanced Controls Panel */
.advanced-controls {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 20px;
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.control-section {
  margin-bottom: 20px;
}

.control-section h4 {
  color: #5e81f4;
  margin-bottom: 15px;
  font-size: 1.2em;
}

.voice-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.setting-item label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9em;
}

.setting-item select,
.setting-item input[type="range"] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  padding: 8px;
}

/* Dropdown option styling for better visibility */
.setting-item select option {
  background-color: #fff;
  color: #000;
  padding: 8px;
}

.setting-item select option:hover {
  background-color: #f0f0f0;
}

.setting-item select option:checked {
  background-color: #5e81f4;
  color: #fff;
}

/* Dark mode adjustments for select dropdowns */
@media (prefers-color-scheme: dark) {
  .setting-item select option {
    background-color: #1a1a2e;
    color: #fff;
  }
  
  .setting-item select option:hover {
    background-color: #2a2a3e;
  }
  
  .setting-item select option:checked {
    background-color: #5e81f4;
    color: #fff;
  }
}

/* Light mode specific styling */
body:not(.dark-mode) .setting-item select option {
  background-color: #fff;
  color: #000;
}

body:not(.dark-mode) .setting-item select option:hover {
  background-color: #f0f0f0;
}

body:not(.dark-mode) .setting-item select option:checked {
  background-color: #5e81f4;
  color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .metric-card {
    padding: 15px;
  }
  
  .metric-value {
    font-size: 2em;
  }
  
  .realtime-feedback-panel {
    position: static;
    margin: 20px 0;
    max-width: 100%;
    border-radius: 15px;
  }
  
  .enhanced-video-container {
    margin-bottom: 20px;
  }
  
  #sessionSummary {
    padding: 20px;
    width: 95%;
  }
  
  .voice-settings {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .metric-value {
    font-size: 1.8em;
  }
  
  .feedback-display {
    font-size: 1em;
    padding: 12px;
  }
  
  #repCounter {
    font-size: 1.5em;
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .advanced-video-coach-wrapper {
    color: #fff;
  }
}

/* Smooth transitions */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Loading animation */
.loading-skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 100%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Glassmorphism effects */
.glass-effect {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
}

/* Video Trimmer Styles */
.video-trimmer {
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.video-trimmer h4 {
  color: #fff;
  font-size: 1.3em;
  margin-bottom: 10px;
}

.trimmer-info {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 20px;
  font-size: 0.9em;
}

.video-preview-container {
  margin-bottom: 20px;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

#trimmerVideo {
  width: 100%;
  height: auto;
  display: block;
}

.trim-controls {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
}

.time-selector {
  margin-bottom: 20px;
}

.time-selector label {
  color: rgba(255, 255, 255, 0.9);
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
}

.time-selector input[type="range"] {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 5px;
}

.time-selector input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(45deg, #5e81f4, #c67ace);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(94, 129, 244, 0.4);
}

.time-selector input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(45deg, #5e81f4, #c67ace);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(94, 129, 244, 0.4);
  border: none;
}

.time-selector span {
  color: #5e81f4;
  font-weight: 600;
  font-size: 1.1em;
}

.duration-info {
  background: rgba(94, 129, 244, 0.1);
  border: 1px solid rgba(94, 129, 244, 0.3);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  color: #fff;
  margin-top: 20px;
}

.duration-info i {
  color: #5e81f4;
  margin-right: 5px;
}

.duration-info #selectedDuration {
  font-weight: 600;
  color: #5e81f4;
}

.trimmer-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.trimmer-actions button {
  padding: 12px 30px;
  border-radius: 25px;
  font-size: 1em;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

/* Exercise Selector Button Styles */
.exercise-selector-wrapper {
  position: relative;
  width: 100%;
}

.exercise-select-btn {
  width: 100%;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 1em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
}

.exercise-select-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #5e81f4;
}

.exercise-select-btn:focus {
  outline: none;
  border-color: #5e81f4;
  box-shadow: 0 0 0 2px rgba(94, 129, 244, 0.2);
}

.exercise-select-btn i:first-child {
  color: #5e81f4;
  font-size: 1.2em;
}

.exercise-select-btn i:last-child {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.8em;
  transition: transform 0.3s ease;
}

.exercise-select-btn:hover i:last-child {
  transform: translateY(2px);
}

#selectedExerciseName {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#selectedExerciseName.placeholder {
  color: #000;
}