/**
 * 爱平小世界 - 动画效果
 * 浮动动画、过渡效果
 * 需求: 4.3, 4.4
 */

/* ========== 关键帧动画 ========== */

/* 渐变背景动画 */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 浮动动画 */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* 轻微浮动 */
@keyframes floatSoft {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* 脉冲动画 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* 心跳动画 */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        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);
    }
}

/* 缩放淡入 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 旋转动画 */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 摇摆动画 */
@keyframes swing {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(5deg);
    }
    75% {
        transform: rotate(-5deg);
    }
}

/* 闪烁动画 */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 波纹动画 */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* 弹跳动画 */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* 气泡上升动画 */
@keyframes bubbleRise {
    0% {
        transform: translateY(100%) scale(0.5);
        opacity: 0;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* ========== 动画类 ========== */

/* 渐变背景动画 */
.animate-gradient {
    animation: gradientShift 15s ease infinite;
}

/* 浮动效果 */
.animate-float {
    animation: float 4s ease-in-out infinite;
}

.animate-float-soft {
    animation: floatSoft 3s ease-in-out infinite;
}

.animate-float-delay-1 {
    animation: float 4s ease-in-out infinite;
    animation-delay: 0.5s;
}

.animate-float-delay-2 {
    animation: float 4s ease-in-out infinite;
    animation-delay: 1s;
}

.animate-float-delay-3 {
    animation: float 4s ease-in-out infinite;
    animation-delay: 1.5s;
}

/* 脉冲效果 */
.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* 心跳效果 */
.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

/* 淡入效果 */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

/* 缩放淡入 */
.animate-scale-in {
    animation: scaleIn 0.4s ease-out forwards;
}

/* 旋转效果 */
.animate-rotate {
    animation: rotate 2s linear infinite;
}

/* 摇摆效果 */
.animate-swing {
    animation: swing 2s ease-in-out infinite;
}

/* 弹跳效果 */
.animate-bounce {
    animation: bounce 2s ease infinite;
}

/* 延迟类 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ========== 3D翻转卡片 ========== */
.flip-card {
    perspective: 1000px;
    width: 100%;
    height: 300px;
    /* 隐藏溢出内容，防止边框露出 */
    overflow: hidden;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner,
.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-md);
    overflow: hidden;
    /* 移除边框，防止边框露出 */
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.flip-card-front {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* 覆盖 glass-card 的边框样式 */
.flip-card-front.glass-card {
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.flip-card-back {
    background: linear-gradient(135deg, 
        rgba(126, 184, 218, 0.9) 0%, 
        rgba(152, 216, 200, 0.9) 50%, 
        rgba(255, 182, 193, 0.9) 100%);
    transform: rotateY(180deg);
    color: white;
}

/* ========== 过渡效果 ========== */

/* 基础过渡 */
.transition-all {
    transition: all 0.3s ease;
}

.transition-fast {
    transition: all 0.15s ease;
}

.transition-slow {
    transition: all 0.5s ease;
}

/* 特定属性过渡 */
.transition-transform {
    transition: transform 0.3s ease;
}

.transition-opacity {
    transition: opacity 0.3s ease;
}

.transition-colors {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.transition-shadow {
    transition: box-shadow 0.3s ease;
}

/* ========== 悬停效果 ========== */

/* 上浮效果 */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* 放大效果 */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* 发光效果 */
.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(126, 184, 218, 0.5);
}

/* 边框高亮 */
.hover-border {
    transition: border-color 0.3s ease;
    border: 2px solid transparent;
}

.hover-border:hover {
    border-color: var(--color-light-blue);
}

/* ========== 加载动画 ========== */

/* 加载旋转 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(126, 184, 218, 0.2);
    border-top-color: var(--color-light-blue);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* 加载点 */
.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--color-light-blue);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* 骨架屏闪烁 */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(126, 184, 218, 0.1) 25%,
        rgba(126, 184, 218, 0.2) 50%,
        rgba(126, 184, 218, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ========== 页面过渡 ========== */

/* 页面进入动画 */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* 页面离开动画 */
.page-leave {
    opacity: 1;
    transform: translateY(0);
}

.page-leave-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ========== 装饰性动画元素 ========== */

/* 浮动气泡 */
.floating-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}

.bubble {
    position: absolute;
    bottom: -100px;
    border-radius: 50%;
    opacity: 0.6;
    animation: bubbleRise 8s ease-in infinite;
}

.bubble:nth-child(1) {
    left: 10%;
    width: 40px;
    height: 40px;
    background: rgba(126, 184, 218, 0.3);
    animation-duration: 8s;
}

.bubble:nth-child(2) {
    left: 30%;
    width: 20px;
    height: 20px;
    background: rgba(152, 216, 200, 0.3);
    animation-duration: 10s;
    animation-delay: 2s;
}

.bubble:nth-child(3) {
    left: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255, 182, 193, 0.3);
    animation-duration: 12s;
    animation-delay: 4s;
}

.bubble:nth-child(4) {
    left: 70%;
    width: 30px;
    height: 30px;
    background: rgba(126, 184, 218, 0.3);
    animation-duration: 9s;
    animation-delay: 1s;
}

.bubble:nth-child(5) {
    left: 90%;
    width: 25px;
    height: 25px;
    background: rgba(152, 216, 200, 0.3);
    animation-duration: 11s;
    animation-delay: 3s;
}

/* ========== 按钮点击波纹效果 ========== */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* ========== 滚动触发动画 ========== */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== 禁用动画（无障碍） ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
