/* 自定义样式 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.95);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

@keyframes underline {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

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

/* 打字机效果 */
.typewriter {
    display: inline-block;
    overflow: visible;
    white-space: nowrap;
    letter-spacing: 0.05em;
    border-right: 3px solid white;
    animation: blink-caret 0.75s step-end infinite;
    min-height: 1.2em; /* 确保有足够高度显示光标 */
    max-width: 100%;
    width: auto; /* 确保容器适应内容宽度 */
    padding-right: 3px; /* 为光标添加额外空间 */
}

/* 打字机文本元素 */
#typewriter-text {
    display: inline-block;
    overflow: visible;
    white-space: nowrap;
    letter-spacing: 0.05em;
    border-right: 3px solid white;
    animation: blink-caret 0.75s step-end infinite;
    min-height: 1.2em; /* 确保有足够高度显示光标 */
    max-width: 100%;
    width: auto; /* 确保容器适应内容宽度 */
    padding-right: 3px; /* 为光标添加额外空间 */
    color: #e5e7eb; /* 使用浅灰色文本 */
}

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

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: white; }
}

/* AI科幻背景效果 */
#ai-background {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #334155 50%, #1e3a8a 75%, #1e1b4b 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* 主页背景 */
#home {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 25%, #334155 50%, #1e3a8a 75%, #1e1b4b 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* 粒子容器样式 */
#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* 网格背景效果 */
.grid-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(20px, 20px); }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 导航栏背景模糊效果 */
.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* 导航链接下划线动画 */
.nav-link {
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease;
}

.nav-link:not(.bg-blue-600)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: currentColor;
    transition: width 0.3s ease;
    transform-origin: left;
}

.nav-link:not(.bg-blue-600):hover::after {
    width: 100%;
    animation: underline 0.3s ease forwards;
}

/* 蓝色背景按钮的悬停效果 */
.nav-link.bg-blue-600 {
    transition: all 0.3s ease;
}

.nav-link.bg-blue-600:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 卡片悬停效果 */
.hover-lift {
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 服务卡片悬停效果 */
.service-item {
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.service-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.service-item:hover .service-icon {
    animation: float 2s ease-in-out infinite;
}

/* 按钮悬停效果 */
.btn-hover {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.5s ease;
}

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

.btn-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 按钮波纹效果 */
.btn-ripple {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

/* 背景图案动画 */
.bg-pattern {
    position: relative;
    overflow: hidden;
}

.bg-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(37, 99, 235, 0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    z-index: 0;
}

/* 表单输入框焦点效果 */
.form-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 响应式图片 */
img {
    max-width: 100%;
    height: auto;
}

/* 文本选择颜色 */
::selection {
    background-color: rgba(37, 99, 235, 0.2);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 动画延迟类 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-500 { animation-delay: 0.5s; }

/* 渐变背景动画 */
.gradient-animation {
    background: linear-gradient(270deg, #2563eb, #3b82f6, #60a5fa);
    background-size: 600% 600%;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 响应式设计调整 */
@media (max-width: 768px) {
    /* 移动端导航菜单样式 */
    .mobile-menu {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .mobile-menu.active {
        transform: translateX(0);
    }
    
    /* 移动端卡片间距调整 */
    .field-card, .service-card {
        margin-bottom: 1.5rem;
    }
    
    /* 移动端标题字体大小调整 */
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    /* 移动端表单元素宽度 */
    .form-input {
        width: 100%;
    }
}

/* 移动端特定样式 */
@media (max-width: 640px) {
    /* 更小的屏幕调整 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 移动端按钮全宽 */
    .btn-primary {
        width: 100%;
    }
    
    /* 移动端网格布局调整 */
    .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    .grid-cols-1.md\:grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* 平板设备调整 */
@media (min-width: 768px) and (max-width: 1024px) {
    /* 平板设备特定样式 */
    .field-card, .service-card {
        min-height: 280px;
    }
}

/* 滚动触发动画类 */
.scroll-animate {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-animate.visible {
    opacity: 1;
}

/* 淡入动画 */
.fade-in {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
}

/* 缩放动画 */
.scale-in {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* 滑入动画 */
.slide-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 延迟动画类 */
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }
.delay-400 { transition-delay: 0.4s; }
.delay-500 { transition-delay: 0.5s; }
.delay-600 { transition-delay: 0.6s; }

/* 动画持续时间类 */
.duration-300 { transition-duration: 0.3s; }
.duration-500 { transition-duration: 0.5s; }
.duration-700 { transition-duration: 0.7s; }
.duration-1000 { transition-duration: 1s; }