/* ============================================
   GENERATING MODAL - Aurora Neutrals + Electric Accents
   Beautiful modal shown when lesson generation starts
   ============================================ */

.generating-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.generating-modal.hidden {
  display: none;
}

.generating-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Backdrop - Blur effect */
.generating-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(245, 245, 250, 0.4);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Modal Content */
.generating-modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  padding: 48px 40px;
  max-width: 480px;
  width: 90%;
  box-shadow: 
    0 20px 60px rgba(120, 119, 198, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(120, 119, 198, 0.1);
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.generating-modal.visible .generating-modal-content {
  transform: scale(1);
  opacity: 1;
}

/* Header - Spinner */
.generating-modal-header {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.generating-spinner {
  position: relative;
  width: 80px;
  height: 80px;
}

.spinner-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-radius: 50%;
  animation: spinRotate 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.spinner-ring:nth-child(1) {
  border-top-color: #7877C6; /* Electric Purple */
  animation-duration: 1.8s;
}

.spinner-ring:nth-child(2) {
  border-right-color: #4C8BF5; /* Electric Blue */
  animation-duration: 2.2s;
  animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
  border-bottom-color: rgba(120, 119, 198, 0.3);
  animation-duration: 2.5s;
}

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

/* Body - Content */
.generating-modal-body {
  text-align: center;
}

.generating-modal-title {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

.generating-modal-topic {
  font-size: 18px;
  font-weight: 600;
  color: #7877C6;
  margin: 0 0 24px 0;
  line-height: 1.4;
  word-wrap: break-word;
}

.generating-modal-time {
  font-size: 16px;
  color: #5a5a6e;
  margin: 0 0 12px 0;
  line-height: 1.6;
}

.generating-modal-time strong {
  color: #1a1a2e;
  font-weight: 600;
}

.generating-modal-hint {
  font-size: 14px;
  color: #8a8a9e;
  margin: 0;
  line-height: 1.5;
}

/* Footer - Progress Bar */
.generating-modal-footer {
  margin-top: 32px;
}

.generating-progress-bar {
  height: 4px;
  background: rgba(120, 119, 198, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.generating-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7877C6 0%, #4C8BF5 100%);
  border-radius: 2px;
  width: 0%;
  transition: width 5s linear;
  box-shadow: 0 0 8px rgba(120, 119, 198, 0.4);
}

/* ============================================
   PROGRESS MODAL - Detailed Progress View
   ============================================ */

.progress-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-modal.hidden {
  display: none;
}

.progress-modal.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Backdrop */
.progress-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 26, 46, 0.6);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

/* Modal Content */
.progress-modal-content {
  position: relative;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 24px;
  padding: 40px;
  max-width: 520px;
  width: 90%;
  box-shadow: 
    0 24px 80px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(120, 119, 198, 0.15);
  transform: scale(0.95) translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-modal.visible .progress-modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Header - Circular Progress */
.progress-modal-header {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.progress-spinner {
  position: relative;
  width: 80px;
  height: 80px;
}

.progress-spinner svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.spinner-track {
  stroke: rgba(120, 119, 198, 0.1);
}

.spinner-progress {
  stroke: url(#progressGradient);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Add gradient definition (inline in JS or here as fallback) */
.spinner-progress {
  stroke: #7877C6;
}

.progress-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.percentage-value {
  font-size: 24px;
  font-weight: 700;
  color: #7877C6;
  line-height: 1;
}

.percentage-symbol {
  font-size: 14px;
  font-weight: 600;
  color: #7877C6;
  opacity: 0.6;
}

/* Close Button */
.progress-modal-close {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(120, 119, 198, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a5a6e;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.progress-modal-close:hover {
  background: #7877C6;
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(120, 119, 198, 0.3);
}

.progress-modal-close svg {
  width: 16px;
  height: 16px;
}

/* Body */
.progress-modal-body {
  text-align: center;
}

.progress-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
}

.progress-modal-topic {
  font-size: 16px;
  font-weight: 600;
  color: #7877C6;
  margin: 0 0 32px 0;
  line-height: 1.4;
  word-wrap: break-word;
}

/* Stats */
.progress-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin-bottom: 28px;
}

.progress-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.progress-stat-label {
  font-size: 13px;
  font-weight: 500;
  color: #8a8a9e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a2e;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.progress-stat-divider {
  width: 1px;
  height: 48px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(120, 119, 198, 0.2) 50%,
    transparent 100%
  );
}

/* Message */
.progress-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(120, 119, 198, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(120, 119, 198, 0.1);
}

.progress-message svg {
  flex-shrink: 0;
  color: #7877C6;
  margin-top: 2px;
}

.progress-message p {
  font-size: 14px;
  color: #5a5a6e;
  margin: 0;
  line-height: 1.5;
  text-align: left;
}

/* Footer - Buttons */
.progress-modal-footer {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  justify-content: center;
}

.progress-btn {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  outline: none;
}

.progress-btn-secondary {
  background: rgba(120, 119, 198, 0.08);
  color: #5a5a6e;
}

.progress-btn-secondary:hover {
  background: rgba(120, 119, 198, 0.15);
  color: #1a1a2e;
  transform: translateY(-1px);
}

.progress-btn-primary {
  background: linear-gradient(135deg, #7877C6 0%, #4C8BF5 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(120, 119, 198, 0.3);
}

.progress-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(120, 119, 198, 0.4);
  transform: translateY(-2px);
}

.progress-btn-primary:active,
.progress-btn-secondary:active {
  transform: translateY(0);
}

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

@media (max-width: 640px) {
  .generating-modal-content {
    padding: 36px 28px;
  }
  
  .generating-modal-title {
    font-size: 24px;
  }
  
  .generating-modal-topic {
    font-size: 16px;
  }
  
  .progress-modal-content {
    padding: 32px 24px;
  }
  
  .progress-modal-title {
    font-size: 20px;
  }
  
  .progress-stats {
    gap: 20px;
  }
  
  .progress-stat-value {
    font-size: 28px;
  }
  
  .progress-modal-footer {
    flex-direction: column;
  }
  
  .progress-btn {
    width: 100%;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

/* Add subtle pulse to generating spinner */
.generating-spinner {
  animation: pulse 2s ease-in-out infinite;
}

