/**
 * 主样式文件 - 九鼎泰天
 * 全局样式和工具类
 */

/* ========== UnoCSS Icons 样式 ========== */
.iconify {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
}

/* ========== 全局样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ========== 自定义滚动条 ========== */
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 114, 128, 0.5) transparent;
}

/* Webkit 浏览器 (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.3);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.5);
}

::-webkit-scrollbar-thumb:active {
  background: rgba(107, 114, 128, 0.7);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== 容器 ========== */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* ========== 链接 ========== */
a {
  color: var(--color-primary-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-700);
}

/* ========== 图片 ========== */
img {
  max-width: 100%;
  height: auto;
}

/* ========== 列表 ========== */
ul, ol {
  list-style: none;
}

/* ========== 响应式容器 ========== */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--spacing-md);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--spacing-sm);
  }
}

/* ========== 工具类 ========== */
.text-center {
  text-align: center;
}

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

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

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }
.p-4 { padding: var(--spacing-xl); }

.hidden {
  display: none;
}

.visible {
  visibility: visible;
}

/* ========== 页面加载动画 - 描边 Logo 风格 ========== */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 50%, #ffffff 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  overflow: hidden;
}

.page-loader.loaded {
  opacity: 0;
  visibility: hidden;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* 加载器包装器 */
.loader-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

/* Logo 容器 */
.loader-logo-container {
  position: relative;
  width: 240px;
  height: 240px;
  animation: logoFloat 4s ease-in-out infinite;
}

.loader-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 30px rgba(96, 165, 250, 0.3));
}

/* 外层圆环描边动画 */
.loader-circle-outer {
  stroke-dasharray: 565;
  stroke-dashoffset: 565;
  animation: outerCircleDraw 2s ease forwards, outerCirclePulse 3s ease-in-out infinite 2s;
}

@keyframes outerCircleDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes outerCirclePulse {
  0%, 100% {
    opacity: 0.6;
    filter: drop-shadow(0 0 5px rgba(96, 165, 250, 0.5));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 15px rgba(96, 165, 250, 0.8));
  }
}

/* 旋转虚线环 */
.loader-circle-rotate {
  animation: rotateDash 20s linear infinite;
  transform-origin: center;
}

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

/* 原子轨道描边动画 */
.loader-orbit {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  transform-origin: center;
}

.loader-orbit-1 {
  animation: orbit1Draw 1.5s ease forwards, orbit1Rotate 8s linear infinite 1.5s;
}

.loader-orbit-2 {
  animation: orbit2Draw 1.5s ease forwards 0.3s, orbit2Rotate 8s linear infinite 1.8s;
}

.loader-orbit-3 {
  animation: orbit3Draw 1.5s ease forwards 0.6s, orbit3Rotate 8s linear infinite 2.1s;
}

@keyframes orbit1Draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes orbit2Draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes orbit3Draw {
  to {
    stroke-dashoffset: 0;
  }
}

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

@keyframes orbit2Rotate {
  from {
    transform: rotate(60deg);
  }
  to {
    transform: rotate(420deg);
  }
}

@keyframes orbit3Rotate {
  from {
    transform: rotate(120deg);
  }
  to {
    transform: rotate(480deg);
  }
}

/* 原子核 */
.loader-nucleus {
  animation: nucleusPulse 2s ease-in-out infinite 1.5s;
}

@keyframes nucleusPulse {
  0%, 100% {
    r: 12;
    filter: drop-shadow(0 0 10px rgba(96, 165, 250, 0.6));
  }
  50% {
    r: 14;
    filter: drop-shadow(0 0 20px rgba(96, 165, 250, 1));
  }
}

/* 电子 */
.loader-electron {
  opacity: 0;
}

.loader-electron-1 {
  animation: electron1Appear 0.5s ease forwards 1.5s, electron1Orbit 4s linear infinite 2s;
}

.loader-electron-2 {
  animation: electron2Appear 0.5s ease forwards 1.7s, electron2Orbit 4s linear infinite 2.2s;
}

.loader-electron-3 {
  animation: electron3Appear 0.5s ease forwards 1.9s, electron3Orbit 4s linear infinite 2.4s;
}

@keyframes electron1Appear {
  to {
    opacity: 1;
  }
}

@keyframes electron2Appear {
  to {
    opacity: 1;
  }
}

@keyframes electron3Appear {
  to {
    opacity: 1;
  }
}

/* 电子沿轨道运动 - 使用简化的位置动画 */
@keyframes electron1Orbit {
  0% {
    cx: 100;
    cy: 75;
  }
  25% {
    cx: 145;
    cy: 100;
  }
  50% {
    cx: 100;
    cy: 125;
  }
  75% {
    cx: 55;
    cy: 100;
  }
  100% {
    cx: 100;
    cy: 75;
  }
}

@keyframes electron2Orbit {
  0% {
    cx: 170;
    cy: 100;
  }
  25% {
    cx: 100;
    cy: 125;
  }
  50% {
    cx: 30;
    cy: 100;
  }
  75% {
    cx: 100;
    cy: 75;
  }
  100% {
    cx: 170;
    cy: 100;
  }
}

@keyframes electron3Orbit {
  0% {
    cx: 100;
    cy: 125;
  }
  25% {
    cx: 55;
    cy: 100;
  }
  50% {
    cx: 100;
    cy: 75;
  }
  75% {
    cx: 145;
    cy: 100;
  }
  100% {
    cx: 100;
    cy: 125;
  }
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* 公司名称样式 */
.loader-branding {
  text-align: center;
  animation: brandingFadeIn 1s ease 2s both;
}

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

.loader-title {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: 12px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #1e3a8a 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShimmer 4s linear infinite;
}

.loader-subtitle {
  font-size: 11px;
  letter-spacing: 8px;
  margin: 0;
  color: rgba(30, 58, 138, 0.6);
  text-transform: uppercase;
}

@keyframes textShimmer {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* 进度条样式 */
.loader-progress-wrapper {
  width: 200px;
  text-align: center;
  animation: progressFadeIn 1s ease 2.2s both;
}

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

.loader-progress-bar {
  width: 100%;
  height: 2px;
  background: rgba(30, 58, 138, 0.1);
  border-radius: 2px;
  margin-bottom: 15px;
  overflow: hidden;
  position: relative;
}

.loader-progress-fill {
  height: 100%;
  background: linear-gradient(90deg,
    #60A5FA 0%,
    #34D399 50%,
    #A78BFA 100%);
  background-size: 200% 100%;
  animation: progressFill 2.5s ease-in-out forwards,
             progressShimmer 2s linear infinite;
  border-radius: 2px;
}

@keyframes progressFill {
  0% {
    width: 0%;
  }
  30% {
    width: 45%;
  }
  60% {
    width: 75%;
  }
  100% {
    width: 100%;
  }
}

@keyframes progressShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.loader-status {
  font-size: 13px;
  color: rgba(96, 165, 250, 0.8);
  letter-spacing: 3px;
  margin: 0;
  animation: statusPulse 1.5s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* 加载完成后隐藏 */
body.loaded .page-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .loader-logo-container {
    width: 180px;
    height: 180px;
  }

  .loader-title {
    font-size: 28px;
    letter-spacing: 8px;
  }

  .loader-subtitle {
    font-size: 9px;
    letter-spacing: 6px;
  }

  .loader-progress-wrapper {
    width: 160px;
  }
}

@media (max-width: 480px) {
  .loader-logo-container {
    width: 150px;
    height: 150px;
  }

  .loader-title {
    font-size: 24px;
    letter-spacing: 6px;
  }

  .loader-subtitle {
    font-size: 8px;
    letter-spacing: 4px;
  }

  .loader-progress-wrapper {
    width: 140px;
  }

  .loader-status {
    font-size: 11px;
    letter-spacing: 2px;
  }
}
