/* ============================================================
   Descend Network · 独立页面样式（主页 / 登录页）
   依赖 style.css 中的 CSS 变量与基础规则
   ============================================================ */

/* ============================================================
   通用：独立页面 body
   ============================================================ */
/* 注意：style.css 里有全局规则
     html, body { height: 100%; overflow: hidden; }
   那是为控制台（#app 内部固定布局）设计的，会让主页内容
   超出视口时被直接截断、无法滚动。
   这里针对独立页面显式恢复滚动；由于 style-pages.css 在
   style.css 之后加载，且 .page-body 比 body 更具体，可正确覆盖。
   dashboard.html 不加载本文件，因此控制台行为不受影响。 */
html:has(.page-body),
html:has(.page-body) body,
body.page-body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

/* 不支持 :has() 的浏览器回退：直接覆盖 body（html 上的
   overflow:hidden 不会阻止 body 自身滚动，因为 body 有独立滚动条） */
body.page-body {
  height: auto !important;
  min-height: 100vh;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.page-body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans, system-ui, -apple-system, "Segoe UI", sans-serif);
  margin: 0;
}

/* 背景光晕，与产品整体视觉一致。
   用 fixed 定位，滚动时保持不动。 */
.page-body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--ion-blue-dim), transparent 60%),
    radial-gradient(800px 500px at 90% 5%, rgba(124, 58, 237, 0.10), transparent 60%);
}

.page-body > * { position: relative; z-index: 1; }

/* ============================================================
   登录页
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: 36px 32px 28px;
  animation: auth-card-in 0.4s ease both;
}

@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 品牌 */
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  margin-bottom: 26px;
}
.auth-brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--glass-border-hover);
  color: var(--ion-blue);
  background: var(--ion-blue-dim);
}
.auth-brand-mark svg { width: 20px; height: 20px; }
.auth-brand-text {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* 标题 */
.auth-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: 0.5px;
}
.auth-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 22px;
}

/* 错误提示 */
.auth-error {
  background: rgba(249, 115, 22, 0.10);
  border: 1px solid rgba(249, 115, 22, 0.30);
  color: #ffb27a;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  animation: auth-shake 0.35s ease;
}
@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* 表单 */
.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}
.auth-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 11px 13px;
  outline: none;
  transition: border-color var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
  font-family: inherit;
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus {
  border-color: var(--ion-blue);
  box-shadow: 0 0 0 3px var(--ion-blue-dim);
}

/* 提交按钮 */
.auth-submit {
  position: relative;
  margin-top: 4px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--ion-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s ease, transform 0.15s ease;
  font-family: inherit;
}
.auth-submit:hover:not(:disabled) { opacity: 0.92; }
.auth-submit:active:not(:disabled) { transform: translateY(1px); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-submit .btn-spinner { display: none; }
.auth-submit.loading .btn-spinner {
  display: block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(4, 7, 15, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* 分隔线 */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* OAuth 按钮 */
.auth-oauth {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 136, 204, 0.3);
  background: rgba(0, 136, 204, 0.06);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}
.auth-oauth:hover { background: rgba(0, 136, 204, 0.12); border-color: rgba(0, 136, 204, 0.5); }
.auth-oauth.loading { opacity: 0.6; pointer-events: none; }
.auth-oauth img { width: 20px; height: 20px; flex-shrink: 0; display: block; }

/* 模式切换 */
.auth-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}
.auth-switch a {
  color: var(--ion-blue);
  cursor: pointer;
  margin-left: 4px;
  text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

.auth-terms {
  text-align: center;
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.auth-back {
  display: block;
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.auth-back:hover { color: var(--ion-blue); }

/* ============================================================
   主题切换按钮（主页导航 / 登录页浮动）
   ============================================================ */
.icon-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}
.icon-toggle:hover {
  color: var(--ion-blue);
  border-color: var(--glass-border-hover);
  background: var(--ion-blue-dim);
}
.icon-toggle svg { width: 17px; height: 17px; }
.icon-toggle > span { display: inline-flex; align-items: center; }

/* 登录页：固定在右上角 */
.icon-toggle.floating {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
}

/* 按主题切换图标显示（与 style.css 中控制台按钮逻辑一致）
   ------------------------------------------------------------
   注意特异性：上面 .icon-toggle > span（0,1,1）会给两个图标都设
   display:inline-flex，因此这里必须用 (0,2,1) 的选择器才能覆盖。
   原先写的是 .theme-icon-light（0,1,0），特效性不足 →
   暗色模式下亮色图标没能被隐藏，导致两个图标同时出现。 */
.icon-toggle > .theme-icon-dark  { display: inline-flex; align-items: center; }
.icon-toggle > .theme-icon-light { display: none; }
[data-theme="light"] .icon-toggle > .theme-icon-dark  { display: none; }
[data-theme="light"] .icon-toggle > .theme-icon-light { display: inline-flex; }

/* ============================================================
   主页
   ============================================================ */
.home-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px 24px;
}
.home-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}
.home-nav-brand .auth-brand-mark { margin: 0; }
.home-nav-links { display: flex; align-items: center; gap: 10px; }

.btn-ghost,
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-ghost {
  color: var(--text-secondary);
  border-color: var(--glass-border);
  background: transparent;
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--glass-border-hover); }

.btn-cta {
  color: #fff;
  background: var(--ion-blue);
  font-weight: 600;
}
.btn-cta:hover { opacity: 0.9; }

/* Hero */
.home-hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 70px 24px 60px;
  text-align: center;
}
.home-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ion-blue);
  background: var(--ion-blue-dim);
  border: 1px solid var(--glass-border-hover);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 24px;
  letter-spacing: 0.3px;
}
.home-title {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 18px;
  letter-spacing: -0.5px;
}
.home-title .grad {
  background: var(--ion-blue);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.home-subtitle {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 34px;
}
.home-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.home-actions .btn-cta,
.home-actions .btn-ghost { padding: 13px 28px; font-size: 14px; }

/* 特性卡片 */
.home-features {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}
.home-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.home-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-3px);
}
.home-card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--ion-blue-dim);
  color: var(--ion-blue);
  margin-bottom: 16px;
}
.home-card-icon svg { width: 20px; height: 20px; }
.home-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
}
.home-card p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
}

/* 页脚 */
.home-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 26px 24px 40px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}
.home-footer a { color: var(--text-muted); text-decoration: none; }
.home-footer a:hover { color: var(--ion-blue); }

@media (max-width: 640px) {
  .home-hero { padding: 40px 20px 36px; }
  .home-features { padding: 12px 20px 56px; }
  .auth-card { padding: 28px 22px 22px; }
}
