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

/* 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);
}

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

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

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

.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.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: 0.5rem;
}

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

.dark .image-container::after {
    background: rgba(0, 0, 0, 0.3);
}

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

.ripple-button {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    cursor: pointer;
}

.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;
}

.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");
}

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

.article-card {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.dark .article-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* 卡片边框动画 */
.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    border: 2px solid transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.article-card:hover::before {
    opacity: 1;
    border-color: rgba(67, 97, 238, 0.2);
}

.dark .article-card:hover::before {
    border-color: rgba(83, 144, 217, 0.3);
}

/* ============================================
   标签样式
   ============================================ */

.tag {
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: rgba(67, 97, 238, 0.1);
    color: #4361EE;
    cursor: pointer;
    user-select: none;
}

.tag:hover {
    transform: scale(1.05);
    background-color: rgba(67, 97, 238, 0.2);
}

.dark .tag {
    background-color: rgba(83, 144, 217, 0.2);
    color: #5390D9;
}

.dark .tag:hover {
    background-color: rgba(83, 144, 217, 0.3);
}

/* ============================================
   通用悬停效果
   ============================================ */

/* 链接下划线动画 */
.hover-link {
    position: relative;
    display: inline-block;
}

.hover-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #4361EE;
    transition: width 0.3s ease;
}

.hover-link:hover::after {
    width: 100%;
}

.dark .hover-link::after {
    background-color: #5390D9;
}

/* 图标悬停效果 */
.icon-hover {
    transition: transform 0.3s ease, color 0.3s ease;
}

.icon-hover:hover {
    transform: scale(1.2);
    color: #4361EE;
}

.dark .icon-hover:hover {
    color: #5390D9;
}

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

.loading-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    margin: 0 3px;
    background-color: #4361EE;
    border-radius: 50%;
    display: inline-block;
    animation: loading-dots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

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

.dark .loading-dots span {
    background-color: #5390D9;
}

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

.shadow-soft {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shadow-medium {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

.shadow-hard {
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.05);
}

/* ============================================
   边框效果
   ============================================ */

.border-gradient {
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
}

.border-gradient::before {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    bottom: -2px;
    left: -2px;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(45deg, #4361EE, #3A56D4, #5390D9);
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

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

/* ============================================
   文本效果
   ============================================ */

.text-gradient {
    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;
    }
}

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

@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
    }
    
    .article-card:hover {
        transform: translateY(-3px);
    }
    
    .tag:hover {
        transform: scale(1.03);
    }
}

@media (max-width: 480px) {
    .page-enter {
        transform: translateY(10px);
    }
    
    .image-container:hover img {
        transform: scale(1.05);
    }
}

/* ============================================
   打印样式
   ============================================ */

@media print {
    .page-transition,
    .article-card:hover,
    .tag:hover,
    .image-container:hover img {
        transition: none !important;
        transform: none !important;
    }
    
    .bg-pattern {
        background-image: none !important;
    }
    
    ::-webkit-scrollbar {
        display: none;
    }
    
    * {
        scrollbar-width: none;
    }
}

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

.blur-backdrop {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

.text-balance {
    text-wrap: balance;
}

.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   主题颜色变量
   ============================================ */

:root {
    --primary-color: #4361EE;
    --primary-dark: #3A56D4;
    --accent-color: #5390D9;
    --light-bg: #f8f9fa;
    --dark-bg: #121212;
    --border-light: rgba(0, 0, 0, 0.1);
    --border-dark: rgba(255, 255, 255, 0.1);
}

.dark {
    --primary-color: #5390D9;
    --primary-dark: #4a80c9;
    --accent-color: #4361EE;
}