/**
 * QieYun Auth Critical — 登录/注册/找回密码首屏必需基样式
 * 从 fw-design 抽取，避免认证页同步下载完整 fw-design（~285KB + Google Fonts）
 * 完整 fw-design.css 在进入非 auth 后由 __qyEnsureShellCss 加载
 */

/* ===== Theme tokens（认证页用到的变量） ===== */
:root,
[data-theme="slate"] {
  --fw-bg: #0A0A0A;
  --fw-bg-2: #111111;
  --fw-surface: rgba(17, 17, 17, 0.92);
  --fw-glass: rgba(255, 255, 255, 0.04);
  --fw-glass-hover: rgba(255, 255, 255, 0.07);
  --fw-border: rgba(255, 255, 255, 0.06);
  --fw-border-hover: rgba(38, 166, 154, 0.35);
  --fw-cyan: #22D3EE;
  --fw-cyan-dim: rgba(34, 211, 238, 0.12);
  --fw-purple: #6366F1;
  --fw-violet: #A855F7;
  --fw-gradient: linear-gradient(135deg, #6366F1 0%, #22D3EE 100%);
  --fw-gradient-btn: linear-gradient(135deg, #22D3EE 0%, #6366F1 55%, #A855F7 100%);
  --fw-text: #F1F5F9;
  --fw-text-muted: #94A3B8;
  --fw-radius: 16px;
  --fw-radius-sm: 10px;
  --fw-blur: blur(20px);
  --fw-glow: 0 0 40px rgba(38, 166, 154, 0.08);
}

[data-theme="light"] {
  --fw-bg: #F1F5F9;
  --fw-bg-2: #FFFFFF;
  --fw-surface: rgba(255, 255, 255, 0.92);
  --fw-glass: rgba(255, 255, 255, 0.85);
  --fw-glass-hover: rgba(255, 255, 255, 0.95);
  --fw-border: rgba(15, 23, 42, 0.08);
  --fw-border-hover: rgba(59, 130, 246, 0.45);
  --fw-cyan: #0EA5E9;
  --fw-cyan-dim: rgba(14, 165, 233, 0.1);
  --fw-gradient: linear-gradient(135deg, #3B82F6 0%, #0EA5E9 100%);
  --fw-gradient-btn: linear-gradient(135deg, #0EA5E9 0%, #3B82F6 100%);
  --fw-text: #0F172A;
  --fw-text-muted: #64748B;
  --fw-glow: 0 0 40px rgba(59, 130, 246, 0.12);
}

[data-theme="purple"] {
  --fw-bg: #0A0A0A;
  --fw-glass: rgba(168, 85, 247, 0.05);
  --fw-glass-hover: rgba(168, 85, 247, 0.08);
  --fw-border: rgba(255, 255, 255, 0.06);
  --fw-cyan: #A855F7;
  --fw-gradient: linear-gradient(135deg, #7C3AED 0%, #A855F7 100%);
  --fw-gradient-btn: linear-gradient(135deg, #A855F7 0%, #6366F1 100%);
  --fw-text: #F1F5F9;
  --fw-text-muted: #94A3B8;
}

[data-theme="cyan"] {
  --fw-bg: #0A0A0A;
  --fw-glass: rgba(34, 211, 238, 0.04);
  --fw-glass-hover: rgba(34, 211, 238, 0.07);
  --fw-border: rgba(255, 255, 255, 0.06);
  --fw-cyan: #22D3EE;
  --fw-gradient: linear-gradient(135deg, #06B6D4 0%, #22D3EE 100%);
  --fw-gradient-btn: linear-gradient(135deg, #22D3EE 0%, #06B6D4 100%);
  --fw-text: #F1F5F9;
  --fw-text-muted: #94A3B8;
}

html[data-theme="dark"] {
  --fw-bg: #0A0A0A;
  --fw-bg-2: #111111;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', system-ui, sans-serif;
  background: var(--fw-bg);
  color: var(--fw-text);
}

/* 非 auth 冷启动：壳层 CSS 就绪前隐藏 body，避免 FOUC */
html.qy-css-pending body {
  visibility: hidden;
}

/* ===== Glass / Button（认证 DOM 直接依赖） ===== */
.fw-glass {
  background: var(--fw-glass);
  backdrop-filter: var(--fw-blur);
  -webkit-backdrop-filter: var(--fw-blur);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius);
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.fw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--fw-radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s;
  border: none;
  font-family: inherit;
}
.fw-btn-primary {
  background: var(--fw-gradient-btn);
  color: #0F172A;
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.22);
}
.fw-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(34, 211, 238, 0.32);
}
.fw-btn-block { width: 100%; }

/* ===== Hero décor base（qy-auth 只覆盖，不提供 position） ===== */
.fw-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
}
.fw-hero-glow {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.15) 0%, rgba(0, 229, 255, 0.08) 40%, transparent 70%);
  animation: fwPulse 6s ease-in-out infinite;
}
@keyframes fwPulse {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
  .fw-hero-glow { animation: none; }
}

/* ===== Auth page base（qy-auth.css 覆盖视觉；此处保证未覆盖前也不错乱） ===== */
.fw-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: var(--fw-bg);
  box-sizing: border-box;
}
.fw-auth-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fw-auth-bg .fw-hero-grid {
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
}
.fw-auth-bg .fw-hero-glow {
  top: 30%;
  width: 500px;
  height: 350px;
}
.fw-auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  box-sizing: border-box;
}
.fw-auth-card h1 {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fw-text-muted);
}
.fw-auth-card h2 {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--fw-text);
}
.fw-auth-card .subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--fw-text-muted);
  margin-bottom: 28px;
  line-height: 1.65;
}
.fw-auth-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: min(160px, 72%);
  max-height: 56px;
  margin: 0 auto 16px;
  padding: 6px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  box-sizing: border-box;
}
.fw-auth-logo-fallback {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  margin: 0 auto 16px;
  background: var(--fw-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}
.fw-auth-card form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fw-auth-card .field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fw-text-muted);
  margin-top: 8px;
  letter-spacing: 0.04em;
}
.fw-auth-card input {
  background: rgba(0, 0, 0, 0.35) !important;
  border: 1px solid var(--fw-border) !important;
  color: var(--fw-text) !important;
  border-radius: var(--fw-radius-sm) !important;
  padding: 12px 14px !important;
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
  font-family: inherit;
}
.fw-auth-card input:focus {
  border-color: var(--fw-cyan) !important;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12) !important;
  outline: none;
}
.fw-auth-card input::placeholder {
  color: rgba(148, 163, 184, 0.6);
}
.fw-auth-links {
  text-align: right;
  margin: 4px 0 12px;
}
.fw-auth-links a {
  font-size: 13px;
  color: var(--fw-cyan);
  cursor: pointer;
}
.fw-auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--fw-text-muted);
}
.fw-auth-footer a {
  color: var(--fw-cyan);
  font-weight: 600;
  cursor: pointer;
}
.fw-auth-theme {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
}
.fw-auth-card .code-row {
  display: flex;
  gap: 8px;
}
.fw-auth-card .code-row input {
  flex: 1;
  min-width: 0;
}
.fw-auth-card .code-row .fw-btn {
  flex-shrink: 0;
  padding: 10px 16px;
  width: auto;
  max-width: none;
}

/* ===== Theme toggle on auth card ===== */
.fw-theme-switcher-slot {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
}
.fw-nav-util-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--fw-text) !important;
  cursor: pointer;
  flex-shrink: 0;
}
html:not([data-theme="light"]) .fw-nav-util-btn { color: #e2e8f0 !important; }
html[data-theme="light"] .fw-nav-util-btn { color: #475569 !important; }
.fw-nav-util-btn__icon,
.fw-nav-util-btn__icon--theme,
.fw-nav-util-btn__icon--theme svg {
  width: 22px !important;
  height: 22px !important;
  display: block !important;
  line-height: 0;
}

@media (max-width: 640px) {
  .fw-auth-card { padding: 32px 24px; }
}
