/**
 * RSVP (Rapid Serial Visual Presentation) Reading Mode Styles
 */

/* RSVP Toggle Button */
.rsvp-toggle {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #6a1b9a, #8e24aa);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(106, 27, 154, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 9998;
}

.rsvp-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(106, 27, 154, 0.4);
}

.rsvp-toggle:active {
  transform: scale(0.95);
}

/* RSVP Modal Overlay */
.rsvp-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.rsvp-overlay.active {
  display: flex;
}

/* RSVP Modal */
.rsvp-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Modal Header */
.rsvp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 16px;
}

.rsvp-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a1a;
}

.rsvp-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease, color 0.2s ease;
}

.rsvp-close:hover {
  background: #f0f0f0;
  color: #1a1a1a;
}

/* Word Display Area */
.rsvp-display {
  min-height: 120px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background: #f8f9fa;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 30px;
  font-size: 2.5rem;
  font-weight: 500;
  font-family: 'Courier New', Consolas, Monaco, Menlo, monospace;
  line-height: 1.2;
  word-break: keep-all;
  position: relative;
  overflow: visible;
}

.rsvp-word {
  display: block;
  position: relative;
  width: 100%;
  white-space: nowrap;
  letter-spacing: 0;
  font-variant-ligatures: none;
  text-rendering: geometricPrecision;
}

.rsvp-word-container {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  transition: none; /* Disable all transitions for instant word updates */
}

.rsvp-before,
.rsvp-after {
  display: inline-block;
}

/* ORP (Optimal Recognition Point) Highlighting */
.rsvp-orp {
  color: #c62828;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-decoration-color: #c62828;
  display: inline-block;
  position: relative;
}

/* Controls Section */
.rsvp-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* WPM Control */
.rsvp-wpm-control {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rsvp-wpm-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: #666;
}

.rsvp-wpm-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #6a1b9a;
}

.rsvp-wpm-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #e0e0e0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.rsvp-wpm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6a1b9a;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.rsvp-wpm-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.rsvp-wpm-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6a1b9a;
  cursor: pointer;
  border: none;
  transition: transform 0.2s ease;
}

.rsvp-wpm-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* Play/Pause Button */
.rsvp-play-pause {
  background: linear-gradient(135deg, #6a1b9a, #8e24aa);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(106, 27, 154, 0.3);
}

.rsvp-play-pause:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(106, 27, 154, 0.4);
}

.rsvp-play-pause:active {
  transform: translateY(0);
}

/* Status Message */
.rsvp-status {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
  .rsvp-toggle {
    top: 70px;
    right: 10px;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
  }
  
  .rsvp-modal {
    width: 95%;
    padding: 20px;
    gap: 18px;
  }
  
  .rsvp-display {
    font-size: 2rem;
    min-height: 100px;
    padding: 20px;
    font-family: 'Courier New', Consolas, Monaco, Menlo, monospace;
  }
  
  .rsvp-header h2 {
    font-size: 1.3rem;
  }
}

/* Accessibility */
.rsvp-toggle:focus,
.rsvp-close:focus,
.rsvp-play-pause:focus,
.rsvp-wpm-slider:focus {
  outline: 3px solid #6a1b9a;
  outline-offset: 2px;
}

/* Print - hide RSVP UI */
@media print {
  .rsvp-toggle,
  .rsvp-overlay {
    display: none !important;
  }
}
