@keyframes gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes floatUp {
  0% {
    transform: translate(0, 100vh) scale(1);
    opacity: 0;
  }
  20% {
    opacity: 0.8;
  }
  80% {
    opacity: 0.8;
  }
  100% {
    transform: translate(0, -100vh) scale(1.2);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", sans-serif;
  line-height: 1.5;
}

/* Page container */
.page-container {
  display: flex;
  width: 100%;
  background: linear-gradient(
    -45deg,
    rgba(0, 149, 255, 0.95),
    rgba(0, 255, 200, 0.8),
    rgba(0, 149, 255, 0.9),
    rgba(0, 255, 200, 0.85)
  );
  height: 100vh;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
  transition: all 0.5s ease-out;
  transform: translateY(var(--scroll-y, 0));
}

.page-container::before {
  content: "";
  position: absolute;
  width: 200%;
  height: 200%;
  background: repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.5) 0px,
      rgba(255, 255, 255, 0.5) 4px,
      transparent 4px,
      transparent 80px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.5) 0px,
      rgba(255, 255, 255, 0.5) 4px,
      transparent 4px,
      transparent 80px
    );
  animation: move 12s linear infinite;
  z-index: 0;
  opacity: 0.8;
}

.page-container::after {
  content: "";
  position: absolute;
  width: 200%;
  height: 200%;
  background: repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.6) 0px,
      rgba(255, 255, 255, 0.6) 4px,
      transparent 4px,
      transparent 100px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.6) 0px,
      rgba(255, 255, 255, 0.6) 4px,
      transparent 4px,
      transparent 100px
    );
  animation: move 20s linear infinite;
  z-index: 0;
  opacity: 0.8;
}

/* Background section */
.background-section {
  position: relative;
  width: 45%;
  z-index: 2;
  background-color: #808080;
}

.background-image {
  width: 100%;
  height: 100vh;
  object-fit: cover;
}

.company-logo {
  position: absolute;
  top: 46px;
  left: 65px;
  width: 120px;
  height: 120px;
  background-blend-mode: multiply;
}

/* Form section */
.form-section {
  flex: 1;
  padding: 40px 65px 0;
  /* height: 100vh;*/  /* 移除這行 */
  min-height: 100vh;     /* 讓畫面至少滿版 */
  overflow: auto;
  scroll-behavior: smooth;
  position: relative;
  z-index: 1;
  background: linear-gradient(-45deg, #fff1eb, #ace0f9, #fff1eb, #ace0f9);
  backdrop-filter: blur(8px);
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
}

.form-section::before,
.form-section::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.form-section::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    rgba(34, 135, 242, 0.08) 0%,
    rgba(34, 135, 242, 0) 70%
  );
  left: 5%;
  animation: floatUp 45s infinite ease-in-out;
}

.form-section::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(0, 255, 200, 0.06) 0%,
    rgba(0, 255, 200, 0) 70%
  );
  right: 10%;
  animation: floatUp 50s infinite ease-in-out -15s;
}

/* Toggle container */
.toggle-container {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
  margin-top: -5px;
}

.identity-toggle {
  position: relative;
  width: 400px;
  height: 44px;
  border-radius: 22px;
  box-shadow: none;
  border: 1px solid #2287f2;
  cursor: pointer;
  padding: 0;
  background-color: #fff;
}

.toggle-slider {
  position: absolute;
  width: 50%;
  height: 44px;
  border-radius: 22px;
  box-shadow: none;
  transition: left 0.3s ease-in-out;
  top: 0;
  left: 0;
  background-color: #2287f2;
}

.toggle-option {
  position: absolute;
  font-size: 16px;
  top: 50%;
  line-height: 24px;
  transition: color 0.3s ease-in-out;
}

.customer-option {
  left: 25%;
  transform: translate(-50%, -50%);
  color: #fff;
}

.employee-option {
  right: 25%;
  transform: translate(50%, -50%);
  color: #000;
}

/* Form container */
.form-container {
  max-width: 810px;
  margin: 0 auto 20px;
  padding: 40px 60px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-top: -5px;
  padding-top: 40px;
  height: auto;
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
  transform: none;
  margin-bottom: -3px;
  padding-bottom: 22px;
  background-color: rgba(255, 255, 255, 0.95);
}

/* Form elements */
.form-row {
  display: flex;
  gap: 32px;
  margin-bottom: 16px;
}

.form-group {
  flex: 1;
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 16px;
  color: #4b4b4b;
  margin-bottom: 8px;
  line-height: 24px;
}

.required-mark {
  color: #ff2d2d;
}

.form-input,
.form-select {
  width: 100%;
  height: 40px;
  border: 1px solid #2287f2;
  border-radius: 20px;
  padding: 0 20px;
  background-color: #fff;
}

.form-select {
  appearance: none;
  background-image: url("https://cdn.builder.io/api/v1/image/assets/TEMP/9637142e10d69a4432fc302e4285f246acce2ce2");
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 16px;
  cursor: pointer;
  font-size: 16px;
  color: #4b4b4b;
}

.form-select:focus {
  outline: none;
  border-color: #2287f2;
  box-shadow: 0 0 0 2px rgba(34, 135, 242, 0.2);
}

.form-textarea {
  width: 100%;
  height: 112px;
  border: 1px solid #2287f2;
  border-radius: 20px;
  padding: 20px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: #8190a9;
  resize: none;
  background-color: #fff;
}

.character-count {
  font-size: 14px;
  color: #8190a9;
  margin-top: 8px;
}

.error-message {
  color: #ff2d2d;
  font-size: 14px;
  margin-top: 4px;
  margin-left: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Submit button */
.submit-button {
  width: 100%;
  height: 61px;
  background: linear-gradient(45deg, #2287f2, #22a7f2);
  border-radius: 70px;
  border: none;
  color: #fff;
  font-family: "Inter", sans-serif;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1px;
  margin-bottom: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.submit-button:hover {
  transform: scale(1.02) translateY(-2px);
  background: linear-gradient(45deg, #22a7f2, #2287f2);
  box-shadow: 0 8px 25px rgba(34, 135, 242, 0.4);
}

.submit-button:active {
  transform: scale(0.98) translateY(1px);
  box-shadow: 0 2px 10px rgba(34, 135, 242, 0.3);
}

.submit-button:focus {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(34, 135, 242, 0.3),
    0 8px 25px rgba(34, 135, 242, 0.4);
}

.submit-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  opacity: 0;
  transition: opacity 0.5s ease;
}

.submit-button:hover::before {
  opacity: 1;
}

.submit-button::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(45deg);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.submit-button:hover::after {
  left: 100%;
  opacity: 0.8;
}

/* Success message */
.success-message {
  text-align: center;
  padding: 40px 20px;
  animation: fadeIn 0.5s ease-out;
}

.success-icon {
  animation: fadeIn 0.6s ease-out;
  display: block;
  margin: 0 auto 24px auto;
}

.success-title {
  font-size: 32px;
  color: #2287f2;
  margin-bottom: 20px;
  font-weight: 700;
}

.success-text {
  font-size: 16px;
  color: #4b4b4b;
  line-height: 1.6;
  margin-bottom: 20px;
}

.reset-button {
  width: 200px;
  height: 44px;
  border: 2px solid #2287f2;
  border-radius: 22px;
  color: #2287f2;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 40px auto;
  background-color: #fff;
}

.reset-button:hover {
  background: #2287f2;
  color: #fff;
}

.reset-button:active {
  transform: scale(0.98);
}

/* Footer */
.form-footer {
  text-align: center;
  padding-top: 16px;
  padding-bottom: 24px; /*  明確設定內距，避免空白 */
}

.contact-info {
  font-size: 14px;
  color: #8190a9;
  margin-bottom: 4px;
  margin-top: 24px;
}

.copyright {
  font-size: 14px;
  color: #8190a9;
  border-top: 1px solid #e5e5e5;
  padding-top: 4px;
}

.hidden-image {
  height: 0;
  width: 0;
  display: inline-block;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Responsive styles */
@media (max-width: 991px) {
  .page-container {
    flex-direction: column;
  }

  .background-section {
    width: 100%;
    height: 45vh;
  }

  .background-image {
    height: 45vh;
  }

  .company-logo {
    width: 100px;
    height: 100px;
    top: 36px;
    left: 45px;
  }

  .form-section {
    padding: 40px 20px 0;
  }

  .toggle-container {
    margin-bottom: 30px;
  }

  .form-container {
    padding: 45px;
    margin: 0 auto 20px;
  }

  .form-row {
    flex-direction: column;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  .background-section {
    height: 30vh;
  }

  .background-image {
    height: 30vh;
  }

  .company-logo {
    width: 80px;
    height: 80px;
    top: 26px;
    left: 25px;
  }

  .form-section {
    padding: 20px 20px 0;
  }

  .toggle-container {
    margin-bottom: 20px;
  }

  .identity-toggle {
    width: 100%;
    max-width: 400px;
  }

  .form-container {
    width: 100%;
    padding: 30px;
    margin: 0 auto 20px;
  }

  .submit-button {
    font-size: 20px;
  }
}
