/* ==========================================================================
   IdP Unified Authentication UI Style - Ultra-Refined Modern Minimalism
   ========================================================================== */

/* 引入 Google Fonts 提升排版品质 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* 现代字体系统 */
  --auth-font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* 浅色主题变量 - 精致磨砂通透色调 */
  --auth-bg: oklch(0.98 0.003 240); /* 极净暖白 */
  --auth-card-bg: rgba(255, 255, 255, 0.72); /* 磨砂玻璃通透底色 */
  --auth-text: oklch(0.20 0.01 240); /* 深灰 */
  --auth-text-secondary: oklch(0.48 0.01 240); /* 雾灰 */
  
  --auth-primary: oklch(0.56 0.18 255); /* 极富高级感的科技靛蓝 */
  --auth-primary-hover: oklch(0.60 0.17 255);
  --auth-primary-alpha: rgba(79, 70, 229, 0.06);
  
  --auth-error: oklch(0.58 0.18 20);
  --auth-error-bg: rgba(239, 68, 68, 0.05);
  --auth-error-border: rgba(239, 68, 68, 0.15);
  
  --auth-success: oklch(0.58 0.16 140);
  --auth-success-bg: rgba(16, 185, 129, 0.05);
  --auth-success-border: rgba(16, 185, 129, 0.15);
  
  --auth-border: rgba(0, 0, 0, 0.07); /* 极淡的边框描线 */
  --auth-border-hover: rgba(0, 0, 0, 0.15);
  --auth-radius: 18px; /* 更为现代的圆角 */
  --auth-radius-sm: 10px;
  
  --auth-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04), 
                 0 1px 3px 0 rgba(0, 0, 0, 0.02);
  --auth-shadow-hover: 0 20px 40px -15px rgba(0, 0, 0, 0.08), 
                       0 1px 5px 0 rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* 深色主题变量 - 极致深邃科技色调 */
    --auth-bg: oklch(0.10 0.008 240); /* 深邃暗墨灰 */
    --auth-card-bg: rgba(20, 20, 25, 0.65); /* 极通透深色玻璃 */
    --auth-text: oklch(0.92 0.005 240); /* 乳白 */
    --auth-text-secondary: oklch(0.60 0.008 240); /* 雾灰 */
    
    --auth-primary: oklch(0.68 0.16 250); /* 明度略高的淡紫蓝 */
    --auth-primary-hover: oklch(0.72 0.14 250);
    --auth-primary-alpha: rgba(139, 92, 246, 0.12);
    
    --auth-error: oklch(0.65 0.16 20);
    --auth-error-bg: rgba(239, 68, 68, 0.08);
    --auth-error-border: rgba(239, 68, 68, 0.2);
    
    --auth-success: oklch(0.68 0.14 140);
    --auth-success-bg: rgba(16, 185, 129, 0.08);
    --auth-success-border: rgba(16, 185, 129, 0.2);
    
    --auth-border: rgba(255, 255, 255, 0.08); /* 极细致的半透明亮线 */
    --auth-border-hover: rgba(255, 255, 255, 0.18);
    
    --auth-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.4);
    --auth-shadow-hover: 0 30px 60px -15px rgba(0, 0, 0, 0.5);
  }
}

/* ==========================================================================
   全局重置与排版
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--auth-font-family);
  background-color: var(--auth-bg);
  min-height: 100vh;
  color: var(--auth-text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* ==========================================================================
   背景流光渐变球 (Aurora Ambient Glowing Orbs)
   ========================================================================== */
.bg-glow-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.38;
  mix-blend-mode: multiply;
  pointer-events: none;
  will-change: transform;
}

@media (prefers-color-scheme: dark) {
  .bg-glow-orb {
    opacity: 0.22;
    mix-blend-mode: screen;
    filter: blur(140px);
  }
}

.bg-glow-orb-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, oklch(0.65 0.18 260) 0%, transparent 80%);
  top: -10%;
  left: -10%;
  animation: floatOrb1 25s infinite alternate ease-in-out;
}

.bg-glow-orb-2 {
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, oklch(0.60 0.18 310) 0%, transparent 80%);
  bottom: -15%;
  right: -10%;
  animation: floatOrb2 30s infinite alternate ease-in-out;
}

.bg-glow-orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, oklch(0.65 0.15 150) 0%, transparent 80%);
  top: 35%;
  left: 45%;
  transform: translate(-50%, -50%);
  animation: floatOrb3 20s infinite alternate ease-in-out;
}

@keyframes floatOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, 60px) scale(1.1); }
  100% { transform: translate(-40px, 120px) scale(0.95); }
}

@keyframes floatOrb2 {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-100px, -80px) scale(0.9); }
  100% { transform: translate(50px, -150px) scale(1.1); }
}

@keyframes floatOrb3 {
  0% { transform: translate(-50%, -50%) translate(0, 0) scale(1); }
  50% { transform: translate(-50%, -50%) translate(-60px, 80px) scale(1.15); }
  100% { transform: translate(-50%, -50%) translate(80px, -60px) scale(0.9); }
}

/* ==========================================================================
   左右分屏布局体系与平铺卡片
   ========================================================================== */
.auth-split-container {
  display: grid;
  grid-template-columns: 42% 58%;
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* 左半屏：深邃科技氛围侧 */
.auth-sidebar {
  background-color: oklch(0.08 0.005 240); /* 极致暗黑面 */
  color: white;
  padding: 80px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  z-index: 2;
}

/* 在深色左屏上加一条细长右边框，增强立体切分线 */
.auth-sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.08) 20%, rgba(255, 255, 255, 0.08) 80%, transparent);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  z-index: 3;
  position: relative;
}

.brand-section {
  margin-top: 40px;
}

.brand-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.15;
  color: oklch(0.95 0.005 240);
  margin-top: 24px;
}

.brand-subtitle {
  font-size: 15px;
  color: oklch(0.65 0.008 240);
  margin-top: 12px;
  font-weight: 400;
  max-width: 320px;
  line-height: 1.5;
}

/* 系统运行状态指示器 */
.system-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  border-radius: 30px;
  width: fit-content;
  backdrop-filter: blur(8px);
  margin-bottom: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: oklch(0.68 0.16 140); /* 薄荷绿 */
  box-shadow: 0 0 12px oklch(0.68 0.16 140);
  animation: pulse-green 2s infinite ease-in-out;
}

@keyframes pulse-green {
  0% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 8px oklch(0.68 0.16 140 / 0.4); }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 14px oklch(0.68 0.16 140 / 0.8); }
  100% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 8px oklch(0.68 0.16 140 / 0.4); }
}

.status-text {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: oklch(0.75 0.005 240);
}

/* 右半屏：表单侧 */
.auth-form-side {
  background-color: var(--auth-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 48px;
  z-index: 2;
  position: relative;
  transition: background-color 0.4s ease;
}

.auth-card {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  max-width: 400px;
  width: 100%;
  position: relative;
  overflow: visible;
  transition: none;
  z-index: 1;
}

.auth-card:hover {
  box-shadow: none;
  border-color: transparent;
}

/* ==========================================================================
   交错动画加载系统
   ========================================================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  opacity: 0;
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 { animation-delay: 40ms; }
.delay-2 { animation-delay: 90ms; }
.delay-3 { animation-delay: 140ms; }
.delay-4 { animation-delay: 190ms; }
.delay-5 { animation-delay: 240ms; }
.delay-6 { animation-delay: 290ms; }

/* ==========================================================================
   头部 (Logo 与标题)
   ========================================================================== */
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

/* Logo Shimmer 扫光动画 */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--auth-primary) 0%, oklch(0.55 0.18 290) 50%, var(--auth-primary) 100%);
  background-size: 200% 100%;
  border-radius: var(--auth-radius-sm);
  color: white;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.4);
  position: relative;
  overflow: hidden;
  animation: shimmer 4s infinite linear;
}

.auth-logo::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 4s infinite linear;
}

.auth-header h1 {
  font-size: 24px;
  color: var(--auth-text);
  font-weight: 600;
  letter-spacing: -0.5px;
}

.auth-header p {
  color: var(--auth-text-secondary);
  margin-top: 8px;
  font-size: 14px;
  font-weight: 400;
}

/* ==========================================================================
   消息提示卡片
   ========================================================================== */
.auth-message {
  padding: 12px 16px;
  border-radius: var(--auth-radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

.auth-message.error {
  background: var(--auth-error-bg);
  border: 1px solid var(--auth-error-border);
  color: var(--auth-error);
}

.auth-message.success {
  background: var(--auth-success-bg);
  border: 1px solid var(--auth-success-border);
  color: var(--auth-success);
}

/* ==========================================================================
   表单与输入框 (高级磨砂聚焦)
   ========================================================================== */
.auth-form .form-group {
  margin-bottom: 20px;
  text-align: left;
}

.auth-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
  color: var(--auth-text-secondary);
  letter-spacing: 0.2px;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="tel"],
.auth-form input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  font-family: var(--auth-font-family);
  font-size: 14px;
  color: var(--auth-text);
  background-color: rgba(0, 0, 0, 0.02);
  transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              background-color 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  .auth-form input[type="text"],
  .auth-form input[type="email"],
  .auth-form input[type="password"],
  .auth-form input[type="tel"],
  .auth-form input[type="number"] {
    background-color: rgba(255, 255, 255, 0.03);
  }
}

.auth-form input:hover {
  border-color: var(--auth-border-hover);
}

.auth-form input:focus {
  border-color: var(--auth-primary);
  background-color: rgba(255, 255, 255, 0.95);
  outline: none;
  box-shadow: 0 0 0 4px var(--auth-primary-alpha), 0 4px 12px rgba(99, 102, 241, 0.08);
}

@media (prefers-color-scheme: dark) {
  .auth-form input:focus {
    background-color: rgba(15, 15, 20, 0.85);
    box-shadow: 0 0 0 4px var(--auth-primary-alpha), 0 4px 12px rgba(139, 92, 246, 0.15);
  }
}

.auth-form input::placeholder {
  color: oklch(0.65 0.005 240);
  opacity: 0.8;
}

/* 密码框眼睛包装器与定位 */
.password-input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 46px !important;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--auth-text-secondary);
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 2;
  border-radius: 50%;
}

.password-toggle-btn:hover {
  color: var(--auth-primary);
  background-color: rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  .password-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
  }
}

.password-toggle-btn:active {
  transform: scale(0.95);
}

.password-toggle-btn svg {
  width: 20px;
  height: 20px;
}

/* 选项行 (记住我 / 忘记密码) */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 13px;
}

.form-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  color: var(--auth-text-secondary);
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

.form-options input[type="checkbox"] {
  accent-color: var(--auth-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.form-options a {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.form-options a:hover {
  color: var(--auth-primary-hover);
}

/* ==========================================================================
   按钮与优雅加载动画
   ========================================================================== */
.auth-button {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--auth-primary) 0%, oklch(0.52 0.18 280) 100%);
  color: white;
  border: none;
  border-radius: var(--auth-radius-sm);
  font-family: var(--auth-font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 20px -6px rgba(99, 102, 241, 0.4);
}

.auth-button:hover {
  background: linear-gradient(135deg, var(--auth-primary-hover) 0%, oklch(0.56 0.18 280) 100%);
  box-shadow: 0 10px 24px -6px rgba(99, 102, 241, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.auth-button:active {
  transform: scale(0.98);
}

.auth-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* 精致旋转 CSS Loading 容器 */
.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-button.secondary {
  background-color: transparent;
  color: var(--auth-text);
  border: 1px solid var(--auth-border);
  box-shadow: none;
}

.auth-button.secondary:hover {
  border-color: var(--auth-primary);
  background-color: var(--auth-primary-alpha);
  color: var(--auth-primary);
}

/* ==========================================================================
   第三方社交登录区 (轻量胶囊/圆角按钮)
   ========================================================================== */
.oauth-section {
  margin-top: 28px;
}

.oauth-divider {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  color: var(--auth-text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--auth-border);
}

.oauth-divider span {
  padding: 0 12px;
}

.oauth-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.oauth-button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  text-decoration: none;
  color: var(--auth-text);
  font-size: 13.5px;
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  .oauth-button {
    background-color: rgba(255, 255, 255, 0.03);
  }
}

.oauth-button:hover {
  border-color: var(--auth-primary);
  background-color: var(--auth-primary-alpha);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
  .oauth-button:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  }
}

.oauth-button:active {
  transform: scale(0.98);
}

.oauth-button svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.oauth-button:hover svg {
  transform: scale(1.05);
}

/* ==========================================================================
   页脚与语言切换
   ========================================================================== */
.auth-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 13px;
  color: var(--auth-text-secondary);
}

.auth-footer a {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.auth-footer a:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

.auth-footer-links {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--auth-border);
  font-size: 12px;
}

.auth-footer-links a {
  color: var(--auth-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.auth-footer-links a:hover {
  color: var(--auth-primary);
}

.auth-footer-links .divider {
  margin: 0 8px;
  color: var(--auth-border);
}

/* 语言切换器：磨砂扁平化 */
.auth-lang-switcher {
  margin-top: 24px;
  text-align: center;
}

.lang-form {
  display: inline-block;
}

.lang-form select {
  padding: 6px 12px;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  font-family: var(--auth-font-family);
  font-size: 12px;
  font-weight: 500;
  color: var(--auth-text-secondary);
  background-color: var(--auth-bg);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.lang-form select:hover {
  border-color: var(--auth-border-hover);
  color: var(--auth-text);
}

.lang-form select:focus {
  border-color: var(--auth-primary);
}

/* ==========================================================================
   其他认证形态 (MFA, 客户端授权, 密码强度)
   ========================================================================== */
.mfa-code-input {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}

.mfa-code-input input {
  width: 46px;
  height: 52px;
  text-align: center;
  font-family: var(--auth-font-family);
  font-size: 22px;
  font-weight: 600;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  background-color: var(--auth-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mfa-code-input input:focus {
  border-color: var(--auth-primary);
  outline: none;
  background-color: var(--auth-card-bg);
  box-shadow: 0 0 0 4px var(--auth-primary-alpha);
}

.client-info {
  background-color: var(--auth-primary-alpha);
  border: 1px dashed var(--auth-primary);
  border-radius: var(--auth-radius-sm);
  padding: 16px;
  margin-bottom: 24px;
  text-align: left;
}

.client-info .client-name {
  font-weight: 600;
  color: var(--auth-primary);
  font-size: 15px;
}

.client-info .client-scopes {
  margin-top: 6px;
  color: var(--auth-text-secondary);
  font-size: 12px;
}

/* 密码强度指示器 */
.password-strength {
  height: 6px;
  border-radius: 3px;
  margin-top: 8px;
  background-color: var(--auth-border);
  overflow: hidden;
}

.password-strength-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-text {
  font-size: 11px;
  font-weight: 500;
  margin-top: 6px;
}

/* ==========================================================================
   响应式断点优化 (移动端折叠)
   ========================================================================== */
@media (max-width: 768px) {
  .auth-split-container {
    grid-template-columns: 100%;
  }

  .auth-sidebar {
    display: none;
  }

  .auth-form-side {
    padding: 48px 24px;
    min-height: 100vh;
  }

  .auth-card {
    max-width: 100%;
    padding: 0;
  }

  .oauth-buttons {
    flex-direction: column;
    gap: 10px;
  }
}
