/* 
 * 2FA 验证器毛玻璃样式表
 * 所有的注释必须使用中文 
 */

/* 引入 Google 字体 Inter 与 Outfit 以展现现代感 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  /* 主背景渐变色：极深靛蓝 */
  --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #111827 50%, #1e1b4b 100%);
  
  /* 毛玻璃卡片背景与边框（半透明白色） */
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --card-border-focus: rgba(255, 255, 255, 0.25);
  
  /* 炫彩光球颜色 */
  --glow-color-1: rgba(0, 242, 254, 0.45);
  --glow-color-2: rgba(112, 0, 255, 0.45);
  
  /* 文字颜色 */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* 交互与高亮色 */
  --accent-color: #00f2fe;
  --accent-hover: #38bdf8;
  --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --success-color: #10b981;
  --error-color: #ef4444;
  
  /* 阴影效果 */
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 15px rgba(0, 242, 254, 0.3);
  
  /* 交互过渡时长与曲线 */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-family);
}

/* 基础重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: #0b0f19;
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* 背景炫彩呼吸浮动光球 */
.glow-ball {
  position: fixed;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  z-index: -1;
  /* 使用高模糊实现霓虹渐变背景 */
  filter: blur(90px);
  opacity: 0.8;
  pointer-events: none;
}

.glow-ball-1 {
  background: radial-gradient(circle, var(--glow-color-1) 0%, rgba(0, 242, 254, 0) 70%);
  top: 10%;
  left: 15%;
  animation: float-ball-1 12s infinite alternate ease-in-out;
}

.glow-ball-2 {
  background: radial-gradient(circle, var(--glow-color-2) 0%, rgba(112, 0, 255, 0) 70%);
  bottom: 15%;
  right: 15%;
  animation: float-ball-2 15s infinite alternate ease-in-out;
}

/* 呼吸动画定义 */
@keyframes float-ball-1 {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(40px, 30px) scale(1.1);
  }
  100% {
    transform: translate(-20px, 50px) scale(0.95);
  }
}

@keyframes float-ball-2 {
  0% {
    transform: translate(0, 0) scale(0.95);
  }
  50% {
    transform: translate(-30px, -40px) scale(1.15);
  }
  100% {
    transform: translate(30px, 20px) scale(1);
  }
}

/* 主容器 */
.app-container {
  width: 100%;
  max-width: 440px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 1;
}

/* 标题区 */
.app-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.app-header .logo {
  font-size: 44px;
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.4));
  animation: logo-bounce 2s infinite ease-in-out;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes logo-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 验证码卡片（核心毛玻璃应用） */
.otp-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  padding: 30px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.otp-card:hover {
  border-color: var(--card-border-focus);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

/* 拖拽/上传提示占位块 */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 24px 16px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.drop-zone:hover {
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.02);
}

.drop-icon {
  font-size: 32px;
  opacity: 0.8;
  transition: var(--transition);
}

.drop-zone:hover .drop-icon {
  transform: translateY(-4px);
  opacity: 1;
}

.drop-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 验证码展示框 */
.otp-display-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 16px;
  animation: fade-in 0.4s ease-out;
}

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

.issuer-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#otp-issuer {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

#otp-label {
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-all;
  max-width: 280px;
}

/* 验证码与复制按钮包裹区 */
.code-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 320px;
}

.otp-code {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-color);
  text-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
  user-select: all;
  flex-grow: 1;
  text-align: center;
}

/* 复制按钮样式 */
.copy-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-secondary);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.copy-btn:active {
  transform: scale(0.9);
}

.copy-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 环形倒计时区域 */
.timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 40px;
  height: 40px;
}

.timer-ring {
  transform: rotate(-90deg); /* 旋转90度使得进度从顶部开始正方向衰减 */
}

.timer-ring-circle {
  stroke-dasharray: 100.5; /* 周长: 2 * PI * 16 ≈ 100.53 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke var(--transition);
}

.timer-text {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-secondary);
}

/* 控制按钮与输入区域 */
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 输入框 */
.input-group {
  position: relative;
  width: 100%;
}

.input-group input {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  font-family: var(--font-family);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.input-group input:focus {
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-glow);
}

/* 操作按钮组 */
.actions-group {
  display: flex;
  gap: 12px;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.action-btn:active {
  transform: translateY(0) scale(0.98);
}

.label-btn {
  cursor: pointer;
}

.btn-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* 隐藏真实的文件输入控件 */
.hidden-file-input {
  display: none;
}

/* 原生扫码 dialog 样式 */
.scan-dialog {
  border: 1px solid var(--card-border-focus);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  padding: 24px;
  color: var(--text-primary);
  max-width: 90%;
  width: 440px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  margin: auto; /* 居中显示关键样式 */
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

/* 当弹窗打开时 */
.scan-dialog[open] {
  opacity: 1;
  transform: scale(1);
}

/* 弹窗遮罩背景样式 */
.scan-dialog::backdrop {
  background: rgba(11, 15, 25, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

.scan-dialog[open]::backdrop {
  opacity: 1;
}

/* 弹窗内容 */
.dialog-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.dialog-content h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  text-align: center;
}

/* 摄像头取景框容器 */
.scanner-viewport {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

/* 扫码关闭按钮 */
.close-btn {
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  color: #0b0f19;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 24px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-glow);
}

.close-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

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

/* 状态公用工具类：隐藏 */
.hidden {
  display: none !important;
}

/* ==========================================================================
   响应式媒体查询：移动端适配
   ========================================================================== */
@media (max-width: 600px) {
  .app-container {
    padding: 16px;
    gap: 16px;
  }
  
  .app-header .logo {
    font-size: 36px;
  }
  
  .app-header h1 {
    font-size: 22px;
  }
  
  .otp-card {
    padding: 20px;
    min-height: 180px;
    border-radius: 20px;
  }
  
  .otp-code {
    font-size: 28px; /* 减小字号，避免在小屏手机上折行 */
    letter-spacing: 1px;
  }
  
  .code-wrapper {
    padding: 10px 14px;
    border-radius: 12px;
  }
  
  .actions-group {
    flex-direction: column; /* 手机上按钮垂直排列，增大操作面积 */
    gap: 10px;
  }
  
  .action-btn {
    width: 100%;
    min-height: 52px; /* 提高移动端点击精度，略微增加高度 */
    font-size: 15px;
  }
  
  .input-group input {
    padding: 16px; /* 提高移动端可输入性，略微增加高度 */
    font-size: 16px; /* 防止 iOS 浏览器由于输入框字号小于 16px 自动缩放页面 */
  }

  .scan-dialog {
    padding: 16px;
    width: 95%;
    border-radius: 20px;
  }
}

/* ==========================================================================
   炫彩 Toast 提示框
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--accent-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-glow);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   全局加载状态遮罩
   ========================================================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  display: none !important;
  opacity: 0;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

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

#loading-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

/* ==========================================================================
   自定义消息提示/警示弹窗
   ========================================================================== */
.message-dialog {
  border: 1px solid var(--card-border-focus);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  padding: 24px;
  color: var(--text-primary);
  max-width: 90%;
  width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  margin: auto;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s ease, transform 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

.message-dialog[open] {
  opacity: 1;
  transform: scale(1);
}

.message-dialog::backdrop {
  background: rgba(11, 15, 25, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

.message-dialog[open]::backdrop {
  opacity: 1;
}

.message-content h3 {
  color: #ff3366;
}

.message-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: center;
  margin-top: 4px;
}

.message-ok-btn {
  margin-top: 8px;
  min-width: 100px;
}

/* ==========================================================================
   快捷验证链接区域
   ========================================================================== */
.share-link-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
  animation: fade-in 0.4s ease-out;
}

.share-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  font-weight: 600;
  align-self: flex-start;
}

.share-wrapper {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 6px 12px;
  width: 100%;
  gap: 8px;
}

#share-link-input {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-family);
  outline: none;
  flex-grow: 1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  cursor: default;
}

