/* ============================================================
   common.css — 用户端公共样式
   配色：暗黑底 #1a1a2e / #333 + 琥珀金 #fbb000
   风格：炫酷暗黑 + 微交互动画
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
  /* 主色 / 辅色 */
  --color-primary: #fbb000;
  --color-primary-dark: #e09e00;
  --color-primary-light: #ffc833;
  --color-primary-soft: rgba(251, 176, 0, 0.12);
  --color-accent: #7c3aed;
  --color-accent-dark: #6d28d9;

  /* 暗黑中性色 */
  --color-bg: #0f0f1a;
  --color-surface: #1a1a2e;
  --color-surface-alt: #232340;
  --color-text: #e8e8f0;
  --color-text-secondary: #a0a0c0;
  --color-text-muted: #6b6b8a;
  --color-border: #2d2d4a;
  --color-border-strong: #3d3d5c;

  /* 状态色 */
  --color-success: #34d399;
  --color-danger: #f87171;

  /* 排版 */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  --font-size-base: 15px;
  --font-size-sm: 13px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;

  /* 间距 / 圆角 / 阴影 */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --header-height: 64px;
  --transition: 0.25s ease;
}

/* ---------- CSS Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-stack);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

h1 { font-size: var(--font-size-xl); }
h2 { font-size: var(--font-size-lg); }

p { margin: 0 0 1em; }

ul, ol { list-style: none; }

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition), text-shadow var(--transition);
}

a:hover {
  color: var(--color-primary-light);
  text-shadow: 0 0 8px rgba(251, 176, 0, 0.3);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* ---------- 入场动画 ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(251, 176, 0, 0.2); }
  50% { box-shadow: 0 0 20px rgba(251, 176, 0, 0.4); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- 通用容器 ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 主体区域 ---------- */
.site-main {
  min-height: calc(100vh - var(--header-height) - 200px);
  padding: 28px 0 48px;
  animation: fadeIn 0.5s ease;
}

/* ============================================================
   顶部导航
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(26, 26, 46, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.4s ease;
}

.site-header__inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 24px;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--font-size-lg);
  flex-shrink: 0;
  transition: filter var(--transition);
}

.site-logo:hover {
  color: var(--color-primary);
  filter: drop-shadow(0 0 6px rgba(251, 176, 0, 0.4));
}

.site-logo__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #1a1a2e;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 0 12px rgba(251, 176, 0, 0.3);
}

.site-logo__text { white-space: nowrap; }

/* 导航 */
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.site-nav__link {
  position: relative;
  display: inline-block;
  padding: 8px 16px;
  color: var(--color-text-secondary);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background-color var(--transition), text-shadow var(--transition);
}

.site-nav__link:hover {
  color: var(--color-primary);
  background-color: var(--color-primary-soft);
  text-shadow: 0 0 8px rgba(251, 176, 0, 0.3);
}

.site-nav__link.active {
  color: var(--color-primary);
  background-color: var(--color-primary-soft);
}

.site-nav__link.active::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 2px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--color-primary);
}

/* 极速版按钮 */
.site-nav__lite {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px 18px;
  margin-left: 8px;
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: #1a1a2e;
  background: linear-gradient(135deg, #fbb000 0%, #ff6b35 100%);
  border: none;
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 12px rgba(251, 176, 0, 0.25);
}

.site-nav__lite::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.site-nav__lite:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 0 24px rgba(251, 176, 0, 0.5), 0 0 48px rgba(255, 107, 53, 0.2);
}

.site-nav__lite:hover::before {
  left: 100%;
}

.site-nav__lite:active {
  transform: translateY(0) scale(0.98);
}

/* 汉堡菜单按钮 */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  margin-left: auto;
  border-radius: var(--radius-sm);
  transition: background-color var(--transition);
}

.nav-toggle:hover { background-color: var(--color-surface-alt); }

.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle.is-open .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-open .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 32px 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.site-footer__brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.site-footer__name {
  font-weight: 600;
  color: var(--color-text);
  margin-right: 16px;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
}

.site-footer__links a {
  margin-left: 16px;
  color: var(--color-text-secondary);
  transition: color var(--transition), text-shadow var(--transition);
}

.site-footer__links a:hover {
  color: var(--color-primary);
  text-shadow: 0 0 6px rgba(251, 176, 0, 0.3);
}

.site-footer__friend {
  width: 100%;
  padding-top: 12px;
  border-top: 1px dashed var(--color-border);
  color: var(--color-text-muted);
}

.site-footer__friend a {
  color: var(--color-text-secondary);
  margin: 0 2px;
}

.site-footer__friend a:hover { color: var(--color-primary); }

.site-footer__placeholder { color: var(--color-text-muted); }

/* ============================================================
   通用组件：按钮 / 卡片 / 链接 / 网格
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--color-primary);
  color: #1a1a2e;
  font-weight: 600;
}
.btn--primary:hover {
  background: var(--color-primary-dark);
  color: #1a1a2e;
  box-shadow: 0 0 20px rgba(251, 176, 0, 0.4);
}

.btn--accent {
  background: var(--color-accent);
  color: #fff;
}
.btn--accent:hover {
  background: var(--color-accent-dark);
  color: #fff;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn--outline:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary-light);
  box-shadow: 0 0 12px rgba(251, 176, 0, 0.2);
}

.btn--ghost {
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
}
.btn--ghost:hover {
  background: var(--color-border);
  color: var(--color-text);
}

/* 卡片 */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease, transform 0.3s ease,
    border-color 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

.card--flat { box-shadow: none; }

.card__title {
  margin-bottom: 12px;
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.card__body { color: var(--color-text-secondary); }

/* 网格 */
.grid {
  display: grid;
  gap: 20px;
}

.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* 文本工具 */
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 面包屑 */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.breadcrumb a { color: var(--color-text-secondary); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb__sep { color: var(--color-text-muted); }

/* 空状态 */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--color-text-muted);
  grid-column: 1 / -1;
}

.empty-state__title {
  margin-top: 12px;
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 992px) {
  .grid--4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --font-size-base: 14px;
    --header-height: 56px;
  }

  .container { padding: 0 16px; }

  /* 导航折叠 */
  .nav-toggle { display: flex; }

  .site-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-left: 0;
    padding: 8px 16px 16px;
    background: rgba(26, 26, 46, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
  }

  .site-nav.is-open { transform: translateY(0); }

  .site-nav__link {
    display: block;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
  }

  .site-nav__link.active::after { display: none; }

    /* 网格降列 */
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }

  /* 页脚单列 */
  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer__links { width: 100%; }

  .site-main { padding: 20px 0 36px; }
}

@media (max-width: 480px) {
  .site-logo__text { display: none; }

  .grid--2,
  .grid--3,
  .grid--4 { grid-template-columns: 1fr; }

  .btn { width: 100%; }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
