/* ============================================================
   base.css — 基础样式 / Reset / 动画
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ── 滚动条 ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ── 选中颜色 ── */
::selection {
  background: var(--color-primary-dim);
  color: var(--color-primary-light);
}

/* ── 焦点样式 ── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── 禁用状态 ── */
[disabled], .disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── 工具类：显隐 ── */
.hidden  { display: none !important; }
.visible { display: block !important; }

/* ── 文字工具类 ── */
.text-primary   { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted     { color: var(--color-text-muted); }
.text-teal      { color: var(--color-primary-light); }
.text-gold      { color: var(--color-gold); }
.text-green     { color: var(--color-green); }
.text-red       { color: var(--color-red-light); }
.text-purple    { color: var(--color-purple-light); }

.font-display { font-family: var(--font-display); }
.font-bold    { font-weight: 700; }
.font-semibold{ font-weight: 600; }

.text-right  { text-align: right; }
.text-center { text-align: center; }

/* ── 间距工具类 ── */
.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 4px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 12px; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }

/* ── Flex 工具类 ── */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }

/* ── 页面进入动画 ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.animate-fadeUp  { animation: fadeUp  0.3s var(--transition-slow) both; }
.animate-fadeIn  { animation: fadeIn  0.25s ease both; }
.animate-scaleIn { animation: scaleIn 0.25s var(--transition-slow) both; }

/* ── 延迟辅助 ── */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }

/* ── 过渡遮罩 ── */
#page-transition {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--color-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

#page-transition.active {
  opacity: 1;
  pointer-events: all;
}
