/*
 * 登录页：蓝白海天专业风格
 */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600&display=swap');

:root {
  --auth-bg-paper: var(--color-bg);
  --auth-bg-panel: rgba(255, 255, 255, 0.96);
  --auth-border-light: rgba(24, 50, 74, 0.08);
  --auth-border-dark: rgba(24, 50, 74, 0.16);
  --auth-text-primary: var(--color-text-primary);
  --auth-text-secondary: var(--color-text-secondary);
  --auth-text-tertiary: var(--color-text-tertiary);
  --auth-accent: var(--color-primary);
  
  --auth-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --auth-font-serif: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
}

.auth-page {
  display: none;
  min-height: 100vh;
  background-color: var(--auth-bg-paper);
  color: var(--auth-text-primary);
  font-family: var(--auth-font-sans);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow: hidden;
}

.auth-page.active {
  display: block;
}

/* --- 纸纹与背景 --- */
.auth-page::before { content: none; }

.auth-ambient-orb {
  position: absolute;
  top: -10%;
  left: 50%;
  width: 800px;
  height: 400px;
  background: radial-gradient(ellipse at center, rgba(47, 111, 159, 0.1) 0%, transparent 72%);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
  animation: breathe 8s ease-in-out infinite alternate;
}

@keyframes breathe {
  0% { transform: translateX(-50%) scale(1); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1.05); opacity: 1; }
}

/* --- 核心布局 --- */
.auth-grid {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.auth-brand {
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-brand-logo {
  color: var(--auth-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.draw-line {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawStroke 2.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.draw-line.delay-1 { animation-delay: 0.3s; }
.draw-line.delay-2 { animation-delay: 0.6s; }
@keyframes drawStroke { to { stroke-dashoffset: 0; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.auth-brand h1 { font-family: var(--auth-font-serif); font-size: 28px; font-weight: 400; color: var(--auth-text-primary); margin: 0; letter-spacing: -0.02em; }
.auth-brand p { font-size: 15px; color: var(--auth-text-secondary); margin: 0; }

.auth-panel {
  width: 100%;
  max-width: 500px;
  background: var(--auth-bg-panel);
  border: 1px solid var(--auth-border-light);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: 0 18px 36px -30px rgba(24, 50, 74, 0.2);
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- 选项卡 --- */
.auth-tabs {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(200, 195, 185, 0.3);
}

.auth-tab {
  background: transparent;
  border: none;
  padding: 0 0 10px 0;
  color: var(--auth-text-secondary);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--auth-text-primary);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.auth-tab:hover { color: var(--auth-text-primary); }
.auth-tab.active { color: var(--auth-text-primary); }
.auth-tab.active::after { transform: scaleX(1); }

/* --- 🌟 伸缩抽屉切换效果 (Smooth Height Grid) --- */
.auth-pane-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-pane-wrapper.active {
  grid-template-rows: 1fr;
}

.auth-pane-content {
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-pane-wrapper.active > .auth-pane-content {
  opacity: 1;
  transition-delay: 0.1s;
}

/* --- 扫码块精修 --- */
.auth-qr-card { text-align: center; padding-top: 10px; }
.auth-status-pill {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border: 1px solid rgba(47, 111, 159, 0.24); border-radius: 999px;
  color: var(--auth-accent); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 24px;
  background: rgba(47, 111, 159, 0.06);
}
.auth-status-pill.is-ready { border-color: rgba(24, 50, 74, 0.14); color: var(--auth-text-primary); background: rgba(24, 50, 74, 0.04); }

.auth-qr-stage { margin: 0 auto 24px; display: flex; justify-content: center; }
.auth-qr-frame {
  width: 180px; height: 180px; background: var(--auth-bg-paper);
  border: 1px dashed var(--auth-border-dark); border-radius: 8px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 16px;
  transition: transform 0.4s ease;
}
.auth-qr-frame:hover { transform: translateY(-4px); border-style: solid; }
.auth-qr-frame span { display: block; background: var(--auth-border-light); border-radius: 2px; animation: qrPulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
.auth-qr-frame span:nth-child(even) { animation-delay: -0.5s; background: var(--auth-border-dark); }
.auth-qr-frame span:nth-child(3n) { animation-delay: -1s; }
.auth-qr-frame span:nth-child(5n) { background: var(--auth-text-tertiary); }
@keyframes qrPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }

.auth-qr-card h3 { margin: 0 0 8px; font-size: 18px; font-family: var(--auth-font-serif); font-weight: 400; }
.auth-qr-card p { margin: 0 0 24px; font-size: 13.5px; color: var(--auth-text-secondary); line-height: 1.6; }

.auth-guest-btn {
  width: 100%; padding: 12px 16px; background: transparent;
  border: 1px solid var(--auth-border-dark); border-radius: 6px;
  color: var(--auth-text-primary); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s ease;
  position: relative;
}
.auth-guest-btn:hover { background: var(--auth-bg-paper); border-color: var(--auth-text-primary); }
.auth-guest-btn:disabled { opacity: 0.9; cursor: not-allowed; }

/* --- 🌟 表单 & 悬浮标签 (Floating Labels) --- */
.auth-form { display: grid; gap: 20px; padding-top: 10px; }

.field-hint {
  margin-top: -10px;
  color: var(--auth-text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}

.auth-field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.auth-field input {
  width: 100%;
  padding: 24px 14px 10px 14px; /* 留出顶部供悬浮文字栖息 */
  background: var(--auth-bg-panel);
  border: 1px solid var(--auth-border-dark);
  border-radius: 6px;
  color: var(--auth-text-primary);
  font-size: 14.5px;
  font-family: var(--auth-font-sans);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.auth-floating-label {
  position: absolute;
  top: 18px;
  left: 15px;
  font-size: 14.5px;
  color: var(--auth-text-secondary);
  pointer-events: none;
  transform-origin: left top;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s ease;
}

/* 核心灵魂：当 focus 或 内部有值不为空格 时悬浮 */
.auth-field input:focus ~ .auth-floating-label,
.auth-field input:not(:placeholder-shown) ~ .auth-floating-label {
  transform: translateY(-10px) scale(0.72);
  color: var(--auth-text-primary);
  font-weight: 500;
}

.auth-field input:focus {
  border-color: var(--auth-text-primary);
  box-shadow: 0 0 0 1px var(--auth-text-primary);
}

.auth-field input.error {
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 1px var(--auth-accent);
}

/* --- 🌟 错误轻微抖动 (Error Shake) --- */
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.auth-field input.shake {
  animation: shakeError 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

.field-error { display: none; color: var(--auth-accent); font-size: 12px; margin-top: 4px; }
.field-error.show { display: block; animation: fadeInUp 0.3s ease; }

/* 主干按钮 */
.auth-submit {
  width: 100%; padding: 14px;
  border: 1px solid var(--auth-text-primary); border-radius: 6px;
  background: var(--auth-text-primary); color: #FFFFFF;
  font-size: 14.5px; font-weight: 500; cursor: pointer;
  transition: all 0.2s ease; position: relative;
  margin-top: 8px;
}
.auth-submit:hover { background: #111111; border-color: #111111; box-shadow: 0 4px 12px rgba(44,40,37, 0.15); }
.auth-submit:disabled { background: var(--auth-text-secondary); border-color: var(--auth-text-secondary); opacity: 0.9; cursor: not-allowed; box-shadow: none; }

.btn-text { transition: opacity 0.2s; }

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.auth-admin-note {
  margin-top: 24px; padding-top: 20px; border-top: 1px dashed rgba(200, 195, 185, 0.6);
}
.auth-admin-note strong { display: block; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--auth-text-secondary); margin-bottom: 6px; }
.auth-admin-note p { margin: 0; font-size: 12.5px; color: var(--auth-text-tertiary); line-height: 1.6; }

.auth-footer {
  margin-top: 40px; text-align: center; font-size: 12px; color: var(--auth-text-tertiary);
  font-family: var(--auth-font-serif); font-style: italic; animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-toast {
  position: fixed; top: 32px; left: 50%; transform: translateX(-50%) translateY(-10px); opacity: 0;
  padding: 12px 20px; background: var(--auth-bg-panel); border: 1px solid var(--auth-border-dark);
  color: var(--auth-text-primary); font-size: 13.5px; font-weight: 500; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(44, 40, 37, 0.08); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 9999;
  display: flex; align-items: center; gap: 8px;
}
.auth-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.auth-toast::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.auth-toast.success::before { background: #507A55; box-shadow: 0 0 0 2px rgba(80, 122, 85, 0.2); }
.auth-toast.error::before { background: var(--auth-accent); box-shadow: 0 0 0 2px rgba(218, 117, 91, 0.2); }

/* --- 🌟 移动端无界沉浸融合 (Borderless Mobile) --- */
@media (max-width: 640px) {
  .auth-grid {
    padding: 0;
  }
  .auth-panel {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 32px 24px;
  }
}
