/* ========================================
   Form Submission Modal System
   ======================================== */

/* Modal overlay */
.form-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.form-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal container */
.form-modal {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.5rem;
  padding: 3rem 2.5rem;
  max-width: 440px;
  width: 90%;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.form-modal-overlay.active .form-modal {
  transform: scale(1) translateY(0);
}

/* Subtle gradient border effect */
.form-modal::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1.5rem;
  padding: 1px;
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.3), rgba(192, 132, 252, 0.3), rgba(244, 114, 182, 0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Loading state */
.form-modal-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.form-modal-loader.hidden {
  display: none;
}

/* Music note loader animation */
.music-loader {
  position: relative;
  width: 120px;
  height: 80px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}

.music-loader .note {
  position: relative;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #818CF8, #C084FC);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  transform: rotate(-20deg);
  animation: note-bounce 1.4s ease-in-out infinite;
}

.music-loader .note::before {
  content: '';
  position: absolute;
  right: 0;
  top: -35px;
  width: 3px;
  height: 40px;
  background: linear-gradient(180deg, #C084FC, #818CF8);
  border-radius: 2px;
  transform-origin: bottom center;
}

.music-loader .note::after {
  content: '';
  position: absolute;
  right: 0;
  top: -35px;
  width: 12px;
  height: 8px;
  background: linear-gradient(90deg, #C084FC, #F472B6);
  border-radius: 0 4px 4px 0;
}

.music-loader .note:nth-child(1) {
  animation-delay: 0s;
  background: linear-gradient(135deg, #818CF8, #A78BFA);
}

.music-loader .note:nth-child(2) {
  animation-delay: 0.2s;
  background: linear-gradient(135deg, #A78BFA, #C084FC);
}

.music-loader .note:nth-child(3) {
  animation-delay: 0.4s;
  background: linear-gradient(135deg, #C084FC, #F472B6);
}

@keyframes note-bounce {
  0%, 100% {
    transform: rotate(-20deg) translateY(0);
    opacity: 0.6;
  }
  50% {
    transform: rotate(-20deg) translateY(-20px);
    opacity: 1;
  }
}

/* Sound wave bars */
.sound-waves {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 32px;
}

.sound-waves .bar {
  width: 4px;
  background: linear-gradient(180deg, #818CF8, #C084FC, #F472B6);
  border-radius: 2px;
  animation: sound-wave 1s ease-in-out infinite;
}

.sound-waves .bar:nth-child(1) { height: 12px; animation-delay: 0s; }
.sound-waves .bar:nth-child(2) { height: 20px; animation-delay: 0.1s; }
.sound-waves .bar:nth-child(3) { height: 28px; animation-delay: 0.2s; }
.sound-waves .bar:nth-child(4) { height: 20px; animation-delay: 0.3s; }
.sound-waves .bar:nth-child(5) { height: 12px; animation-delay: 0.4s; }

@keyframes sound-wave {
  0%, 100% {
    transform: scaleY(0.4);
    opacity: 0.5;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.loader-text {
  color: #94A3B8;
  font-size: 1.1rem;
  font-weight: 500;
}

/* Animated dots */
.loader-dots::after {
  content: '';
  animation: loading-dots 1.5s steps(4, end) infinite;
}

@keyframes loading-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Success state */
.form-modal-success {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.form-modal-success.active {
  display: flex;
}

.success-icon-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
}

.success-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.15), rgba(192, 132, 252, 0.15), rgba(244, 114, 182, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  animation: success-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.success-circle svg {
  width: 48px;
  height: 48px;
}

.success-circle svg path {
  stroke: url(#success-gradient);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw-check 0.5s ease forwards 0.4s;
}

/* Sparkle particles around success icon */
.success-sparkles {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}

.success-sparkles .sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0;
}

.success-sparkles .sparkle:nth-child(1) { top: 0; left: 50%; background: #818CF8; animation: sparkle-burst 0.6s ease-out 0.5s forwards; }
.success-sparkles .sparkle:nth-child(2) { top: 15%; right: 10%; background: #A78BFA; animation: sparkle-burst 0.6s ease-out 0.55s forwards; }
.success-sparkles .sparkle:nth-child(3) { top: 50%; right: 0; background: #C084FC; animation: sparkle-burst 0.6s ease-out 0.6s forwards; }
.success-sparkles .sparkle:nth-child(4) { bottom: 15%; right: 10%; background: #E879F9; animation: sparkle-burst 0.6s ease-out 0.65s forwards; }
.success-sparkles .sparkle:nth-child(5) { bottom: 0; left: 50%; background: #F472B6; animation: sparkle-burst 0.6s ease-out 0.7s forwards; }
.success-sparkles .sparkle:nth-child(6) { bottom: 15%; left: 10%; background: #FB7185; animation: sparkle-burst 0.6s ease-out 0.75s forwards; }
.success-sparkles .sparkle:nth-child(7) { top: 50%; left: 0; background: #818CF8; animation: sparkle-burst 0.6s ease-out 0.8s forwards; }
.success-sparkles .sparkle:nth-child(8) { top: 15%; left: 10%; background: #C084FC; animation: sparkle-burst 0.6s ease-out 0.85s forwards; }

@keyframes success-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes draw-check {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes sparkle-burst {
  0% {
    transform: scale(0) translateY(0);
    opacity: 1;
  }
  100% {
    transform: scale(1.5) translateY(-10px);
    opacity: 0;
  }
}

.success-title {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(90deg, #818CF8, #C084FC, #F472B6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 0.5rem;
}

.success-message {
  color: #94A3B8;
  font-size: 1rem;
  line-height: 1.7;
  max-width: 340px;
}

.success-message strong {
  color: #E2E8F0;
  font-weight: 600;
}

.success-highlight {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(129, 140, 248, 0.1);
  border: 1px solid rgba(129, 140, 248, 0.2);
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  margin-top: 0.5rem;
  color: #C084FC;
  font-size: 0.9rem;
  font-weight: 500;
}

.success-highlight svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.success-cta {
  margin-top: 1rem;
}

.success-cta .glow-button {
  padding: 0.875rem 2.5rem;
  font-size: 0.95rem;
}

/* Error state */
.form-modal-error {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.form-modal-error.active {
  display: flex;
}

.error-icon {
  width: 80px;
  height: 80px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.error-icon svg {
  width: 40px;
  height: 40px;
  stroke: #EF4444;
  stroke-width: 2;
  fill: none;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #F87171;
}

.error-message {
  color: #94A3B8;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 320px;
}

.error-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.error-actions button {
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.error-actions .retry-btn {
  background: linear-gradient(90deg, #818CF8, #C084FC);
  color: white;
  border: none;
}

.error-actions .retry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(192, 132, 252, 0.4);
}

.error-actions .close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94A3B8;
}

.error-actions .close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #E2E8F0;
}
