/**
 * 浙江新峰数字教材研究院官网主题 - 组件样式
 * 
 * 包含各组件的额外样式和动画效果
 * 
 * @package Xinfeng_Digital_Textbook
 * @since 1.0.0
 */

/* ========================================
   按钮动画效果
   ======================================== */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary::before {
  background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   卡片悬停效果增强
   ======================================== */
.feature-card,
.solution-card,
.case-card,
.news-item {
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card::after,
.solution-card::after,
.case-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(22, 93, 255, 0.05) 0%, rgba(54, 207, 201, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.feature-card:hover::after,
.solution-card:hover::after,
.case-card:hover::after {
  opacity: 1;
}

/* ========================================
   渐入动画
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease forwards;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease forwards;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease forwards;
}

/* ========================================
   加载动画
   ======================================== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ========================================
   图标旋转动画
   ======================================== */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spin 2s linear infinite;
}

/* ========================================
    bounce 动画
   ======================================== */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.bounce {
  animation: bounce 2s ease infinite;
}

/* ========================================
   浮动动画
   ======================================== */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.float {
  animation: float 3s ease-in-out infinite;
}

/* ========================================
   缩放动画
   ======================================== */
@keyframes scaleUp {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.scale-up {
  animation: scaleUp 0.5s ease forwards;
}

/* ========================================
   滑动入场动画
   ======================================== */
.slide-in-left {
  animation: slideInLeft 0.6s ease forwards;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.slide-in-right {
  animation: slideInRight 0.6s ease forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========================================
   导航下拉动画优化
   ======================================== */
.main-navigation .sub-menu {
  animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 二级菜单项动画 - 错落入场 */
.main-navigation .sub-menu li {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

.main-navigation .sub-menu li:nth-child(1) {
  animation-delay: 0.05s;
}

.main-navigation .sub-menu li:nth-child(2) {
  animation-delay: 0.1s;
}

.main-navigation .sub-menu li:nth-child(3) {
  animation-delay: 0.15s;
}

.main-navigation .sub-menu li:nth-child(4) {
  animation-delay: 0.2s;
}

.main-navigation .sub-menu li:nth-child(5) {
  animation-delay: 0.25s;
}

.main-navigation .sub-menu li:nth-child(6) {
  animation-delay: 0.3s;
}

/* ========================================
   Banner 背景动画
   ======================================== */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.hero-banner {
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
}

/* ========================================
   数字滚动效果
   ======================================== */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.count-animation {
  animation: countUp 1s ease forwards;
}

/* ========================================
   骨架屏加载
   ======================================== */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* ========================================
   提示框动画
   ======================================== */
@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert {
  animation: slideInFromTop 0.3s ease forwards;
}

/* ========================================
   表单焦点动画
   ======================================== */
.auth-form input:focus {
  animation: inputFocus 0.3s ease forwards;
}

@keyframes inputFocus {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 93, 255, 0.4);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(22, 93, 255, 0.1);
  }
}

/* ========================================
   进度条动画
   ======================================== */
@keyframes progress {
  from {
    width: 0;
  }
}

.progress-bar {
  animation: progress 2s ease forwards;
}

/* ========================================
   徽章动画
   ======================================== */
@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.badge {
  animation: badgePulse 2s ease-in-out infinite;
}

/* ========================================
   图片加载效果
   ======================================== */
img {
  transition: opacity 0.3s ease;
}

img:not([src]) {
  opacity: 0;
}

/* ========================================
   主题加载完成标记
   ======================================== */
body.theme-loaded {
  opacity: 1;
}

body {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ========================================
   回到顶部按钮动画
   ======================================== */
.back-to-top {
  animation: fadeIn 0.3s ease forwards;
}

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

.back-to-top:hover {
  animation: bounce 0.6s ease;
}

/* ========================================
   链接下划线动画
   ======================================== */
a {
  position: relative;
  text-decoration: none;
}

a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}

a:hover::after {
  width: 100%;
}

/* ========================================
   卡片堆叠效果
   ======================================== */
.card-stack {
  perspective: 1000px;
}

.card-stack .card {
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-stack .card:hover {
  transform: rotateX(5deg) rotateY(5deg);
}

/* ========================================
   文字渐变动画
   ======================================== */
@keyframes textGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.text-gradient {
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textGradient 3s linear infinite;
}

/* ========================================
   阴影层次效果
   ======================================== */
.shadow-soft {
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

.shadow-medium {
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.1);
}

-shadow-strong {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

/* ========================================
   玻璃态效果
   ======================================== */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ========================================
   响应式调整
   ======================================== */
@media (max-width: 768px) {
  .animate-on-scroll {
    animation: none !important;
  }
  
  .feature-card:hover,
  .solution-card:hover,
  .case-card:hover {
    transform: none !important;
  }
}
