/* 主题CSS变量 */
:root {
    --theme-primary: #374151;
    --theme-secondary: #6B7280;
    --theme-accent: #9CA3AF;
    --theme-highlight: #D1D5DB;
    --theme-card-opacity: 0.85;
    --theme-navbar-opacity: 0.85;
    --theme-announcement-opacity: 0.90;
}

/* 主题应用类 */
.theme-text {
    color: var(--theme-primary);
}

.theme-gradient {
    background: linear-gradient(135deg, 
        var(--theme-primary) 0%, 
        var(--theme-secondary) 50%, 
        var(--theme-accent) 100%
    );
}

.theme-button {
    background: var(--theme-primary);
}

.theme-button:hover {
    background: var(--theme-secondary);
}

.theme-card {
    background: rgba(255, 255, 255, var(--theme-card-opacity));
}

.theme-navbar {
    background: rgba(255, 255, 255, var(--theme-navbar-opacity));
}

.theme-announcement {
    background: rgba(255, 255, 255, var(--theme-announcement-opacity));
}

.focus\:border-theme:focus {
    border-color: var(--theme-primary);
}

/* 渐变文字效果 - 增强版 */
.gradient-text {
    background: linear-gradient(135deg, 
        var(--theme-primary) 0%, 
        var(--theme-secondary) 33%, 
        var(--theme-accent) 66%, 
        var(--theme-highlight) 100%
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    letter-spacing: -0.02em;
    text-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

.gradient-text-secondary {
    background: linear-gradient(90deg, 
        var(--theme-primary) 0%, 
        var(--theme-secondary) 50%, 
        var(--theme-accent) 100%
    );
    background-size: 250% 250%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* 渐变动画 */
.animate-gradient {
    animation: gradientMove 4s ease infinite;
}

.animate-gradient-slow {
    animation: gradientMove 6s ease infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 按钮动态背景 */
.theme-button-animated {
    background: var(--theme-primary);
    position: relative;
}

.bg-gradient-animation {
    background: linear-gradient(135deg, 
        var(--theme-primary) 0%, 
        var(--theme-secondary) 25%, 
        var(--theme-accent) 50%, 
        var(--theme-highlight) 75%, 
        var(--theme-primary) 100%
    );
    background-size: 400% 400%;
    animation: gradientFlow 5s ease infinite;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 卡片背景动态效果 */
.theme-card {
    position: relative;
    overflow: hidden;
}

.theme-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* 导航栏动态效果 */
.theme-navbar {
    position: relative;
}

.theme-navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--theme-primary) 20%, 
        var(--theme-secondary) 40%, 
        var(--theme-accent) 60%, 
        var(--theme-highlight) 80%, 
        transparent 100%
    );
    background-size: 300% 100%;
    animation: borderFlow 4s linear infinite;
    border-radius: 0 0 999px 999px;
}

@keyframes borderFlow {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 慢速脉冲动画 */
.animate-pulse-slow {
    animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

/* 公告面板动态边框 */
.theme-announcement {
    position: relative;
}

.theme-announcement::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, 
        var(--theme-primary) 0%, 
        var(--theme-secondary) 25%, 
        var(--theme-accent) 50%, 
        var(--theme-highlight) 75%, 
        var(--theme-primary) 100%
    );
    background-size: 500% 500%;
    border-radius: 1rem;
    z-index: -1;
    animation: gradientBorder 8s ease infinite;
    opacity: 0.4;
}

@keyframes gradientBorder {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 加载动画 */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top: 6px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 淡入动画 */
.animate-fadeIn {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 搜索结果卡片动画 */
.result-item {
    animation: slideUp 0.5s ease-out backwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 文本行数限制 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(75, 85, 99, 0.7);
}

/* 细滚动条样式 */
.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.4);
    border-radius: 10px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: rgba(75, 85, 99, 0.6);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .glass-effect {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 选中文本样式 */
::selection {
    background: rgba(118, 75, 162, 0.3);
    color: inherit;
}

/* 焦点样式优化 */
button:focus,
input:focus {
    outline: none;
}

/* 加载骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 按钮波纹效果 */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}
