/**
 * 炫酷动效样式
 * 包含页面过渡、卡片动画、交互效果等
 */

/* ==================== 全局动画配置 ==================== */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== 页面加载动画 ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ==================== 渐变背景动画 ==================== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* ==================== 登录页面动画 ==================== */
.login-container {
    animation: fadeIn 0.6s ease-out;
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

.login-box {
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s ease;
}

.login-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-title {
    animation: fadeInDown 0.6s ease-out 0.2s both;
}

.login-box .el-form-item {
    animation: fadeInUp 0.5s ease-out both;
}

.login-box .el-form-item:nth-child(1) { animation-delay: 0.1s; }
.login-box .el-form-item:nth-child(2) { animation-delay: 0.2s; }
.login-box .el-form-item:nth-child(3) { animation-delay: 0.3s; }
.login-box .el-form-item:nth-child(4) { animation-delay: 0.4s; }

.login-box .el-button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-box .el-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.login-box .el-button:hover::before {
    width: 300px;
    height: 300px;
}

.login-box .el-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.login-box .el-button:active {
    transform: translateY(0);
}

/* ==================== 主容器动画 ==================== */
.main-container {
    animation: fadeIn 0.4s ease-out;
}

/* ==================== 侧边栏动画 ==================== */
.sidebar {
    animation: slideInLeft 0.5s ease-out;
}

.sidebar .el-menu-item {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sidebar .el-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(180deg, #667eea, #764ba2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar .el-menu-item:hover::before {
    transform: translateX(0);
}

.sidebar .el-menu-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%) !important;
    transform: translateX(5px);
}

.sidebar .el-menu-item.is-active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, transparent 100%) !important;
}

/* ==================== 头部动画 ==================== */
.header {
    animation: slideInDown 0.5s ease-out;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
}

.header .el-button {
    transition: all 0.3s ease;
}

.header .el-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* ==================== 书签卡片动画 ==================== */
.bookmark-card {
    animation: fadeInUp 0.5s ease-out both;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.bookmark-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.bookmark-card:hover::before {
    left: 100%;
}

.bookmark-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.bookmark-card:active {
    transform: translateY(-4px) scale(1.01);
}

/* 卡片延迟动画 */
.bookmark-card:nth-child(1) { animation-delay: 0.05s; }
.bookmark-card:nth-child(2) { animation-delay: 0.1s; }
.bookmark-card:nth-child(3) { animation-delay: 0.15s; }
.bookmark-card:nth-child(4) { animation-delay: 0.2s; }
.bookmark-card:nth-child(5) { animation-delay: 0.25s; }
.bookmark-card:nth-child(6) { animation-delay: 0.3s; }
.bookmark-card:nth-child(7) { animation-delay: 0.35s; }
.bookmark-card:nth-child(8) { animation-delay: 0.4s; }

/* 书签图标动画 */
.bookmark-card img {
    transition: transform 0.3s ease;
}

.bookmark-card:hover img {
    transform: scale(1.2) rotate(5deg);
}

/* ==================== 按钮通用动画 ==================== */
.el-button {
    transition: all 0.3s ease;
    position: relative;
}

.el-button:hover {
    transform: translateY(-2px);
}

.el-button:active {
    transform: translateY(0);
}

.el-button--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    position: relative;
    overflow: hidden;
}

.el-button--primary::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;
}

.el-button--primary:hover::after {
    width: 300px;
    height: 300px;
}

.el-button--primary:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* ==================== 输入框动画 ==================== */
.el-input__wrapper {
    transition: all 0.3s ease;
}

.el-input__wrapper:hover {
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.15);
}

.el-input__wrapper.is-focus {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
}

/* ==================== 对话框动画 ==================== */
.el-dialog {
    animation: scaleIn 0.3s ease-out;
}

.el-dialog__header {
    animation: fadeInDown 0.4s ease-out;
}

.el-dialog__body {
    animation: fadeInUp 0.4s ease-out 0.1s both;
}

/* ==================== 消息提示动画 ==================== */
.el-message {
    animation: slideInDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==================== 表格动画 ==================== */
.el-table {
    animation: fadeIn 0.5s ease-out;
}

.el-table__row {
    transition: all 0.3s ease;
}

.el-table__row:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, transparent 100%) !important;
    transform: translateX(3px);
}

/* ==================== 标签动画 ==================== */
.el-tag {
    transition: all 0.3s ease;
}

.el-tag:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ==================== 加载动画 ==================== */
.el-loading-mask {
    backdrop-filter: blur(5px);
    background-color: rgba(255, 255, 255, 0.7) !important;
}

.el-loading-spinner {
    animation: pulse 1.5s ease-in-out infinite;
}

.el-loading-spinner .circular {
    animation: rotate 2s linear infinite;
}

/* ==================== 搜索框动画 ==================== */
.search-container .el-input {
    transition: all 0.3s ease;
}

.search-container .el-input:hover .el-input__wrapper {
    transform: scale(1.02);
}

.search-container .el-input.is-focus .el-input__wrapper {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.3);
}

/* ==================== 分类卡片动画 ==================== */
.category-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.category-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.category-item:hover::after {
    width: 80%;
}

.category-item:hover {
    transform: translateY(-3px);
    color: #667eea;
}

.category-item.active {
    color: #667eea;
    font-weight: bold;
}

.category-item.active::after {
    width: 80%;
}

/* ==================== 管理后台动画 ==================== */
.admin-container {
    animation: fadeIn 0.5s ease-out;
}

.admin-container .el-aside {
    animation: slideInLeft 0.5s ease-out;
}

.admin-container .el-main {
    animation: slideInRight 0.5s ease-out;
}

/* ==================== 统计卡片动画 ==================== */
.stat-card {
    animation: scaleIn 0.5s ease-out both;
    transition: all 0.3s ease;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

/* ==================== 页面切换动画 ==================== */
.route-enter-active {
    animation: fadeInUp 0.4s ease-out;
}

.route-leave-active {
    animation: fadeIn 0.2s ease-out reverse;
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #764ba2, #667eea);
}

/* ==================== 响应式动画优化 ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== 性能优化 ==================== */
.bookmark-card,
.el-button,
.el-input__wrapper,
.sidebar .el-menu-item {
    will-change: transform;
}

/* 减少重绘 */
.bookmark-card:hover,
.el-button:hover {
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}
