/* 基础样式重置 - 天机量化系统 V8.0 */
@import url('design-tokens.css');

/* 全局重置 */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 字体设置 */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-color);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}

/* page-content 作为 flex 容器，让 site-footer 的 margin-top: auto 生效 */
#page-content {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

/* 链接样式 */
a {
  color: var(--main-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-color);
}

/* 按钮基础样式 */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

button:focus-visible {
  outline: 2px solid var(--main-color);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 输入框基础样式 */
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--main-color);
  outline-offset: 2px;
}

/* 列表重置 */
ul, ol {
  list-style: none;
}

/* 图片响应式 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 表格重置 */
table {
  border-collapse: collapse;
  width: 100%;
}

/* 页面容器（min-height 由 body flex 布局控制，避免与 footer 冲突） */
.app-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

/* 页面内容区（min-height 由 body flex 布局控制，此处不设固定高度以露出底部 footer） */
.page-content {
  padding: calc(var(--top-bar-height) + var(--safe-top)) 12px calc(var(--bottom-nav-height) + var(--safe-bottom));
}

/* 隐藏滚动条但保留功能 */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* 文字截断 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Flex 工具类 */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-1 {
  flex: 1;
}

/* Grid 工具类 */
.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

/* 间距工具类 */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

/* 文字对齐 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* 文字粗细 */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* 文字大小 */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

/* 圆角工具类 */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* 阴影工具类 */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-card { box-shadow: var(--shadow-card); }

/* 禁用选择 */
.select-none {
  user-select: none;
  -webkit-user-select: none;
}

/* 禁用点击 */
.pointer-events-none {
  pointer-events: none;
}

/* 加载动画 */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* 淡入动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in {
  animation: fadeIn var(--transition-normal);
}

/* 滑入动画 */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-up {
  animation: slideUp var(--transition-normal);
}

/* 脉冲动画 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 闪烁动画 */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.5; }
}

.animate-blink {
  animation: blink 1s infinite;
}

/* ===== 全局底部备案栏 ===== */
/* position:fixed 悬浮于底导上方，永远不被覆盖 */
.site-footer {
  position: fixed;
  bottom: calc(var(--bottom-nav-height, 70px) + env(safe-area-inset-bottom, 0px) + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 750px;
  padding: var(--space-3) var(--space-4) var(--space-4);
  text-align: center;
  background: var(--bg-secondary, #f8f9fa);
  border-top: 1px solid var(--border-color, #e5e7eb);
  z-index: 99;
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-tertiary, #9ca3af);
  max-width: 1200px;
  margin: 0 auto;
}

.site-footer__link {
  color: var(--text-tertiary, #9ca3af);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer__link:hover {
  color: var(--main-color, #2563EB);
  text-decoration: underline;
}

.site-footer__divider {
  color: var(--border-color, #d1d5db);
  user-select: none;
}

.site-footer__pending {
  color: var(--text-tertiary, #9ca3af);
  font-style: italic;
}

.site-footer__copy {
  color: var(--text-tertiary, #9ca3af);
}

/* 确保 app 容器撑满，footer 沉底 */
#app {
  flex: 1;
}

/* 暗色主题适配 */
[data-theme="dark"] .site-footer {
  background: var(--bg-secondary, #1f2937);
  border-top-color: var(--border-color, #374151);
}
