/* 流畅动画效果样式 */

/* 全局动画设置 */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 页面过渡动画 */
.page-transition {
    animation: pageSlideIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* 模态框动画 */
.modal {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal.show {
    opacity: 1;
    visibility: visible;
    animation: modalFadeIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal.hide {
    animation: modalFadeOut 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
    to {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
}

/* 模态框内容动画 */
.modal-content {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-content {
    transform: scale(1) translateY(0);
    opacity: 1;
    animation: modalContentSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalContentSlideUp {
    0% {
        transform: scale(0.8) translateY(40px);
        opacity: 0;
    }
    50% {
        transform: scale(1.02) translateY(-5px);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* 按钮交互动画 */
.btn,
.buy-btn,
.checkin-btn,
.submit-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(0); /* 启用硬件加速 */
}

.btn:active,
.buy-btn:active,
.checkin-btn:active,
.submit-btn:active {
    transform: scale(0.98) translateZ(0);
    transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 按钮波纹效果 */
.btn::before,
.buy-btn::before,
.checkin-btn::before {
    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 cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.btn:active::before,
.buy-btn:active::before,
.checkin-btn:active::before {
    width: 200px;
    height: 200px;
}

/* 卡片悬停动画 */
.card,
.checkin-item,
.shop-item,
.achievement-item,
.deduction-item,
.evaluation-card {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(0);
}

@media (hover: hover) {
    .card:hover,
    .checkin-item:hover,
    .shop-item:hover,
    .achievement-item:hover,
    .deduction-item:hover,
    .evaluation-card:hover {
        transform: translateY(-4px) translateZ(0);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }
}

/* 卡片点击动画 */
.card:active,
.checkin-item:active,
.shop-item:active,
.achievement-item:active,
.deduction-item:active,
.evaluation-card:active {
    transform: scale(0.98) translateZ(0);
    transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 输入框焦点动画 */
.form-control,
.cute-input,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateZ(0);
}

.form-control:focus,
.cute-input:focus,
input:focus,
textarea:focus,
select:focus {
    transform: translateY(-2px) translateZ(0);
    animation: inputFocusGlow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes inputFocusGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(76, 175, 80, 0.2);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2);
    }
}

/* 列表项动画 */
.list-item {
    opacity: 0;
    transform: translateX(-20px);
    animation: listItemSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.list-item:nth-child(1) { animation-delay: 0.1s; }
.list-item:nth-child(2) { animation-delay: 0.2s; }
.list-item:nth-child(3) { animation-delay: 0.3s; }
.list-item:nth-child(4) { animation-delay: 0.4s; }
.list-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes listItemSlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 网格项目动画 */
.grid-item {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    animation: gridItemFadeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.grid-item:nth-child(1) { animation-delay: 0.1s; }
.grid-item:nth-child(2) { animation-delay: 0.2s; }
.grid-item:nth-child(3) { animation-delay: 0.3s; }
.grid-item:nth-child(4) { animation-delay: 0.4s; }
.grid-item:nth-child(5) { animation-delay: 0.5s; }
.grid-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes gridItemFadeIn {
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 加载动画 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #81C784;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 脉冲加载动画 */
.loading-pulse {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #81C784;
    animation: pulse-dot 1.4s infinite ease-in-out both;
    margin: 0 2px;
}

.loading-pulse:nth-child(1) { animation-delay: -0.32s; }
.loading-pulse:nth-child(2) { animation-delay: -0.16s; }

@keyframes pulse-dot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 成功动画 */
.success-checkmark {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #4CAF50;
    position: relative;
    margin: 20px auto;
    animation: successPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.success-checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    animation: checkmarkDraw 0.3s ease-in-out 0.3s both;
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes checkmarkDraw {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 错误动画 */
.error-shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* 通知动画 */
.notification {
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
    animation: notificationSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes notificationSlideIn {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 标签页切换动画 */
.tab-content {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tab-content.active {
    opacity: 1;
    transform: translateY(0);
    animation: tabContentFadeIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* 下拉菜单动画 */
.dropdown-menu {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    animation: dropdownSlideDown 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* 工具提示动画 */
.tooltip {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}

.tooltip.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    animation: tooltipFadeIn 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 进度条动画 */
.progress-bar {
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 滚动动画 */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* 数字计数动画 */
.counter {
    animation: countUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    /* 减少动画复杂度以提高性能 */
    .modal-content {
        animation-duration: 0.3s;
    }
    
    .card:hover,
    .checkin-item:hover,
    .shop-item:hover,
    .achievement-item:hover,
    .deduction-item:hover,
    .evaluation-card:hover {
        transform: none;
    }
    
    /* 简化按钮动画 */
    .btn::before,
    .buy-btn::before,
    .checkin-btn::before {
        transition-duration: 0.3s;
    }
    
    /* 优化触摸反馈 */
    .btn:active,
    .buy-btn:active,
    .checkin-btn:active {
        transform: scale(0.95) translateZ(0);
    }
}

/* 减少动画偏好设置 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 硬件加速优化 */
.hardware-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 性能优化类 */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.will-change-auto {
    will-change: auto;
}