/* ============================================================
   Halo theme-pix Auth Patch — auth.css v5.2
   暴力覆盖 Halo 默认 main.css 的高优先级选择器
   ============================================================ */

/* ===========================================================
   1. 基础
   =========================================================== */

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif !important;
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  background: #ffffff !important;
  position: relative;
}

/* ===========================================================
   2. 粉紫色模糊光斑
   =========================================================== */

body::before {
  content: "";
  position: fixed;
  top: 18%;
  left: 8%;
  width: 520px;
  height: 520px;
  background: radial-gradient(
    circle,
    rgba(196, 130, 255, 0.55) 0%,
    rgba(255, 170, 200, 0.4) 30%,
    rgba(180, 130, 255, 0.25) 50%,
    transparent 70%
  );
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
  animation: blob-float 12s ease-in-out infinite;
}

body::after {
  content: "";
  position: fixed;
  bottom: 5%;
  right: 8%;
  width: 400px;
  height: 400px;
  background: radial-gradient(
    circle,
    rgba(255, 200, 220, 0.5) 0%,
    rgba(190, 150, 255, 0.3) 40%,
    transparent 70%
  );
  filter: blur(90px);
  z-index: 0;
  pointer-events: none;
  animation: blob-float 14s ease-in-out infinite reverse;
}

@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.05); }
}

/* ===========================================================
   3. 容器
   =========================================================== */

.gateway-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 1rem;
}

/* ===========================================================
   4. Logo
   =========================================================== */

.gateway-wrapper > div:first-child {
  margin-bottom: 0.25rem;
}

.gateway-wrapper > div:first-child img,
.gateway-wrapper > div:first-child svg {
  max-height: 48px;
  width: auto;
}

/* ===========================================================
   5. 标题（一行）
   =========================================================== */

.auth-title {
  display: block;
  width: 100%;
  max-width: 380px;
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2.25rem) !important;
  font-weight: 800 !important;
  line-height: 1.2;
  color: #111827 !important;
  letter-spacing: -0.02em;
  margin: 0.5rem 0 1.25rem !important;
  white-space: nowrap;
}

/* ===========================================================
   6. 隐藏 Halo 默认表单标题
   =========================================================== */

.halo-form-wrapper > h1:first-child,
.halo-form-wrapper > h2:first-child,
.halo-form-wrapper > h3:first-child {
  display: none !important;
}

/* ===========================================================
   7. ★ 关键：暴力重置 halo-form-wrapper 卡片
   =========================================================== */

.halo-form-wrapper,
div.halo-form-wrapper {
  width: 100% !important;
  max-width: 380px !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  animation: form-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes form-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===========================================================
   8. 重置 form 内部所有 flex 容器
   =========================================================== */

.halo-form-wrapper form,
.halo-form-wrapper form.halo-form,
.halo-form-wrapper .form-input,
.halo-form-wrapper .form-input-stack,
.halo-form-wrapper .form-label-group {
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ★ v5.7：不重置 .form-item 的 display，保留 Halo 默认 flex column
   否则会破坏 form-item-group 两列布局（注册页用户名+名称左右并排） */

.halo-form-wrapper .form-item {
  margin-bottom: 0.85rem !important;
}

/* form-item-group 内部 form-item 占 50% 宽度（两列布局） */
.halo-form-wrapper .form-item-group {
  display: flex !important;
  gap: 0.75rem !important;
  margin-bottom: 0.85rem !important;
  width: 100% !important;
}

.halo-form-wrapper .form-item-group .form-item {
  flex: 1 !important;
  min-width: 0 !important;
  margin-bottom: 0 !important;
}

.halo-form-wrapper .form-label-group {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem !important;
}

.halo-form-wrapper .form-label-group label {
  margin: 0 !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  color: #4a5a6a !important;
  text-align: left !important;
}

/* 所有 label 强制左对齐 + 拉伸占满宽度（避免 Halo 默认 flex 居中） */
.halo-form-wrapper .form-item > label {
  display: block !important;
  align-self: stretch !important;
  width: 100% !important;
  text-align: left !important;
  margin: 0 0 0.4rem 0 !important;
  padding: 0 !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  color: #4a5a6a !important;
}

.halo-form-wrapper .form-item-extra-link {
  font-size: 0.82rem !important;
  color: #7c5cff !important;
  text-decoration: none !important;
}

.halo-form-wrapper .form-item-extra-link:hover {
  color: #5b3cff !important;
  text-decoration: underline !important;
}

.halo-form-wrapper .form-item-compact {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1.25rem !important;
}

.halo-form-wrapper .form-item-compact label {
  margin: 0 !important;
  font-size: 0.85rem !important;
  color: #6b7280 !important;
  cursor: pointer;
}

.halo-form-wrapper .form-input-stack {
  position: relative !important;
}

/* ===========================================================
   9. ★ v5.5：先重置 .form-input 容器，再让 input 显示样式
   Halo 默认结构：
     <div class="form-input">         ← 容器，自带白底+灰边+4px 圆角
       <input />                       ← 子元素
     </div>
   必须让容器透明，只让 input 显示大圆角+纯白
   =========================================================== */

/* 9.1 重置 .form-input 容器（让 Halo 默认的外框消失） */
.halo-form-wrapper .form-input {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  display: block !important;
}

/* 9.2 input 显示大圆角+纯白 */
.halo-form-wrapper input[type="text"],
.halo-form-wrapper input[type="password"],
.halo-form-wrapper input[type="email"],
.halo-form-wrapper input:not([type]),
.halo-form-wrapper .form-input input,
.halo-form-wrapper .form-input-stack input {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  height: 48px !important;
  min-height: 48px !important;
  padding: 0 16px !important;
  transition: all 0.2s ease !important;
  outline: none !important;
}

.halo-form-wrapper input::placeholder {
  color: #9ca3af !important;
  opacity: 1 !important;
}

.halo-form-wrapper input:hover {
  border-color: #c4b5fd !important;
}

.halo-form-wrapper input:focus {
  border-color: #7c5cff !important;
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.1) !important;
}

/* 密码框 input 留出眼睛图标空间 */
.halo-form-wrapper .form-input-stack input {
  padding-right: 44px !important;
}

/* ===========================================================
   10. 眼睛图标
   =========================================================== */

.halo-form-wrapper .form-input-stack-icon,
.halo-form-wrapper .toggle-password-button {
  position: absolute !important;
  right: 6px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
  color: #9ca3af !important;
  border-radius: 6px;
  transition: all 0.2s ease;
  z-index: 2;
  background: transparent !important;
  margin: 0 !important;
}

.halo-form-wrapper .form-input-stack-icon:hover {
  color: #6b7280 !important;
  background: rgba(0, 0, 0, 0.04) !important;
}

.halo-form-wrapper .form-input-stack-icon svg,
.halo-form-wrapper .toggle-password-button svg {
  width: 18px !important;
  height: 18px !important;
}

/* ===========================================================
   11. ★ 暴力重置按钮（紫色渐变）
   =========================================================== */

.halo-form-wrapper button[type="submit"],
.halo-form-wrapper .form-item button,
.halo-form-wrapper .halo-button {
  width: 100% !important;
  height: 48px !important;
  min-height: 48px !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  background: linear-gradient(135deg, #7c5cff 0%, #a87cff 100%) !important;
  background-color: #7c5cff !important;
  border: none !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  letter-spacing: 0.05em;
  box-shadow:
    0 8px 24px rgba(124, 92, 255, 0.35) !important;
  transition: all 0.2s ease !important;
  margin-top: 0.5rem !important;
  padding: 0 !important;
  display: block !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.halo-form-wrapper button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 32px rgba(124, 92, 255, 0.45) !important;
}

.halo-form-wrapper button:active {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.3) !important;
}

/* ===========================================================
   12. 复选框
   =========================================================== */

.halo-form-wrapper input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  accent-color: #7c5cff !important;
  cursor: pointer;
  background: transparent !important;
  border: none !important;
  display: inline-block !important;
  appearance: auto !important;
  -webkit-appearance: auto !important;
}

/* ===========================================================
   13. 卡片外部元素
   =========================================================== */

.gateway-wrapper > div:not(:first-child):not(:nth-child(2)) {
  text-align: center !important;
  font-size: 0.9rem !important;
  color: #6b7280 !important;
  animation: fade-in 0.6s 0.2s both;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.gateway-wrapper a {
  color: #5b6cff !important;
  text-decoration: none !important;
  font-weight: 500;
  transition: color 0.2s ease;
}

.gateway-wrapper a:hover {
  color: #4255ff !important;
  text-decoration: underline !important;
}

/* ===========================================================
   14. 错误信息
   =========================================================== */

.halo-form-wrapper .error,
.halo-form-wrapper [class*="error"] {
  color: #ff5b5b !important;
  font-size: 0.85rem !important;
  margin-top: 0.25rem !important;
}

/* ===========================================================
   15. 响应式
   =========================================================== */

@media (max-width: 480px) {
  .auth-title {
    font-size: 1.4rem !important;
    white-space: normal;
  }
  body::before {
    width: 320px;
    height: 320px;
    top: 5%;
    left: -10%;
  }
  body::after {
    width: 280px;
    height: 280px;
  }
}
