/* =========================================================
   雨后初晴 - Components Layer
   按钮 / 输入框 / 卡片 / Modal / Toast / Tag / 导航栏 / Footer
   ========================================================= */

/* ============ 导航栏 ============ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.6);
  z-index: 100;
  transition: box-shadow .2s;
}
.navbar.scrolled { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06); }

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.navbar-logo .logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--color-primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.navbar-links a {
  position: relative;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: color .25s, background .25s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.navbar-links a:hover {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}
.navbar-links a.active {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}
/* hover / active 底部指示条（从中心向两边展开） */
.navbar-links a .link-underline {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--color-primary);
  transform: translateX(-50%);
  transition: width .35s cubic-bezier(.22,.9,.32,1);
}
.navbar-links a:hover .link-underline,
.navbar-links a.active .link-underline { width: 20px; }

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ============ 导航栏 CTA（授权码获取） ============ */
/* 精致 outline 风格：主色描边 + 内部极轻渐变 + hover 填充，和导航栏融为一体 */
.navbar-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  /* 内部极轻主色渐变底（只有仔细看才发现，避免"贴片感"） */
  background:
    linear-gradient(135deg,
      rgba(79,124,255,0.08) 0%,
      rgba(107,147,255,0.03) 100%);
  border: 1px solid rgba(79,124,255,0.35);
  cursor: pointer;
  transition: color .25s,
              border-color .3s,
              box-shadow .3s,
              transform .15s;
  /* 呼吸动画：缩放 + 边框 + 底色 + 外发光 全维度 */
  animation: cta-breathe 3.5s ease-in-out infinite;
  transform-origin: center center;
  overflow: hidden;
}
/* hover 时暂停呼吸（避免和 hover transform 冲突） */
.navbar-cta:hover {
  animation-play-state: paused;
  color: white;
  border-color: var(--color-primary);
  background: linear-gradient(135deg, #4F7CFF, #6B93FF);
  box-shadow: 0 4px 14px rgba(79,124,255,0.35);
}
.navbar-cta:active { transform: scale(0.97); }

/* 去掉旧的红色角标——不再需要 */

/* 按钮内部：细微的光斑扫过（hover 时触发） */
.navbar-cta::before {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255,255,255,0.5),
    transparent);
  transform: skewX(-20deg);
  opacity: 0;
  pointer-events: none;
  transition: left .6s, opacity .3s;
}
.navbar-cta:hover::before {
  opacity: 1;
  left: 130%;
}

/* 4 维度呼吸动画：整体缩放 + 底色透明度 + 边框浓度 + 外发光扩散 */
@keyframes cta-breathe {
  0%, 100% {
    transform: scale(1);
    border-color: rgba(79,124,255,0.35);
    background: linear-gradient(135deg, rgba(79,124,255,0.08) 0%, rgba(107,147,255,0.03) 100%);
    box-shadow: 0 0 0 0 rgba(79,124,255,0);
  }
  50% {
    transform: scale(1.015);
    border-color: rgba(79,124,255,0.65);
    background: linear-gradient(135deg, rgba(79,124,255,0.16) 0%, rgba(107,147,255,0.06) 100%);
    box-shadow: 0 0 0 6px rgba(79,124,255,0.08);
  }
}

/* 滚动后导航栏玻璃态时，呼吸更慢更淡 */
.navbar.scrolled .navbar-cta {
  background: rgba(79,124,255,0.06);
  animation-duration: 5s;
}
.navbar.scrolled .navbar-cta:hover {
  animation-play-state: paused;
}

.navbar-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.navbar-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}

/* ============ 汉堡菜单抽屉 ============ */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: white;
  z-index: 200;
  transform: translateX(100%);
  transition: transform .3s var(--ease-out);
  padding: 80px 24px 24px;
  box-shadow: var(--shadow-modal);
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer a {
  display: block;
  padding: 16px 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
}
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.mobile-drawer-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-btn);
  transition: transform .08s, box-shadow .2s, background .2s, opacity .2s;
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: 0 6px 20px rgba(79,124,255,0.35); }

.btn-secondary {
  background: white;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-secondary:hover { background: var(--color-primary-soft); }

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}
.btn-ghost:hover { background: var(--color-primary-soft); }

.btn-lg { height: 52px; padding: 0 32px; font-size: 17px; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-xs { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-btn-sm); }

.btn-block { width: 100%; display: flex; }

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-secondary .btn-spinner { border-color: rgba(79,124,255,0.3); border-top-color: var(--color-primary); }

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

/* ============ Tag / Chip ============ */
.card-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-tag);
  background: var(--border-light);
  color: var(--text-secondary);
}

/* 筛选 Chip */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-chip);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-secondary);
  transition: all .2s;
}
.filter-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-chip.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ============ 机器码输入框 ============ */
.machine-code-wrap {
  margin-top: 24px;
}
.machine-code-input {
  width: 100%;
  height: 64px;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 2px;
  border: 2px solid var(--border);
  border-radius: var(--radius-input);
  background: white;
  color: var(--text-primary);
  text-transform: uppercase;
  transition: border-color .2s, box-shadow .2s;
}
.machine-code-input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}
.machine-code-input.success {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(82,196,26,0.2);
}
.machine-code-input.error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(255,77,79,0.2);
}
.machine-code-input:disabled {
  background: var(--border-light);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.machine-code-hint {
  margin-top: 10px;
  font-size: 13px;
  min-height: 20px;
}
.machine-code-hint.success { color: var(--color-success); }
.machine-code-hint.error { color: var(--color-danger); }
.machine-code-hint.info { color: var(--text-tertiary); }

/* ============ 卡片面板 ============ */
.card-panel {
  background: white;
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-card);
}
.card-panel + .card-panel { margin-top: 20px; }

/* ============ 骨架屏 ============ */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  height: 18px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-wrap {
  padding: 16px;
  background: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-top: 20px;
}
.skeleton-line {
  margin-bottom: 12px;
}
.skeleton-line:last-child { margin-bottom: 0; width: 60%; }

/* ============ Modal 弹窗 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  animation: modal-bg-in 0.2s var(--ease-out) forwards;
}
@keyframes modal-bg-in { to { opacity: 1; } }
.modal {
  background: white;
  border-radius: var(--radius-modal);
  padding: 32px;
  width: 90%;
  max-width: 460px;
  box-shadow: var(--shadow-modal);
  transform: scale(0.95);
  animation: modal-in 0.2s var(--ease-out) forwards;
  position: relative;
}
@keyframes modal-in { to { transform: scale(1); } }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
  transition: background .2s, color .2s;
}
.modal-close:hover { background: var(--border-light); color: var(--text-primary); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: white;
  border-radius: 12px;
  padding: 12px 20px;
  box-shadow: var(--shadow-toast);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  max-width: 90vw;
}
.toast-success { background: var(--color-success); color: white; }
.toast-error { background: var(--color-danger); color: white; }
.toast-info { background: var(--color-primary); color: white; }
.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-hide { opacity: 0; transform: translateX(-50%) translateY(-10px); }

/* ============ 页脚 ============ */
.footer {
  margin-top: 80px;
  padding: 28px 0;
  border-top: 1px solid #e6ecf4;
  background: #fafbfd;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  color: var(--text-tertiary);
}
.footer-copyright {
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}
.footer-links {
  display: flex;
  gap: 24px;
}
.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  padding-bottom: 2px;
  transition: color .2s;
}
.footer-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1.5px;
  background: var(--color-primary);
  transform: scaleX(0);
  transition: transform .25s cubic-bezier(.22,.9,.32,1);
  transform-origin: center;
}
.footer-links a:hover { color: var(--color-primary); }
.footer-links a:hover::after { transform: scaleX(1); }
.footer-icp {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
}
