@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxP.ttf) format('truetype');
}

body {
  all: initial;
  font-family: 'Roboto', sans-serif;
  letter-spacing: 0.02em;
  background: linear-gradient(-45deg, #1a1a2e, #16213e, #0f3460, #1a1a2e);
  background-size: 400% 400%;
  animation: gradientBG 12s ease infinite;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

body.light {
  background: linear-gradient(-45deg, #f0f8fc, #e3f2fd, #d4e9f7, #f0f8fc);
  background-size: 400% 400%;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

* {
  box-sizing: border-box;
}

main {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* ===== Animated Background ===== */
.animated-bg {
  position: fixed;
  inset: 0;
  z-index: -9;
  background: inherit;
}

.animated-bg::before {
  content: '';
  position: absolute;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(100, 200, 255, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  top: 15%;
  right: 10%;
  filter: blur(50px);
  animation: float1 15s ease-in-out infinite;
}

body.light .animated-bg::before {
  background: radial-gradient(circle, rgba(52, 152, 219, 0.15) 0%, transparent 70%);
}

.animated-bg::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(100, 200, 255, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  bottom: 10%;
  left: 5%;
  filter: blur(60px);
  animation: float2 18s ease-in-out infinite;
}

body.light .animated-bg::after {
  background: radial-gradient(circle, rgba(52, 152, 219, 0.1) 0%, transparent 70%);
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(60px, -80px); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-60px, 80px); }
}

/* ===== Form Container ===== */
.form {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 40px 30px;
  background: rgba(20, 25, 40, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(100, 200, 255, 0.2);
  border-radius: 16px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 40px rgba(100, 200, 255, 0.05);
  animation: formSlideIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

body.light .form {
  background: rgba(255, 255, 255, 0.90);
  border-color: rgba(52, 152, 219, 0.15);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(52, 152, 219, 0.1),
    0 0 40px rgba(52, 152, 219, 0.05);
}

@keyframes formSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.form__cover {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 50%, rgba(100, 200, 255, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

body.light .form__cover {
  background: radial-gradient(circle at 50% 50%, rgba(52, 152, 219, 0.04) 0%, transparent 70%);
}

.form__content {
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  padding-right: 8px;
  flex: 1;
}

/* Scrollbar Styling */
.form__content::-webkit-scrollbar {
  width: 6px;
}

.form__content::-webkit-scrollbar-track {
  background: rgba(100, 200, 255, 0.05);
}

.form__content::-webkit-scrollbar-thumb {
  background: rgba(100, 200, 255, 0.3);
  border-radius: 3px;
}

.form__content::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 200, 255, 0.5);
}

body.light .form__content::-webkit-scrollbar-thumb {
  background: rgba(52, 152, 219, 0.3);
}

body.light .form__content::-webkit-scrollbar-thumb:hover {
  background: rgba(52, 152, 219, 0.5);
}

/* ===== Animated Title ===== */
.form__title {
  color: #64c8ff;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 0 0 18px 0;
  text-align: center;
  text-shadow: 0 0 12px rgba(100, 200, 255, 0.2);
  display: flex;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

body.light .form__title {
  color: #2c3e50;
  text-shadow: 0 0 12px rgba(52, 152, 219, 0.1);
}

.title-char {
  display: inline-block;
  animation: charFade 0.6s ease-out backwards;
}

@keyframes charFade {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Form Groups ===== */
.form__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* ===== Styled Input with Floating Label ===== */
.styled-input {
  position: relative;
  width: 100%;
  border: 1.5px solid rgba(100, 200, 255, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  padding: 0;
  height: 52px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

body.light .styled-input {
  border-color: rgba(52, 152, 219, 0.2);
  background: rgba(52, 152, 219, 0.03);
}

.styled-input:focus-within {
  border-color: rgba(100, 200, 255, 0.6);
  background: rgba(100, 200, 255, 0.05);
  box-shadow: 0 0 20px rgba(100, 200, 255, 0.15), inset 0 0 10px rgba(100, 200, 255, 0.05);
}

body.light .styled-input:focus-within {
  border-color: rgba(52, 152, 219, 0.5);
  background: rgba(52, 152, 219, 0.07);
  box-shadow: 0 0 20px rgba(52, 152, 219, 0.1), inset 0 0 10px rgba(52, 152, 219, 0.03);
}

.styled-input__input {
  width: 100%;
  padding: 14px 40px 14px 14px;
  background: none;
  border: none;
  color: #d8d8e8;
  font-size: 14px;
  outline: none;
  font-weight: 500;
  letter-spacing: 0.5px;
}

body.light .styled-input__input {
  color: #2c3e50;
}

.styled-input__input::placeholder {
  color: transparent;
}

/* Floating Label */
.styled-input__label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a9baa;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

body.light .styled-input__label {
  color: #7f8c8d;
}

.styled-input__input:focus ~ .styled-input__label,
.styled-input__input:valid ~ .styled-input__label {
  top: -10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64c8ff;
  opacity: 0.95;
  transform: translateY(0);
  background: rgba(20, 25, 40, 0.7);
  padding: 0 6px;
  border-radius: 2px;
}

body.light .styled-input__input:focus ~ .styled-input__label,
body.light .styled-input__input:valid ~ .styled-input__label {
  color: #2980b9;
  background: rgba(255, 255, 255, 0.90);
}

/* ===== Eye Toggle ===== */
.eye-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #8a9baa;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 4px;
  border-radius: 4px;
  border: none;
  background: transparent;
}

body.light .eye-toggle {
  color: #95a5a6;
}

.eye-toggle:hover {
  color: #64c8ff;
  background: rgba(100, 200, 255, 0.1);
}

body.light .eye-toggle:hover {
  color: #2980b9;
  background: rgba(52, 152, 219, 0.1);
}

.eye-icon {
  width: 18px;
  height: 18px;
}

.eye-closed,
.eye-slash {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.eye-toggle.active .eye-open {
  opacity: 0;
}

.eye-toggle.active .eye-closed,
.eye-toggle.active .eye-slash {
  opacity: 1;
}

/* ===== Password Requirements ===== */
.password-requirements {
  background: rgba(100, 200, 255, 0.03);
  border: 1px solid rgba(100, 200, 255, 0.15);
  border-radius: 8px;
  padding: 8px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  transform-origin: top;
  margin: 0;
  flex-shrink: 0;
}

body.light .password-requirements {
  background: rgba(52, 152, 219, 0.04);
  border-color: rgba(52, 152, 219, 0.12);
}

.password-requirements.show {
  max-height: 200px;
  opacity: 1;
  padding: 10px;
}

.req-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #8a9baa;
  margin-bottom: 4px;
  transition: color 0.3s ease;
}

body.light .req-item {
  color: #7f8c8d;
}

.req-item.optional {
  opacity: 0.65;
}

.req-item.met {
  color: #4ade80;
}

body.light .req-item.met {
  color: #27ae60;
}

.req-icon {
  width: 12px;
  min-width: 12px;
  text-align: center;
  font-size: 9px;
  font-weight: bold;
  color: #8a9baa;
  transition: color 0.3s ease;
}

body.light .req-icon {
  color: #95a5a6;
}

.req-item.met .req-icon {
  color: #4ade80;
}

body.light .req-item.met .req-icon {
  color: #27ae60;
}

/* ===== Password Strength ===== */
.strength-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.strength-bar-bg {
  width: 100%;
  height: 3px;
  background: rgba(100, 200, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

body.light .strength-bar-bg {
  background: rgba(52, 152, 219, 0.1);
}

.strength-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff6b6b, #ffa94d, #74c0fc, #4ade80);
  border-radius: 2px;
  transition: width 0.5s ease, background 0.3s ease;
  box-shadow: 0 0 8px rgba(100, 200, 255, 0.3);
}

.strength-text {
  font-size: 9px;
  color: #8a9baa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  transition: color 0.3s ease;
}

body.light .strength-text {
  color: #7f8c8d;
}

/* ===== hCaptcha ===== */
.hcaptcha-wrapper {
  display: flex;
  justify-content: center;
  margin: 2px 0;
  flex-shrink: 0;
}

.h-captcha {
  transform: scale(0.9);
  transform-origin: center;
}

/* ===== Messages (INSIDE FORM) ===== */
.error-message,
.success-message {
  font-size: 11px;
  min-height: 14px;
  margin: 0;
  border-radius: 8px;
  padding: 0;
  text-align: center;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.error-message.show {
  max-height: 60px;
  opacity: 1;
  padding: 8px 12px;
  margin: 8px 0;
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.25);
}

body.light .error-message.show {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.07);
  border-color: rgba(231, 76, 60, 0.2);
}

.success-message.show {
  max-height: 60px;
  opacity: 1;
  padding: 8px 12px;
  margin: 8px 0;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

body.light .success-message.show {
  color: #27ae60;
  background: rgba(39, 174, 96, 0.07);
  border-color: rgba(39, 174, 96, 0.2);
}

/* ===== Submit Button ===== */
.submit-button {
  position: relative;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #64c8ff 0%, #3b9fd9 100%);
  color: #0a0e27;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  margin-top: 0;
  font-family: 'Roboto', sans-serif;
  flex-shrink: 0;
}

body.light .submit-button {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: #ffffff;
}

.submit-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.submit-button:hover::before {
  left: 100%;
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(100, 200, 255, 0.35);
}

body.light .submit-button:hover {
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.submit-button:active {
  transform: translateY(0);
}

.submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-text {
  position: relative;
  z-index: 1;
}

/* ===== Back Button ===== */
.back-button {
  display: inline-block;
  width: 100%;
  padding: 10px;
  text-align: center;
  color: #8a9baa;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid rgba(100, 200, 255, 0.25);
  border-radius: 10px;
  background: rgba(100, 200, 255, 0.03);
  transition: all 0.3s ease;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 0;
  font-family: 'Roboto', sans-serif;
  flex-shrink: 0;
}

body.light .back-button {
  color: #7f8c8d;
  border-color: rgba(52, 152, 219, 0.2);
  background: rgba(52, 152, 219, 0.03);
}

.back-button:hover {
  color: #64c8ff;
  border-color: rgba(100, 200, 255, 0.4);
  background: rgba(100, 200, 255, 0.07);
}

body.light .back-button:hover {
  color: #2980b9;
  border-color: rgba(52, 152, 219, 0.35);
  background: rgba(52, 152, 219, 0.08);
}

.back-button:active {
  transform: scale(0.97);
}

/* ===== Theme Switch ===== */
.theme-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

.toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(100, 200, 255, 0.1);
  border: 1.5px solid rgba(100, 200, 255, 0.25);
  color: #64c8ff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
}

body.light .toggle {
  background: rgba(52, 152, 219, 0.08);
  border-color: rgba(52, 152, 219, 0.25);
  color: #f39c12;
}

.toggle:hover {
  background: rgba(100, 200, 255, 0.15);
  border-color: rgba(100, 200, 255, 0.4);
  box-shadow: 0 0 12px rgba(100, 200, 255, 0.15);
  transform: scale(1.05);
}

body.light .toggle:hover {
  background: rgba(52, 152, 219, 0.12);
  border-color: rgba(52, 152, 219, 0.4);
  box-shadow: 0 0 12px rgba(52, 152, 219, 0.1);
}

/* ===== Responsive Design ===== */
@media (max-width: 480px) {
  .form {
    max-width: 100%;
    margin: 0 12px;
    padding: 28px 18px;
  }

  .form__content {
    gap: 9px;
  }

  .form__title {
    font-size: 24px;
    margin-bottom: 14px;
  }

  .h-captcha {
    transform: scale(0.75);
  }

  .styled-input__input {
    padding: 12px 32px 12px 10px;
    font-size: 14px;
  }

  .error-message.show,
  .success-message.show {
    font-size: 10px;
    padding: 6px 10px;
  }
}