/* Auth flip card — adapted from Uiverse.io (andrew-demchenk0) */

.auth-flip-page {
  --auth-input-focus: #f59e0b;
  --auth-font-color: #f4efe8;
  --auth-font-color-sub: #9ca3af;
  --auth-bg-color: rgba(18, 16, 14, 0.62);
  --auth-main-color: #d97706;
  --auth-shadow: rgba(0, 0, 0, 0.45);
  --auth-page-text: #f3f4f6;
  --auth-page-muted: #9ca3af;
  --auth-card-bg: rgba(18, 16, 14, 0.62);
}

.login-container.auth-flip-page {
  background:
    radial-gradient(ellipse at 18% 12%, rgba(217, 119, 6, 0.2), transparent 42%),
    radial-gradient(ellipse at 85% 88%, rgba(194, 65, 12, 0.14), transparent 40%),
    linear-gradient(160deg, #000000 0%, #0a0a0a 55%, #111111 100%);
}

.login-container.auth-flip-page .login-box {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 1rem 0.5rem 1.5rem;
  max-width: 420px;
  width: 100%;
}

.auth-flip-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.auth-flip-wrapper .login-header {
  margin-bottom: 1rem;
}

.auth-flip-wrapper .auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.auth-flip-wrapper .auth-brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(217, 119, 6, 0.55);
  box-shadow: none;
  background: rgba(255, 255, 255, 0.06);
}

.auth-flip-wrapper .login-header h1 {
  font-size: 1.75rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
}

.auth-flip-wrapper .login-header p {
  color: var(--auth-page-muted);
}

.auth-flip-wrapper .message {
  width: min(340px, 100%);
  box-sizing: border-box;
}

.auth-flip-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Login / Sign up switch */
.auth-flip-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: 0.25rem 0 1.25rem;
  user-select: none;
  min-height: 2rem;
}

.auth-flip-side {
  min-width: 4.75rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--auth-page-muted);
  text-decoration: none;
  transition: font-size 0.25s ease, color 0.25s ease, font-weight 0.25s ease, text-decoration 0.2s ease;
  line-height: 1.1;
}

/* 默认登录态：登录更大 */
.auth-flip-side--login {
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.auth-flip-side--register {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--auth-page-muted);
}

.auth-flip-toggle:checked ~ .auth-flip-switch .auth-flip-side--login {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--auth-page-muted);
  text-decoration: none;
}

.auth-flip-toggle:checked ~ .auth-flip-switch .auth-flip-side--register {
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.auth-flip-track {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid rgba(198, 198, 198, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  background: rgba(8, 8, 8, 0.55);
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
}

.auth-flip-track::before {
  content: "";
  position: absolute;
  box-sizing: border-box;
  height: 18px;
  width: 18px;
  border: 0;
  border-radius: 50%;
  left: 2px;
  top: 2px;
  background: #f4efe8;
  box-shadow: none;
  transition: transform 0.3s;
}

.auth-flip-toggle:checked ~ .auth-flip-switch .auth-flip-track {
  background: var(--auth-main-color);
}

.auth-flip-toggle:checked ~ .auth-flip-switch .auth-flip-track::before {
  transform: translateX(22px);
}

/* 3D scene */
.auth-flip-scene {
  width: min(340px, 100%);
  height: 210px;
  perspective: 1200px;
  transition: height 0.35s ease;
}

.auth-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  text-align: center;
  transition: transform 0.75s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

.auth-flip-inner.is-flipping {
  pointer-events: none;
}

.auth-flip-toggle:checked ~ .auth-flip-scene .auth-flip-inner {
  transform: rotateY(180deg);
}

.auth-flip-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.7rem;
  padding: 1.1rem 1.1rem 1.05rem;
  box-sizing: border-box;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  background: rgba(42, 36, 30, 0.78);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
}

.auth-flip-back {
  transform: rotateY(180deg);
}

.auth-flip-title {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.45rem;
  font-weight: 900;
  text-align: center;
  color: var(--auth-main-color);
}

.auth-flip-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
}

.auth-flip-form .form-group {
  margin-bottom: 0;
  text-align: left;
}

/* 只保留输入框内占位文案，去掉上方重复 label */
.auth-flip-form .form-group > label {
  display: none !important;
}

.auth-flip-input,
.auth-flip-form input[type="text"],
.auth-flip-form input[type="email"],
.auth-flip-form input[type="tel"],
.auth-flip-form input[type="password"] {
  width: 100%;
  height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: #f4efe8;
  padding: 0 12px;
  outline: none;
  box-sizing: border-box;
  -webkit-text-fill-color: #f4efe8;
}

.auth-flip-form input::placeholder {
  color: rgba(244, 239, 232, 0.45) !important;
  opacity: 1;
  font-weight: 500;
  -webkit-text-fill-color: rgba(244, 239, 232, 0.45);
}

.auth-flip-form input:focus {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}

.auth-flip-forgot {
  text-align: right;
  margin-top: 0.35rem;
}

.auth-flip-forgot a {
  font-size: 0.82rem;
  color: #fbbf24;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
}

.auth-flip-forgot a:hover {
  color: #fde68a;
}

.auth-flip-btn,
.auth-flip-form .btn-primary {
  margin: 0.45rem 0 0;
  width: 100%;
  height: 42px;
  border-radius: 8px;
  border: 1px solid #d97706;
  background: #d97706;
  box-shadow: none;
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-flip-btn:hover,
.auth-flip-form .btn-primary:hover {
  transform: none;
  box-shadow: none;
  background: #c2410c;
  border-color: #c2410c;
  color: #fff;
}

.auth-flip-btn:active,
.auth-flip-form .btn-primary:active {
  box-shadow: none;
  transform: none;
}

.auth-flip-btn:disabled,
.auth-flip-form .btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.auth-flip-form .loading-spinner {
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
}

.auth-flip-wrapper .form-footer {
  margin-top: 1.35rem;
  color: var(--auth-page-muted);
}

.auth-flip-wrapper .form-footer a {
  color: var(--auth-main-color);
}

.auth-flip-wrapper .form-footer a:hover {
  color: #f59e0b;
}

@media (max-width: 420px) {
  .auth-flip-scene {
    width: 100%;
  }

  .auth-flip-face {
    padding: 1rem 0.95rem 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-flip-inner {
    transition: none;
  }

  .auth-flip-side {
    transition: none;
  }
}

/* Power Lab / App 跳转进来时，强制与官网翻转登录一致，不被 app-client 旧壳盖掉 */
html.app-client .login-container.auth-flip-page,
html.in-huytech-app .login-container.auth-flip-page {
  background:
    radial-gradient(ellipse at 18% 12%, rgba(217, 119, 6, 0.2), transparent 42%),
    radial-gradient(ellipse at 85% 88%, rgba(194, 65, 12, 0.14), transparent 40%),
    linear-gradient(160deg, #000000 0%, #0a0a0a 55%, #111111 100%) !important;
  background-image:
    radial-gradient(ellipse at 18% 12%, rgba(217, 119, 6, 0.2), transparent 42%),
    radial-gradient(ellipse at 85% 88%, rgba(194, 65, 12, 0.14), transparent 40%),
    linear-gradient(160deg, #000000 0%, #0a0a0a 55%, #111111 100%) !important;
}

html.app-client .auth-flip-page .login-box,
html.in-huytech-app .auth-flip-page .login-box {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: inherit !important;
}

html.app-client .auth-flip-page .auth-flip-face,
html.in-huytech-app .auth-flip-page .auth-flip-face {
  background: rgba(42, 36, 30, 0.78) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

html.app-client .auth-flip-page .auth-flip-input,
html.app-client .auth-flip-page .auth-flip-form input,
html.in-huytech-app .auth-flip-page .auth-flip-input,
html.in-huytech-app .auth-flip-page .auth-flip-form input {
  color: #f4efe8 !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: none !important;
  -webkit-text-fill-color: #f4efe8 !important;
}

html.app-client .auth-flip-page .auth-flip-form input::placeholder,
html.in-huytech-app .auth-flip-page .auth-flip-form input::placeholder {
  color: rgba(244, 239, 232, 0.45) !important;
  opacity: 1 !important;
  -webkit-text-fill-color: rgba(244, 239, 232, 0.45) !important;
}

html.app-client .auth-flip-page .auth-flip-forgot a,
html.in-huytech-app .auth-flip-page .auth-flip-forgot a {
  color: #fbbf24 !important;
}

html.app-client .auth-flip-page .form-group > label,
html.in-huytech-app .auth-flip-page .form-group > label {
  display: none !important;
}

html.app-client .auth-flip-page .form-footer.web-only-nav,
html.in-huytech-app .auth-flip-page .form-footer.web-only-nav {
  display: block !important;
}

html.app-client .auth-flip-page .form-footer.app-only-nav,
html.in-huytech-app .auth-flip-page .form-footer.app-only-nav {
  display: none !important;
}
