/**
 * 全局样式
 * 包含CSS变量、全局重置样式和工具类
 */

/* ===================== CSS变量 ===================== */
:root {
  /* 主色调 */
  --color-primary: #0071e3;
  --color-primary-hover: #0077ed;
  --color-accent: #0af;
  --color-accent-hover: #6de0ff;

  /* 背景色 */
  --color-bg-dark: #0a0a0a;
  --color-bg-light: #f5f7fa;
  --color-bg-card: rgba(255, 255, 255, 0.08);
  --color-bg-card-hover: rgba(255, 255, 255, 0.12);

  /* 文字颜色 */
  --color-text: #333;
  --color-text-light: #6c757d;
  --color-text-muted: #ccc;
  --color-text-white: #f5f5f7;

  /* 边框颜色 */
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-light: rgba(255, 255, 255, 0.3);

  /* 阴影 */
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);

  /* 毛玻璃效果 */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-bg-dark: rgba(0, 0, 0, 0.85);
  --glass-blur: blur(20px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.4);

  /* 动画 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-smooth: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  /* 字体 */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-sm: 0.8rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.1rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 2.8rem;
}

/* ===================== 全局重置 ===================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 字体加载优化：确保文字始终可见 */
@font-face {
  font-family: 'Font Awesome 6 Free';
  font-display: swap;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-normal);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* ===================== 工具类 ===================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.grid { display: grid; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.z-0 { z-index: 0; }
.z-1 { z-index: 1; }
.z-10 { z-index: 10; }
.z-100 { z-index: 100; }
.z-1000 { z-index: 1000; }

/* 间距 */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }

.p-0 { padding: 0; }

/* ===================== 动画工具类 ===================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

.animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
.animate-fadeInUp { animation: fadeInUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards; }
.animate-fadeInLeft { animation: fadeInLeft 0.6s ease forwards; }
.animate-fadeInRight { animation: fadeInRight 0.6s ease forwards; }
.animate-scaleIn { animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* ===================== 响应式工具类 ===================== */
@media (max-width: 767.98px) {
  .mobile-hidden { display: none !important; }
}

@media (min-width: 768px) {
  .desktop-hidden { display: none !important; }
}

/* ===================== 毛玻璃效果 ===================== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
}

.glass-dark {
  background: var(--glass-bg-dark);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* ===================== 按钮基类 ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-size-base);
  transition: var(--transition-smooth);
  cursor: pointer;
  border: none;
  outline: none;
}

.btn:hover {
  transform: translateY(-2px);
}

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

.btn-primary {
  background: linear-gradient(90deg, #0ea5e9, #0284c7);
  color: white;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 10px 25px rgba(2, 132, 199, 0.6);
}

.btn-accent {
  background: linear-gradient(90deg, #ff5f00, #ffbc00);
  color: white;
  box-shadow: 0 8px 24px rgba(255, 188, 0, 0.4);
}

.btn-accent:hover {
  box-shadow: 0 12px 36px rgba(255, 188, 0, 0.6);
}

/* ===================== 卡片基类 ===================== */
.card {
  background: var(--color-bg-card);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  transition: var(--transition-smooth);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  background: var(--color-bg-card-hover);
}

/* ===================== 渐变文字 ===================== */
.gradient-text {
  background: linear-gradient(to right, #ffffff, #a0a0a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-accent {
  background: linear-gradient(90deg, #60a5fa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===================== 滚动条美化 ===================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* ===================== 选择器美化 ===================== */
::selection {
  background: rgba(0, 113, 227, 0.3);
  color: inherit;
}

/* ===================== 视觉隐藏（保留可访问性）==================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
