/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* Basic Styles */
body {
  font-family: 'Poppins', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow-y: auto;
  background: radial-gradient(ellipse at top left, #0a192f, #0c2954);
  background-size: cover;
  perspective: 1000px; 
  scrollbar-width: thin; 
  scrollbar-color: #0097e6 transparent;
}

body::-webkit-scrollbar {
  width: 8px;
}

body::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #00a8ff, #007bff);
  border-radius: 4px; 
}

/* Background Bubbles - More Dynamic Animations */
.background-bubbles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden; 
}

.background-bubbles span {
  position: absolute;
  border-radius: 50%;
  background: #fff; 
  opacity: 0.1;
  animation: animateBubbles 15s linear infinite; 
  backdrop-filter: blur(15px);
}

@keyframes animateBubbles {
  0% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(-10vw, -15vh) scale(1.4) rotate(120deg);
  }
  50% {
    transform: translate(5vw, 10vh) scale(0.7);
  }
  75% {
    transform: translate(15vw, -5vh) scale(1.1) rotate(-90deg); 
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

.background-bubbles span:nth-child(1) {
  width: 50px;
  height: 50px;
  left: 10%;
  bottom: 20%;
  animation-duration: 8s;
  background-color: #007bff; 
}

.background-bubbles span:nth-child(2) {
  width: 80px;
  height: 80px;
  right: 20%;
  top: 10%;
  animation-duration: 12s;
  background-color: #6610f2;
}

.background-bubbles span:nth-child(3) {
  width: 60px;
  height: 60px;
  left: 30%;
  top: 50%;
  animation-duration: 10s;
  background-color: #17a2b8; 
}

/* Form Container - Entrance with Bounce */
.container {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 50px;
  border-radius: 15px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 500px;
  text-align: center;
  backdrop-filter: blur(10px);
  animation: bounceIn 1s ease forwards; 
}

@keyframes bounceIn {
  0% {
    transform: scale(0.8) translateY(-200px);
    opacity: 0;
  }
  60% {
    transform: scale(1.1) translateY(20px);
    opacity: 1;
  }
  75% {
    transform: scale(0.95) translateY(-10px);
  }
  90% {
    transform: scale(1.02) translateY(5px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

/* Form Styles */
h2 {
  color: #fff;
  margin-bottom: 40px;
  font-weight: 600;
  animation: fadeInDown 0.8s ease forwards; 
}

@keyframes fadeInDown {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group {
  margin-bottom: 25px; 
  position: relative;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.form-group.active {
  opacity: 1;
  animation: slideUp 0.6s ease forwards;
}

@keyframes slideUp {
  0% {
    transform: translateY(30px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

label {
  display: block;
  margin-bottom: 8px;
  color: #ddd; 
  transition: all 0.3s ease;
  pointer-events: none;
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #0097e6;
  border-radius: 8px;
  box-sizing: border-box;
  outline: none;
  transition: all 0.3s ease;
  font-size: 16px;
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff; 
}

input:focus {
  border-color: #00a8ff; 
  box-shadow: 0 0 8px rgba(0, 168, 255, 0.5);
  background-color: rgba(255, 255, 255, 0.1); 
}

input:focus + label {
  top: -14px;
  font-size: 14px;
  color: #00a8ff; 
  background-color: transparent; 
  padding: 0 5px;
  animation: expandLabel 0.3s ease forwards;
}

@keyframes expandLabel {
  0% {
    transform: scale(0.8) translateX(100%);
    opacity: 0;
    padding: 0;
  }
  50% {
    padding: 0 5px;
    opacity: 1;
  }
  100% {
    transform: scale(1) translateX(0); 
  }
}

/* Button Styles - Pulse Effect on Hover */
button[type="submit"] {
  background-color: #0097e6; 
  color: #fff;
  padding: 14px 25px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  animation: pulseButton 1.5s infinite; 
}

@keyframes pulseButton {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

button[type="submit"]:hover {
  background-color: #00a8ff; 
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  animation: none; 
}

button[type="submit"]:active {
  transform: translateY(2px); 
}

/* Link Styles */
a {
  color: #0097e6;
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #00a8ff; 
}

/* Validation Styles - Wiggle Error */
.valid {
  border-color: #4CAF50 !important;
}

.error-message {
  color: #f44336;
  font-size: 13px;
  display: none;
  position: absolute;
  bottom: -20px; 
  left: 0;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.form-group .error-message {
  animation: wiggleError 0.8s ease forwards; 
}

@keyframes wiggleError {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-5px) rotate(-3deg); }
  20% { transform: translateX(3px) rotate(3deg); }
  30% { transform: translateX(-2px) rotate(-2deg); }
  40% { transform: translateX(1px) rotate(2deg); }
  50% { transform: translateX(0); } 
  /* Repeat the same pattern for 60%-100% */
}

/* Media Queries for Responsiveness - No major changes */
@media (max-width: 768px) {
  .container {
    width: 95%;
    padding: 40px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 30px;
  }

  h2 {
    font-size: 24px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"] {
    padding: 10px;
    font-size: 16px;
  }

  button[type="submit"] {
    padding: 12px 20px;
    font-size: 16px;
  }

  .background-bubbles span { 
    width: 40px;
    height: 40px;
  }

  .background-bubbles span:nth-child(2) {
    width: 60px;
    height: 60px;
  }

  .background-bubbles span:nth-child(3) {
    width: 50px;
    height: 50px;
  }
}