/* ============================================================
   UPLINK 登录页专用样式
   设计风格：深色玻璃拟态 + 橙紫光晕 + 星空背景
   仅登录页（templates/login.html）使用
   ============================================================ */

/* ---------- 页面基础 ---------- */
body.login-page,
body.login-page * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

body.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 20px;
  overflow: hidden;
  background: radial-gradient(circle at 20% 15%, #141824 0%, #0a0c12 55%, #05060b 100%);
}

/* ---------- 星空背景（stars.js 生成）透出页面渐变底色 ---------- */
.star-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden; /* 裁剪屏幕外的星星/流星，避免产生横向滚动条 */
  pointer-events: none;
  background: transparent;
}

.login-page .star-background .star {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8), 0 0 12px rgba(180, 220, 255, 0.5);
}

.star {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.7), 0 0 8px rgba(180, 220, 255, 0.4);
  animation: twinkling 3s infinite alternate, moving 30s infinite alternate;
  transform: translateZ(0); /* 启用硬件加速 */
  backface-visibility: hidden;
}

.meteor {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px #fff, 0 0 16px rgba(180, 220, 255, 0.8);
  pointer-events: none;
}

.meteor::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  width: 140px;
  height: 2px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.95), rgba(180, 220, 255, 0.5), transparent);
  transform: translateY(-50%);
  border-radius: 50%;
}

@keyframes twinkling {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes meteor-fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(-30deg); }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translate(-600px, 350px) rotate(-30deg); }
}

@keyframes moving {
  0% { transform: translate(0, 0); }
  100% { transform: translate(calc(50vw - 50%), calc(50vh - 50%)); }
}

/* ---------- 登录卡片（源自用户设计稿） ---------- */
.login-wrapper {
  --blob-1-color: #ff5e00;
  --blob-2-color: #7000ff;
  --btn-hover-glow: rgba(112, 0, 255, 0.25);
  --input-focus-glow: rgba(112, 0, 255, 0.15);

  position: relative;
  z-index: 1;
  animation: floatUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(30px);
}

@keyframes floatUp {
  to { opacity: 1; transform: translateY(0); }
}

.login-card {
  position: relative;
  width: 330px;
  background-color: #0d0f14;
  border-radius: 24px;
  padding: 36px 28px;
  overflow: hidden;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-wrapper:hover .login-card {
  transform: translateY(-6px);
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.3),
    0 12px 24px rgba(0, 0, 0, 0.15);
}

.glow-blob {
  position: absolute;
  filter: blur(45px);
  border-radius: 50%;
  z-index: 0;
  opacity: 0.6;
  animation: pulseGlow 4s infinite alternate ease-in-out;
  transition:
    opacity 0.5s ease,
    filter 0.5s ease;
}

.login-wrapper:hover .glow-blob {
  opacity: 0.75;
  filter: blur(40px);
}

.blob-1 {
  top: -30px;
  right: -30px;
  width: 170px;
  height: 170px;
  background: var(--blob-1-color);
}

.blob-2 {
  bottom: -50px;
  left: -50px;
  width: 210px;
  height: 210px;
  background: var(--blob-2-color);
  animation-delay: -2s;
}

@keyframes pulseGlow {
  0% { transform: scale(0.9); opacity: 0.5; }
  100% { transform: scale(1.1); opacity: 0.7; }
}

.dark-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(5, 5, 8, 0.85) 30%,
    transparent 100%
  );
  z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: inherit;
}

.view-container {
  position: relative;
  z-index: 10;
}

.form-view {
  display: flex;
  flex-direction: column;
  animation: fadeInView 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 双视图切换：默认显示登录视图，勾选 reg-toggle 后切换到注册视图 */
#signup-view {
  display: none;
}

.reg-toggle:checked ~ .view-container #login-view {
  display: none;
}

.reg-toggle:checked ~ .view-container #signup-view {
  display: flex;
}

@keyframes fadeInView {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.header {
  margin-bottom: 28px;
  text-align: center;
}

.decorative-dot {
  width: 2.2em;
  height: 2.2em;
  margin: 0 auto 1em auto;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
}

.decorative-dot::after {
  content: "";
  width: 1.1em;
  height: 1.1em;
  background-image: radial-gradient(
    circle at center,
    #ffffff 40%,
    transparent 50%
  );
  background-size: 3.5px 3.5px;
  mask-image: radial-gradient(circle at center, black 100%, transparent 100%);
  -webkit-mask-image: -webkit-radial-gradient(
    circle at center,
    black 100%,
    transparent 100%
  );
}

.title {
  color: #ffffff;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 400;
  margin: 0;
}

.input-group {
  margin-bottom: 16px;
  position: relative;
}

.input-field {
  width: 100%;
  padding: 1.05em 1.2em;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.input-field::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.input-field:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 20px var(--input-focus-glow);
  transform: translateY(-2px);
}

.btn-submit {
  width: 100%;
  padding: 1em;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-submit:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--btn-hover-glow);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 视图底部提示：Don't have an account? / Already have an account? */
.signup-prompt {
  margin-top: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

.signup-prompt .toggle-link {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  margin-left: 4px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
  cursor: pointer;
}

.signup-prompt .toggle-link:hover {
  border-color: #ffffff;
}

/* ---------- Flash 消息（深色玻璃风格） ---------- */
.flash-messages {
  margin-bottom: 20px;
}

.flash-message {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  border: 1px solid;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.flash-success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

.flash-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.flash-info {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

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

/* ---------- 小屏适配：卡片自适应宽度，避免在窄预览面板/手机上被裁剪 ---------- */
@media (max-width: 400px) {
  body.login-page {
    padding: 12px;
  }

  .login-card {
    width: 100%;
    max-width: 330px;
    padding: 28px 20px;
  }
}
