/* 動畫效果樣式 - Animation Styles */

/* ========== 基礎動畫定義 ========== */

/* 主題指示器動畫 */
@keyframes themeIndicatorSlide {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes themeIndicatorPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(74, 144, 226, 0);
    }
}

/* ACG 圖片動畫 */
@keyframes imageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes imageRotateIn {
    0% {
        opacity: 0;
        transform: rotate(-5deg) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

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

/* 網絡測試動畫 */
@keyframes pingPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.7);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 8px rgba(74, 144, 226, 0);
    }
}

@keyframes testingDots {
    0%, 20% {
        color: var(--primary-color);
        transform: scale(1);
    }
    40% {
        color: var(--accent-color);
        transform: scale(1.1);
    }
    60%, 100% {
        color: var(--primary-color);
        transform: scale(1);
    }
}

@keyframes resultFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 淡入動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 滑入動畫 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 縮放動畫 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 彈跳動畫 */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

/* 脈衝動畫 */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--primary-color-rgb), 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(var(--primary-color-rgb), 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--primary-color-rgb), 0);
    }
}

/* 漸變背景動畫 */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 旋轉動畫 */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 搖擺動畫 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-2px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(2px);
    }
}

/* 呼吸燈效果 */
@keyframes breathe {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* ========== 頁面載入動畫 ========== */

.page-enter {
    animation: fadeIn 0.8s ease-out;
}

.section-enter {
    animation: slideInUp 0.6s ease-out;
}

.card-enter {
    animation: scaleIn 0.5s ease-out;
}

/* ========== 交互動畫 ========== */

.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(var(--primary-color-rgb), 0.4);
}

/* ========== 按鈕動畫 ========== */

.btn-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-animated:hover::before {
    left: 100%;
}

.btn-pulse {
    animation: pulse 2s infinite;
}

.btn-click {
    animation: btnClick 0.3s ease;
}

@keyframes btnClick {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* ========== 輸入框動畫 ========== */

.input-focus-effect {
    position: relative;
}

.input-focus-effect::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.input-focus-effect:focus-within::after {
    width: 100%;
}

/* ========== 卡片動畫 ========== */

.card-animated {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.card-animated:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* ========== 載入動畫 ========== */

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

.loading-rotate {
    animation: rotate 1s linear infinite;
}

/* ========== 文字動畫 ========== */

.text-gradient-animated {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
}

.text-bounce {
    animation: bounce 1s ease;
}

.text-shake {
    animation: shake 0.5s ease;
}

/* ========== 新增動畫類 ========== */

/* 主題指示器動畫類 */
.theme-indicator-slide {
    animation: themeIndicatorSlide 0.5s ease-out;
}

.theme-indicator-pulse {
    animation: themeIndicatorPulse 2s ease-in-out infinite;
}

/* ACG 圖片動畫類 */
.image-slide-in {
    animation: imageSlideIn 0.6s ease-out;
}

.image-rotate-in {
    animation: imageRotateIn 0.8s ease-out;
}

.refresh-spinning {
    animation: refreshSpin 1s linear infinite;
}

/* 網絡測試動畫類 */
.ping-pulse {
    animation: pingPulse 1.5s ease-in-out infinite;
}

.testing-dots {
    animation: testingDots 1.5s ease-in-out infinite;
}

.result-fade-in {
    animation: resultFadeIn 0.4s ease-out;
}

/* 技術徽章動畫 */
.badge-float {
    animation: float 3s ease-in-out infinite;
}

.badge-glow {
    transition: all 0.3s ease;
}

.badge-glow:hover {
    filter: brightness(1.2) drop-shadow(0 0 8px rgba(74, 144, 226, 0.6));
    transform: translateY(-2px);
}

/* ========== 響應式動畫優化 ========== */

@media (max-width: 768px) {
    /* 移動端減少動畫強度 */
    .hover-lift:hover {
        transform: translateY(-2px);
    }
    
    .card-animated:hover {
        transform: translateY(-1px) scale(1.01);
    }
    
    /* 減少動畫時間 */
    .btn-animated::before {
        transition: left 0.3s ease;
    }
}

/* ========== 減少動畫偏好設置 ========== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hover-lift:hover,
    .hover-scale:hover,
    .card-animated:hover {
        transform: none;
    }
}

/* ========== 主題切換動畫 ========== */

.theme-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== 滾動觸發動畫 ========== */

.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

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

/* ========== 特殊效果動畫 ========== */

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

.glowing {
    box-shadow: 0 0 20px rgba(var(--primary-color-rgb), 0.3);
    animation: pulse 2s infinite;
}

/* ========== 頁腳動畫 ========== */

.footer-animated {
    position: relative;
    overflow: hidden;
}

.footer-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(-45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    animation: shimmer 3s ease-in-out infinite;
}

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

/* ========== 彩蛋爆炸動畫 ========== */

/* 爆炸中心效果 - 增強拖尾和光暈 */
@keyframes explode {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 
            0 0 0 rgba(255, 255, 255, 0),
            0 0 0 rgba(255, 100, 100, 0),
            0 0 0 rgba(255, 200, 200, 0);
        filter: blur(0px) brightness(1);
    }
    25% {
        transform: scale(1.2);
        opacity: 0.9;
        box-shadow: 
            0 0 20px rgba(255, 255, 255, 0.8),
            0 0 40px rgba(255, 100, 100, 0.6),
            0 0 60px rgba(255, 200, 200, 0.4);
        filter: blur(1px) brightness(1.5);
    }
    50% {
        transform: scale(1.8);
        opacity: 0.7;
        box-shadow: 
            0 0 40px rgba(255, 255, 255, 0.6),
            0 0 80px rgba(255, 100, 100, 0.5),
            0 0 120px rgba(255, 200, 200, 0.3),
            0 0 160px rgba(255, 150, 150, 0.2);
        filter: blur(2px) brightness(2) saturate(2);
    }
    75% {
        transform: scale(2.5);
        opacity: 0.4;
        box-shadow: 
            0 0 60px rgba(255, 255, 255, 0.4),
            0 0 120px rgba(255, 100, 100, 0.3),
            0 0 180px rgba(255, 200, 200, 0.2),
            0 0 240px rgba(255, 150, 150, 0.1);
        filter: blur(3px) brightness(1.8) saturate(1);
    }
    100% {
        transform: scale(3.5);
        opacity: 0;
        box-shadow: 
            0 0 80px rgba(255, 255, 255, 0.2),
            0 0 160px rgba(255, 100, 100, 0.15),
            0 0 240px rgba(255, 200, 200, 0.1),
            0 0 320px rgba(255, 150, 150, 0.05);
        filter: blur(4px) brightness(0) saturate(0);
    }
}





/* 點擊反饋動畫 */
@keyframes clickPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(74, 144, 226, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 20px rgba(74, 144, 226, 0);
    }
}

.click-pulse {
    animation: clickPulse 0.3s ease-out;
}

/* 淡入效果 */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}