/* ----- RESET & BASE ----- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: #f8f7f4;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-y: auto; /* Allow body to scroll */
  padding: 2rem 1rem;
}

/* ----- ANIMATED BACKGROUND ----- */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: floatOrb 20s infinite alternate ease-in-out;
}

.auth-orb1 {
  width: 600px;
  height: 600px;
  background: #ffb347;
  top: -20%;
  left: -15%;
  animation-delay: 0s;
}

.auth-orb2 {
  width: 500px;
  height: 500px;
  background: #ff6b6b;
  bottom: -20%;
  right: -15%;
  animation-delay: -7s;
}

.auth-orb3 {
  width: 350px;
  height: 350px;
  background: #4ecdc4;
  top: 40%;
  right: 5%;
  animation-delay: -14s;
}

@keyframes floatOrb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(40px, -50px) scale(1.3);
  }
}

/* ----- MAIN CONTAINER ----- */
.reset-password-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 40px;
  padding: 2.5rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation: slideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  max-height: 95vh; /* Limit height */
  overflow-y: auto; /* Allow scrolling inside container */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #e2e0d8 transparent; /* Firefox */
}

/* Custom scrollbar for WebKit browsers */
.reset-password-container::-webkit-scrollbar {
  width: 4px;
}

.reset-password-container::-webkit-scrollbar-track {
  background: transparent;
}

.reset-password-container::-webkit-scrollbar-thumb {
  background: #e2e0d8;
  border-radius: 10px;
}

.reset-password-container::-webkit-scrollbar-thumb:hover {
  background: #c0c0c5;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- LOGO ----- */
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-decoration: none;
  font-size: 1.8rem;
  font-weight: 700;
  color: #1c1c1e;
  margin-bottom: 1.2rem;
}

.logo img {
  height: 40px;
  width: auto;
}

.logo span {
  color: #e4572e;
}

/* ----- HEADER ----- */
.reset-password-header {
  text-align: center;
  margin-bottom: 1.2rem;
}

.reset-password-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1c1c1e;
  margin-bottom: 0.3rem;
}

.reset-password-header p {
  color: #6e6e73;
  font-size: 0.95rem;
}

/* ----- INSTRUCTIONS ----- */
.instructions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(228, 87, 46, 0.06);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  margin-bottom: 1.2rem;
  border-left: 3px solid #e4572e;
}

.instructions i {
  color: #e4572e;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.instructions p {
  font-size: 0.85rem;
  color: #4a4a4e;
  line-height: 1.5;
}

.instructions strong {
  color: #1c1c1e;
}

/* ----- FORM ----- */
#resetPasswordForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ----- FORM GROUP ----- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1c1c1e;
  letter-spacing: -0.01em;
}

.form-group .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-group .input-wrapper input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 3rem;
  border: 2px solid #e2e0d8;
  border-radius: 16px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  background: rgba(255, 255, 255, 0.6);
  transition: all 0.3s ease;
  color: #1c1c1e;
  outline: none;
}

.form-group .input-wrapper input:focus {
  border-color: #e4572e;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 4px rgba(228, 87, 46, 0.08);
}

.form-group .input-wrapper input::placeholder {
  color: #aeaeb2;
  font-weight: 400;
}

.form-group .input-wrapper i {
  position: absolute;
  left: 1rem;
  color: #8e8e93;
  font-size: 1.1rem;
  transition: color 0.3s ease;
  pointer-events: none;
}

.form-group .input-wrapper input:focus ~ i {
  color: #e4572e;
}

/* ----- PASSWORD TOGGLE ----- */
.password-toggle {
  position: absolute;
  right: 1rem;
  background: none;
  border: none;
  color: #8e8e93;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: #1c1c1e;
}

.password-toggle:focus {
  outline: none;
}

/* ----- PASSWORD REQUIREMENTS ----- */
.password-requirements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.2rem;
  font-size: 0.75rem;
}

.req-item {
  color: #8e8e93;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.req-item.valid {
  color: #34c759;
}

.req-item.invalid {
  color: #e4572e;
}

/* ----- ERROR MESSAGES ----- */
.error-message {
  color: #e4572e;
  font-size: 0.8rem;
  margin-top: 0.2rem;
  display: none;
}

.form-group.error .error-message {
  display: block;
}

.form-group.error .input-wrapper input {
  border-color: #e4572e;
  background: rgba(228, 87, 46, 0.04);
}

.form-group.error .input-wrapper i {
  color: #e4572e;
}

.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* ----- SUBMIT BUTTON ----- */
.submit-btn {
  width: 100%;
  padding: 1rem;
  background: #1c1c1e;
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  position: relative;
  flex-shrink: 0; /* Prevent button from shrinking */
}

.submit-btn:hover {
  background: #e4572e;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(228, 87, 46, 0.25);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn i {
  font-size: 1.1rem;
}

/* ----- BUTTON LOADING STATE ----- */
.submit-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.submit-btn.loading .btn-text {
  visibility: hidden;
}

.submit-btn.loading .btn-loader {
  display: block;
}

.btn-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: absolute;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ----- BACK TO LOGIN ----- */
.back-to-login {
  text-align: center;
  margin-top: 1.2rem;
  flex-shrink: 0;
}

.back-to-login a {
  color: #6e6e73;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.back-to-login a:hover {
  color: #e4572e;
}

.back-to-login a i {
  transition: transform 0.3s ease;
}

.back-to-login a:hover i {
  transform: translateX(-4px);
}

/* ----- SUCCESS MODAL ----- */
.success-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.3s ease;
}

.success-modal.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.success-content {
  background: white;
  border-radius: 40px;
  padding: 3rem 2.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: scaleUp 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes scaleUp {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.success-icon {
  font-size: 4rem;
  color: #34c759;
  margin-bottom: 1rem;
}

.success-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1c1c1e;
}

.success-content p {
  color: #6e6e73;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.success-btn {
  display: inline-block;
  padding: 0.8rem 2.5rem;
  background: #1c1c1e;
  color: white;
  border: none;
  border-radius: 40px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

.success-btn:hover {
  background: #e4572e;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(228, 87, 46, 0.25);
}

/* ----- RESPONSIVE ----- */
@media (max-width: 480px) {
  .reset-password-container {
    padding: 1.8rem;
    border-radius: 30px;
    max-height: 90vh;
  }

  .logo {
    font-size: 1.4rem;
  }

  .logo img {
    height: 32px;
  }

  .reset-password-header h1 {
    font-size: 1.4rem;
  }

  .reset-password-header p {
    font-size: 0.85rem;
  }

  .instructions {
    padding: 0.7rem 0.8rem;
    font-size: 0.8rem;
  }

  .form-group .input-wrapper input {
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    font-size: 0.95rem;
  }

  .form-group .input-wrapper i {
    left: 0.8rem;
    font-size: 1rem;
  }

  .submit-btn {
    font-size: 0.95rem;
    padding: 0.9rem;
  }

  .success-content {
    padding: 2rem 1.5rem;
  }

  .success-content h2 {
    font-size: 1.3rem;
  }

  .success-icon {
    font-size: 3rem;
  }
}

@media (max-width: 360px) {
  .reset-password-container {
    padding: 1.2rem;
  }

  .password-requirements {
    font-size: 0.65rem;
  }

  .submit-btn {
    font-size: 0.85rem;
  }
}

/* ----- FIX FOR ANDROID CHROME ----- */
@supports (-webkit-touch-callout: none) {
  .reset-password-container {
    max-height: 90vh;
  }
}