/**
 * Success Modal Component Styles
 * Mobile-first responsive design, WCAG 2.1 AA compliant
 */

/* Modal Overlay */
.success-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease-out;
}

.success-modal-overlay.closing {
  animation: fadeOut 0.3s ease-out;
}

/* Modal Container */
.success-modal {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 2rem;
  animation: slideUp 0.5s ease-out;
}

@media (max-width: 767px) {
  .success-modal {
    padding: 1.5rem;
    max-height: 95vh;
  }
}

/* Close Button */
.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  color: #475569;
}

.modal-close-btn:focus {
  outline: 2px solid #137fec;
  outline-offset: 2px;
}

.modal-close-btn .material-symbols-outlined {
  font-size: 1.5rem;
}

/* Header */
.modal-header {
  text-align: center;
  margin-bottom: 2rem;
}

.celebration-emoji {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 1rem;
  animation: bounce 1s ease infinite;
}

.modal-title {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  letter-spacing: 0.05em;
}

@media (max-width: 767px) {
  .celebration-emoji {
    font-size: 3rem;
  }

  .modal-title {
    font-size: 1.5rem;
  }
}

/* Score Improvement */
.modal-score-improvement {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 0.75rem;
}

.improvement-text {
  font-size: 1.125rem;
  color: #0f172a;
  margin: 0 0 1rem 0;
}

.improvement-delta {
  color: #10b981;
  font-weight: 800;
  font-size: 1.5rem;
}

.score-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  min-width: 80px;
}

.score-badge.score-before {
  opacity: 0.7;
}

.score-badge.score-after {
  border: 2px solid #10b981;
}

.badge-label {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.badge-value {
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.score-badge.score-after .badge-value {
  color: #10b981;
}

.score-arrow {
  font-size: 1.5rem;
  color: #10b981;
  font-weight: 700;
}

/* Achievement */
.modal-achievement {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 0.75rem;
}

.achievement-text {
  font-size: 1rem;
  color: #78350f;
  margin: 0;
  line-height: 1.6;
}

.achievement-text strong {
  font-weight: 800;
  font-size: 1.25rem;
}

/* Stats */
.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 767px) {
  .modal-stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #137fec;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8125rem;
  color: #64748b;
  line-height: 1.3;
}

.stats-disclaimer {
  text-align: center;
  margin-bottom: 1.5rem;
}

.stats-disclaimer small {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Actions */
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.modal-btn:focus {
  outline: 2px solid #137fec;
  outline-offset: 2px;
}

.modal-btn .material-symbols-outlined {
  font-size: 1.25rem;
}

/* Primary CTA */
.modal-btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
  font-size: 1.125rem;
  padding: 1.25rem 1.5rem;
}

.modal-btn-primary:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 12px -2px rgba(16, 185, 129, 0.4);
}

.modal-btn-primary:active {
  transform: translateY(0);
}

/* Secondary CTA */
.modal-btn-secondary {
  background: #137fec;
  color: white;
  box-shadow: 0 2px 4px rgba(19, 127, 236, 0.2);
}

.modal-btn-secondary:hover {
  background: #0c63c4;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(19, 127, 236, 0.3);
}

/* Tertiary CTA */
.modal-btn-tertiary {
  background: white;
  color: #475569;
  border: 2px solid #e2e8f0;
}

.modal-btn-tertiary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

/* Footer */
.modal-footer {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.modal-link {
  background: transparent;
  border: none;
  color: #137fec;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: color 0.2s ease;
}

.modal-link:hover {
  color: #0c63c4;
}

.modal-link:focus {
  outline: 2px solid #137fec;
  outline-offset: 2px;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(60px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Scrollbar styling */
.success-modal::-webkit-scrollbar {
  width: 8px;
}

.success-modal::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.success-modal::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.success-modal::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .success-modal {
    background: #1e293b;
    color: #e2e8f0;
  }

  .modal-title {
    color: #f1f5f9;
  }

  .modal-close-btn {
    color: #cbd5e1;
  }

  .modal-close-btn:hover {
    background: #334155;
    color: #f1f5f9;
  }

  .modal-score-improvement {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  }

  .improvement-text {
    color: #f1f5f9;
  }

  .score-badge {
    background: #0f172a;
    border-color: #334155;
  }

  .badge-value {
    color: #f1f5f9;
  }

  .modal-achievement {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
  }

  .achievement-text {
    color: #fef3c7;
  }

  .stat-box {
    background: #0f172a;
    border-color: #334155;
  }

  .stat-label {
    color: #cbd5e1;
  }

  .modal-btn-tertiary {
    background: #0f172a;
    color: #cbd5e1;
    border-color: #334155;
  }

  .modal-btn-tertiary:hover {
    background: #334155;
  }

  .modal-footer {
    border-top-color: #334155;
  }
}
