/* ============================================
   DeepTime 动画系统 - 高级、优雅、空灵
   所有动画统一在此文件管理
   ============================================ */

/* === 全局过渡 === */
a, button {
    transition: color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
input, textarea, select {
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* === 按钮动画 === */
.btn {
    position: relative;
    overflow: hidden;
}
.btn:active {
    transform: scale(0.96) !important;
    transition: transform 0.1s ease !important;
}
.btn-primary {
    box-shadow: 0 4px 15px rgba(212, 168, 75, 0.2);
}
.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(212, 168, 75, 0.35);
    transform: translateY(-2px);
}
.btn-secondary:hover {
    box-shadow: 0 4px 12px rgba(212, 168, 75, 0.15);
    transform: translateY(-1px);
}
.btn-ghost:hover {
    background: var(--bg-hover);
}

/* === 卡片悬停动画 === */
.article-card, .file-card-home, .glass-card, .stat-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.article-card:hover, .glass-card:hover, .stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    border-color: var(--gold-border);
}
.file-card-home:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-color: var(--line-hover);
}
.article-card:active, .file-card-home:active, .glass-card:active {
    transform: translateY(-2px) scale(0.98);
}

/* === 文章封面缩放 === */
.article-cover {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.article-card:hover .article-cover {
    transform: scale(1.05);
}

/* === 输入框聚焦 === */
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.12);
}

/* === 下拉菜单动画 === */
.header-dropdown {
    transform-origin: top right;
    animation: dropdownIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes dropdownIn {
    from { opacity: 0; transform: scale(0.95) translateY(-8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* === 模态框动画 === */
.modal-overlay {
    animation: fadeIn 0.3s ease;
}
.modal-overlay .modal {
    animation: modalIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* === Toast 动画 === */
.toast {
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%) scale(0.9); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

/* === 侧边栏动画 === */
#sidebar {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-overlay {
    transition: opacity 0.3s ease;
}

/* === 页面内容淡入 === */
.page-content > * {
    animation: contentFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes contentFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === 分页按钮 === */
.pagination a, .pagination span {
    transition: all 0.25s ease;
}
.pagination a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 168, 75, 0.2);
    border-color: var(--gold-border);
    color: var(--gold);
}

/* === 徽章 === */
.badge {
    transition: all 0.2s ease;
}

/* === 滚动条 === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-void); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-glow-mid); }

/* === 选中文本 === */
::selection {
    background: rgba(212, 168, 75, 0.2);
    color: var(--ink-1);
}

/* === 主题切换过渡 === */
html, body, #app, #sidebar, #header, #main-content, #page-content,
.glass-card, .stat-card, .article-card, .file-card-home,
.form-input, .form-textarea, .form-select,
.header-dropdown, .comment, .toast {
    transition-property: background-color, color, border-color;
    transition-duration: 0.4s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 粒子和装饰元素不参与主题过渡 */
#particle-canvas, .starfield, .hero-deco, .scroll-hint {
    transition: none !important;
}

/* === 减少动效模式 === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === 移除移动端蓝色选中框 === */
* {
    -webkit-tap-highlight-color: transparent;
}
button, a, input, textarea, select, .btn, .nav-item, .article-card, .file-card-home, .glass-card {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
button:focus, a:focus, input:focus, textarea:focus, select:focus {
    outline: none;
}
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* === 移动端触摸反馈 === */
@media (hover: none) {
    .article-card:hover, .file-card-home:hover, .glass-card:hover, .stat-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    .btn:hover { transform: none; }
    .btn:active { transform: scale(0.97); opacity: 0.9; }
}
