/**
 * U-Snap it — Recording Experience Improvements
 * Clean, premium styling for the video capture flow
 * 
 * Addresses:
 * - Recording timer visibility
 * - Coaching text contrast
 * - State transitions
 * - Visual recording indicator
 */

/* ============================================
   RECORDING TIMER
   ============================================ */

.recording-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  font-family: var(--font-mono, 'SF Mono', 'Monaco', monospace);
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.recording-timer.visible {
  opacity: 1;
}

/* Recording indicator dot */
.recording-timer::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Timer color states based on duration */
.recording-timer.good {
  color: #34c759;
}

.recording-timer.good::before {
  background: #34c759;
}

.recording-timer.warning {
  color: #ff9500;
}

.recording-timer.warning::before {
  background: #ff9500;
}

.recording-timer.long {
  color: #ff3b30;
}

/* Duration hint */
.recording-timer-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  margin-left: 4px;
}

/* ============================================
   COACHING TEXT IMPROVEMENTS
   ============================================ */

/* Main coaching prompt - high contrast */
#coachCurrent,
.capture-coach-prompt {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.5;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  margin: 0 auto;
}

/* Current step highlight */
.capture-coach-prompt strong {
  color: var(--accent);
  font-weight: 600;
}

/* Step indicator overlay */
.capture-step-indicator {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #ffffff;
  z-index: 100;
}

.capture-step-indicator .step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.capture-step-indicator .step-dot.active {
  background: var(--accent);
}

.capture-step-indicator .step-dot.done {
  background: #34c759;
}

/* ============================================
   RECORDING STATE IMPROVEMENTS
   ============================================ */

/* Live recording border glow */
.capture-shell.is-recording {
  box-shadow: 
    0 0 0 3px #ff3b30,
    0 0 30px rgba(255, 59, 48, 0.4);
  animation: recording-border-pulse 2s ease-in-out infinite;
}

@keyframes recording-border-pulse {
  0%, 100% { 
    box-shadow: 
      0 0 0 3px #ff3b30,
      0 0 30px rgba(255, 59, 48, 0.4);
  }
  50% { 
    box-shadow: 
      0 0 0 3px #ff3b30,
      0 0 50px rgba(255, 59, 48, 0.6);
  }
}

/* REC badge in corner */
.rec-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #ff3b30;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
  z-index: 100;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.rec-badge.visible {
  opacity: 1;
  transform: scale(1);
}

.rec-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  animation: rec-dot 1s ease-in-out infinite;
}

@keyframes rec-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================
   STOP BUTTON CLARITY
   ============================================ */

/* When recording, make stop button MORE obvious */
#recordingControls .record-btn.recording {
  position: relative;
}

/* Add STOP label under button while recording */
#recordingControls .record-btn.recording::before {
  content: "STOP";
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

/* ============================================
   VIDEO PREVIEW AFTER RECORDING
   ============================================ */

.video-preview-card {
  background: rgba(0, 0, 0, 0.85);
  border-radius: 16px;
  overflow: hidden;
  margin: 16px 0;
}

.video-preview-card video {
  width: 100%;
  display: block;
}

.video-preview-actions {
  display: flex;
  gap: 12px;
  padding: 16px;
  justify-content: center;
}

.video-preview-actions .btn {
  flex: 1;
  max-width: 160px;
}

.video-preview-duration {
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Jax speaking animation */
.jax-avatar-sm.speaking {
  animation: jax-speak 0.5s ease-in-out infinite;
}

@keyframes jax-speak {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ============================================
   CAPTURE OVERLAY TEXT IMPROVEMENTS
   ============================================ */

/* Top frame guide text */
.capture-overlay-top .capture-frame-guide {
  background: rgba(0, 0, 0, 0.75);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
}

/* Step instructions box */
.capture-step-instructions {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 400px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 16px;
  z-index: 50;
}

.capture-step-instructions .step-number {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.capture-step-instructions .step-text {
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 480px) {
  .recording-timer {
    font-size: 1rem;
    padding: 6px 14px;
  }
  
  #coachCurrent,
  .capture-coach-prompt {
    font-size: 0.9rem;
    padding: 12px 14px;
  }
  
  .capture-step-indicator {
    font-size: 0.75rem;
    padding: 4px 10px;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
  .recording-timer,
  #coachCurrent,
  .capture-coach-prompt {
    background: #000000;
    border: 2px solid #ffffff;
  }
  
  .rec-badge {
    background: #ff0000;
    border: 2px solid #ffffff;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .recording-timer::before,
  .rec-badge::before,
  .capture-shell.is-recording,
  .record-btn.recording {
    animation: none;
  }
}

/* ============================================
   TTS MUTE TOGGLE
   ============================================ */

.tts-toggle-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 200;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  color: #fff;
  transition: background 0.2s ease, transform 0.15s ease;
  padding: 0;
  line-height: 1;
}

.tts-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.08);
}

.tts-toggle-btn[aria-pressed="true"] {
  background: rgba(255, 107, 0, 0.2);
  border-color: rgba(255, 107, 0, 0.5);
}

/* ============================================
   TINT OVERLAY
   ============================================ */

.tint-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  border-radius: inherit;
  transition: background-color 0.4s ease, opacity 0.4s ease;
  background-color: transparent;
}

.tint-overlay.tint-good {
  background-color: rgba(52, 199, 89, 0.18);
}

.tint-overlay.tint-warn {
  background-color: rgba(255, 149, 0, 0.22);
}

.tint-overlay.tint-problem {
  background-color: rgba(255, 59, 48, 0.28);
}

.tint-reason-chip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 10;
}

/* ============================================
   SHOT LOCK BADGE
   ============================================ */

.shot-lock-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  z-index: 300;
  background: rgba(52, 199, 89, 0.92);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-display, 'Sora', sans-serif);
  padding: 14px 28px;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(52, 199, 89, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.shot-lock-badge--visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.shot-lock-badge--out {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* ============================================
   READINESS CHECKLIST OVERLAY
   ============================================ */

.capture-readiness-checklist {
  position: absolute;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
}

.capture-readiness-checklist[hidden] {
  display: none;
}

.readiness-checklist-inner {
  width: 90%;
  max-width: 360px;
  text-align: center;
}

.readiness-header {
  margin-bottom: 20px;
}

.readiness-header h3 {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 10px 0 4px;
}

.readiness-subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.88rem;
  margin: 0;
}

.readiness-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  text-align: left;
}

.readiness-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.readiness-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.readiness-start-btn {
  width: 100%;
  font-size: 1rem;
  padding: 14px 20px;
}

/* ============================================
   POST-CAPTURE CHECKLIST CARD
   ============================================ */

.capture-checklist-card {
  background: rgba(26, 26, 26, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 20px;
  margin: 16px 0;
}

.capture-checklist-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
}

.capture-checklist-subtext {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 14px;
}

.capture-checklist-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.capture-checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.capture-checklist-item:last-child {
  border-bottom: none;
}

.capture-checklist-item.capture-checklist-done {
  color: rgba(255, 255, 255, 0.65);
}

.capture-checklist-item.capture-checklist-skipped {
  color: rgba(255, 255, 255, 0.55);
}

.capture-checklist-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.capture-checklist-title {
  flex: 1;
}

.capture-checklist-outcome {
  flex: 1;
  line-height: 1.35;
}

.capture-checklist-rerecord {
  background: none;
  border: 1px solid rgba(255, 107, 0, 0.5);
  color: var(--accent, #FF6B00);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.capture-checklist-rerecord:hover {
  background: rgba(255, 107, 0, 0.12);
}

.capture-checklist-continue {
  width: 100%;
}
