/**
 * 交互动效库 - 优化版 v2.0
 * 特点：单类名使用、无基础样式、便捷移植
 * 零依赖,纯CSS实现,GPU加速
 * 体积: ~6KB (压缩后 ~2KB)
 */

/* ============================================
   通用过渡效果（可应用于任何元素）
   ============================================ */

/* 平滑过渡基类 - 为元素添加基础过渡 */
.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-fast {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-slow {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Hover 动效（单类名实现）
   ============================================ */

/* 提升效果 - 适用于按钮、卡片等 */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.hover-lift:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 缩放效果 */
.hover-scale {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-scale:active {
    transform: scale(0.98);
}

/* 发光效果 */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px 5px rgba(102, 126, 234, 0.4);
}

/* 渐变移动效果（需要元素有渐变背景） */
.hover-gradient {
    background-size: 200% 100%;
    background-position: left;
    transition: background-position 0.5s ease;
}

.hover-gradient:hover {
    background-position: right;
}

/* 波纹效果 */
.hover-ripple {
    position: relative;
    overflow: hidden;
}

.hover-ripple::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;
}

.hover-ripple:hover::before {
    width: 300px;
    height: 300px;
}

/* 边框填充效果 */
.hover-border-fill {
    position: relative;
    overflow: hidden;
}

.hover-border-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: currentColor;
    opacity: 0.1;
    transition: width 0.4s ease;
    z-index: -1;
}

.hover-border-fill:hover::before {
    width: 100%;
}

/* 透明度变化 */
.hover-opacity {
    transition: opacity 0.3s ease;
}

.hover-opacity:hover {
    opacity: 0.8;
}

/* 亮度变化 */
.hover-brightness {
    transition: filter 0.3s ease;
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

/* ============================================
   加载状态
   ============================================ */

.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Tab 标签动效
   ============================================ */

.ani-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    position: relative;
}

.ani-tab-btn {
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    color: #666;
    border: none;
    background: transparent;
    font-size: 16px;
}

.ani-tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.ani-tab-btn.active {
    color: #667eea;
    font-weight: 600;
}

/* Tab 下划线动画 */
.ani-tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #667eea;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
}

.ani-tab-btn.active::after {
    width: 100%;
}

/* Tab 内容切换动画 */
.ani-tab-panel {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.ani-tab-panel.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   手风琴动效
   ============================================ */

.ani-accordion-item {
    /* border: 1px solid #e0e0e0; */
    /* border-radius: 8px; */
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ani-accordion-item:hover {
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
}

.ani-accordion-header {
    /* padding: 16px 20px; */
    cursor: pointer;
    /* background: white; */
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    user-select: none;
}

.ani-accordion-header:hover {
    /* background: #f5f5f5; */
}

.ani-accordion-header.active {
    /* background: #667eea; */
    /* color: white; */
}

.ani-accordion-icon {
    transition: transform 0.3s ease;
    font-size: 20px;
}

.ani-accordion-header.active .ani-accordion-icon {
    transform: rotate(180deg);
}

.ani-accordion-icon-less,  .ani-accordion-icon-more {
    transition: transform 0.3s ease;
    display: inline-block;
    font-size: 20px;
    overflow: hidden;
}
.ani-accordion-icon-less {
    font-size: 24px;
}

.ani-accordion-icon-less,
.ani-accordion-header.active .ani-accordion-icon-more {
    max-width: 0px;
}
 .ani-accordion-icon-more, 
 .ani-accordion-header.active .ani-accordion-icon-less {
    max-width: 30px;
 }


.ani-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    /* background: white; */
}

.ani-accordion-content.active {
    max-height: 500px;
}

.ani-accordion-body {
    padding: 20px;
    animation: fadeInUp 0.4s ease;
}

/* ============================================
   卡片交互动效（单类名）
   ============================================ */

/* 卡片提升 */
.ani-card-lift,
.card-lift { /* 向后兼容 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ani-card-lift:hover,
.card-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* 卡片缩放 */
.ani-card-scale,
.card-scale { /* 向后兼容 */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ani-card-scale:hover,
.card-scale:hover {
    transform: scale(1.03);
}

/* 卡片发光边框 */
.ani-card-glow,
.card-glow { /* 向后兼容 */
    transition: all 0.3s ease;
}

.ani-card-glow:hover,
.card-glow:hover {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* 卡片渐变背景 */
.ani-card-gradient,
.card-gradient { /* 向后兼容 */
    position: relative;
    overflow: hidden;
}

.ani-card-gradient::before,
.card-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ani-card-gradient:hover::before,
.card-gradient:hover::before {
    opacity: 1;
}

/* 卡片翻转效果 */
.ani-card-flip,
.card-flip { /* 向后兼容 */
    perspective: 1000px;
}

.ani-card-flip-inner,
.card-flip-inner { /* 向后兼容 */
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.ani-card-flip:hover .ani-card-flip-inner,
.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.ani-card-flip-front,
.ani-card-flip-back,
.card-flip-front,  /* 向后兼容 */
.card-flip-back {  /* 向后兼容 */
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
}

.ani-card-flip-back,
.card-flip-back {
    transform: rotateY(180deg);
}

/* ============================================
   图片效果（单类名）
   ============================================ */

/* 图片缩放 */
.ani-img-zoom {
    overflow: hidden;
}

.ani-img-zoom img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    width: 100%;
}

.ani-img-zoom:hover img {
    transform: scale(1.1);
}

/* 图片旋转缩放 */
.ani-img-rotate {
    overflow: hidden;
}

.ani-img-rotate img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    width: 100%;
}

.ani-img-rotate:hover img {
    transform: scale(1.1) rotate(3deg);
}

/* 图片遮罩层 */
.ani-img-overlay {
    position: relative;
    overflow: hidden;
}

.ani-img-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.ani-img-overlay:hover::before {
    opacity: 1;
}

.ani-img-overlay-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease 0.1s;
    text-align: center;
}

.ani-img-overlay:hover .ani-img-overlay-content {
    opacity: 1;
}

/* ============================================
   分割线/装饰线动效
   ============================================ */

/* 渐变分割线 */
.ani-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    margin: 40px 0;
}

/* 扩展动画分割线 */
.ani-divider-expand {
    height: 2px;
    background: #667eea;
    width: 0;
    margin: 40px auto;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.ani-divider-expand.aos-animate {
    width: 100%;
}

/* 脉冲分割线 */
.ani-divider-pulse {
    height: 2px;
    background: #667eea;
    margin: 40px 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scaleX(1);
    }
    50% {
        opacity: 1;
        transform: scaleX(1.02);
    }
}

/* 渐变移动分割线 */
.ani-divider-gradient {
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    background-size: 200% 100%;
    animation: gradientMove 3s linear infinite;
    margin: 40px 0;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* 点状分割线 */
.ani-divider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 40px 0;
}

.ani-divider-dots::before,
.ani-divider-dots::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.ani-divider-dots::after {
    animation-delay: 0.5s;
}

@keyframes dotPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

/* ============================================
   内容切换动效
   ============================================ */

/* 淡入淡出 */
.ani-fade {
    transition: opacity 0.3s ease;
}

.ani-fade.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 滑动切换 */
.ani-slide {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.ani-slide.slide-left {
    transform: translateX(-20px);
    opacity: 0;
}

.ani-slide.slide-right {
    transform: translateX(20px);
    opacity: 0;
}

.ani-slide.slide-up {
    transform: translateY(-20px);
    opacity: 0;
}

.ani-slide.slide-down {
    transform: translateY(20px);
    opacity: 0;
}

/* 缩放切换 */
.ani-scale-fade {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.ani-scale-fade.hidden {
    transform: scale(0.9);
    opacity: 0;
}

/* ============================================
   响应式优化
   ============================================ */

@media (max-width: 768px) {
    .ani-tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .ani-accordion-header {
        padding: 12px 16px;
    }
    
    /* 移动端减弱动画效果 */
    .ani-hover-lift:hover {
        transform: translateY(-2px);
    }
    
    .card-lift:hover {
        transform: translateY(-4px);
    }
}

/* ============================================
   无障碍支持
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   工具类
   ============================================ */

/* 禁用动画 */
.no-transition {
    transition: none !important;
}

/* 禁用动画 */
.no-animation {
    animation: none !important;
}

/* 隐藏元素 */

/* 不可见但占位 */
.invisible {
    opacity: 0;
    pointer-events: none;
}