/* 动画效果和科技感样式 - Anime Rangers X Codes */

/* 基础动画关键帧定义 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 5px rgba(124, 77, 255, 0.5); }
    50% { box-shadow: 0 0 20px rgba(124, 77, 255, 0.8), 0 0 30px rgba(255, 64, 129, 0.5); }
    100% { box-shadow: 0 0 5px rgba(124, 77, 255, 0.5); }
}

@keyframes borderGlow {
    0% { border-color: var(--primary-color); }
    50% { border-color: var(--secondary-color); }
    100% { border-color: var(--primary-color); }
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink {
    50% { border-color: transparent }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* 粒子背景效果 */
.particles-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    opacity: 0.3;
    animation: float 8s infinite ease-in-out;
}

/* 页面加载动画 */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out, visibility 0.8s;
}

.page-transition.loaded {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 120px;
    height: 120px;
    border: 5px solid transparent;
    border-top-color: var(--primary-color);
    border-bottom-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.loader:before, .loader:after {
    content: '';
    position: absolute;
    border: 5px solid transparent;
    border-radius: 50%;
}

.loader:before {
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border-top-color: var(--secondary-color);
    border-bottom-color: var(--primary-color);
    animation: spin 1s linear infinite reverse;
}

.loader:after {
    top: 30px;
    left: 30px;
    right: 30px;
    bottom: 30px;
    border-top-color: var(--accent-color);
    animation: spin 0.5s linear infinite;
}

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

/* 标题科技感效果 */
.tech-title {
    position: relative;
    display: inline-block;
    text-shadow: 0 0 10px rgba(124, 77, 255, 0.7), 0 0 20px rgba(124, 77, 255, 0.5);
    animation: glowPulse 3s infinite ease-in-out;
    z-index: 2;
}

.tech-title:after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    color: transparent;
    z-index: -1;
    -webkit-text-stroke: 2px rgba(255, 64, 129, 0.5);
    animation: pulse 2s infinite ease-in-out alternate;
}

/* 内容区块动画 */
.content-section {
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

.section-hidden {
    opacity: 0;
    transform: translateY(30px);
}

.animate-in {
    animation: slideUp 0.6s forwards ease-out;
}

/* 代码卡片增强效果 */
.code-card {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.code-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.code-card::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    border-radius: var(--border-radius);
    border: 2px solid transparent;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.code-card:hover::after {
    opacity: 1;
}

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

.copy-btn: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: all 0.3s ease;
}

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

.copy-btn:hover {
    box-shadow: 0 5px 15px rgba(124, 77, 255, 0.4);
    transform: translateY(-2px);
}

/* 导航菜单动画 */
.nav-menu a {
    position: relative;
}

.nav-menu a:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.nav-menu a:hover:after {
    width: 100%;
}

/* 打字机效果 */
.typewriter {
    overflow: hidden;
    white-space: nowrap;
    margin: 0 auto;
    animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
    border-right: 3px solid var(--primary-color);
}

/* 通知消息动画 */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    background: linear-gradient(135deg, var(--primary-color), var(--dark-background));
    color: white;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.error {
    background: linear-gradient(135deg, #ff4081, #b71c1c);
}

.notification.success {
    background: linear-gradient(135deg, #00c853, #2e7d32);
}

/* 霓虹灯文字效果 */
.neon-text {
    color: #fff;
    text-shadow: 0 0 5px #fff, 
                 0 0 10px #fff, 
                 0 0 15px var(--primary-color), 
                 0 0 20px var(--primary-color), 
                 0 0 25px var(--primary-color), 
                 0 0 30px var(--primary-color), 
                 0 0 35px var(--primary-color);
}

/* 闪光边框效果 */
.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    background: linear-gradient(45deg, 
                var(--primary-color), 
                var(--secondary-color), 
                var(--accent-color), 
                var(--primary-color));
    border-radius: inherit;
    background-size: 400%;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: animateBorder 3s linear infinite;
}

.glow-border:hover::before {
    opacity: 1;
}

@keyframes animateBorder {
    0% { background-position: 0 0; }
    100% { background-position: 300% 0; }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .typewriter {
        animation: none;
        white-space: normal;
        border-right: none;
    }
    
    .nav-menu a:after {
        bottom: 0;
    }
} 