/* ============================================
   自定义滚动条样式
   ============================================ */

/* Webkit 浏览器滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #4361EE;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a56d4;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox 浏览器滚动条 */
* {
    scrollbar-width: thin;
    scrollbar-color: #4361EE #f1f1f1;
}

/* 深色模式滚动条 */
.dark ::-webkit-scrollbar-track {
    background: #1E1E1E;
}

.dark ::-webkit-scrollbar-thumb {
    background: #5390D9;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #4a80c9;
}

.dark * {
    scrollbar-color: #5390D9 #1E1E1E;
}

/* ============================================
   页面过渡动画
   ============================================ */

.page-transition {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
}

.page-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
}

/* 淡入淡出效果 */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 300ms ease-in;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 300ms ease-out;
}

/* ============================================
   图片悬停效果
   ============================================ */

.image-container {
    overflow: hidden;
    border-radius: 0.5rem;
    position: relative;
    cursor: pointer;
}

.image-container img {
    transition: transform 0.5s ease, filter 0.3s ease;
    display: block;
    width: 100%;
    height: auto;
}

.image-container:hover img {
    transform: scale(1.1);
}

.image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0.5rem;
    pointer-events: none;
}

.image-container:hover::after {
    opacity: 1;
}

/* 深色模式图片悬停效果 */
.dark .image-container::after {
    background: rgba(0, 0, 0, 0.4);
}

/* ============================================
   按钮波纹效果
   ============================================ */

.ripple-button {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    cursor: pointer;
    transition: all 0.3s ease;
}

.ripple-button:active {
    transform: scale(0.98);
}

.ripple-button::after {
    content: "";
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.8) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.8s;
}

.ripple-button:active::after {
    transform: scale(0, 0);
    opacity: 0.3;
    transition: 0s;
}

/* 深色模式按钮波纹 */
.dark .ripple-button::after {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
}

/* ============================================
   背景图案效果
   ============================================ */

.bg-pattern {
    background-color: #f8f9fa;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234361ee' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-size: 60px 60px;
    position: relative;
}

/* 深色模式背景图案 */
.dark .bg-pattern {
    background-color: #121212;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%235390d9' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ============================================
   渐变背景效果
   ============================================ */

.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 200% 200%;
    animation: gradient-shift 15s ease infinite;
}

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

/* ============================================
   卡片悬停效果
   ============================================ */

.hover-card {
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
    background: white;
}

.hover-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-color: rgba(67, 97, 238, 0.2);
}

.dark .hover-card {
    background: #1E1E1E;
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .hover-card:hover {
    border-color: rgba(83, 144, 217, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ============================================
   文字渐变效果
   ============================================ */

.gradient-text {
    background: linear-gradient(90deg, #4361EE, #3A56D4, #5390D9);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: text-shimmer 2s linear infinite;
}

@keyframes text-shimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* ============================================
   加载动画
   ============================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(67, 97, 238, 0.1);
    border-radius: 50%;
    border-top-color: #4361EE;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   浮动动画
   ============================================ */

.float-animation {
    animation: float 6s ease-in-out infinite;
}

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

/* ============================================
   打字机效果
   ============================================ */

.typewriter {
    overflow: hidden;
    border-right: 3px solid #4361EE;
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.15em;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

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

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

/* ============================================
   脉冲动画
   ============================================ */

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================
   阴影效果
   ============================================ */

.shadow-glow {
    box-shadow: 0 0 20px rgba(67, 97, 238, 0.3);
    transition: box-shadow 0.3s ease;
}

.shadow-glow:hover {
    box-shadow: 0 0 40px rgba(67, 97, 238, 0.5);
}

.dark .shadow-glow {
    box-shadow: 0 0 20px rgba(83, 144, 217, 0.3);
}

.dark .shadow-glow:hover {
    box-shadow: 0 0 40px rgba(83, 144, 217, 0.5);
}

/* ============================================
   响应式调整
   ============================================ */

@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
    }
    
    .hover-card:hover {
        transform: translateY(-4px);
    }
    
    .typewriter {
        white-space: normal;
        border-right: none;
        animation: none;
    }
}

/* ============================================
   工具类
   ============================================ */

.blur-backdrop {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.8);
}

.dark .blur-backdrop {
    background-color: rgba(0, 0, 0, 0.8);
}

.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.dark .text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}