/* === 动画效果 === */

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 上滑动画 */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 下滑动画 */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 左滑动画 */
@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 右滑动画 */
@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 缩放动画 */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 旋转动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 脉冲动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* 成功勾号动画 */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* === 动画类 === */

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s ease;
}

.slide-down {
    animation: slideDown 0.5s ease;
}

.slide-left {
    animation: slideLeft 0.5s ease;
}

.slide-right {
    animation: slideRight 0.5s ease;
}

.scale-in {
    animation: scaleIn 0.5s ease;
}

/* 应用于页面加载 */
.page-header {
    animation: slideDown 0.6s ease;
}

.card {
    animation: slideUp 0.6s ease;
}

.notification-item {
    animation: slideLeft 0.4s ease;
}

.notification-item:nth-child(1) { animation-delay: 0.1s; }
.notification-item:nth-child(2) { animation-delay: 0.2s; }
.notification-item:nth-child(3) { animation-delay: 0.3s; }
.notification-item:nth-child(4) { animation-delay: 0.4s; }
.notification-item:nth-child(5) { animation-delay: 0.5s; }

/* === 悬停效果增强 === */

.btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover:before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 82, 204, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 卡片悬停效果 */
.card {
    transition: all 0.3s ease;
}

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

/* 表格行悬停效果 */
.data-table tr {
    transition: all 0.3s ease;
}

.data-table tr:hover {
    background: #f9f9f9;
    transform: scale(1.01);
}

/* 通知项悬停效果 */
.notification-item {
    transition: all 0.3s ease;
}

.notification-item:hover {
    background: #f9f9f9;
    padding-left: 35px;
}

.notification-item.unread:hover {
    background: rgba(0, 82, 204, 0.05);
}

/* 导航栏链接悬停效果 */
.navbar-link {
    position: relative;
    transition: color 0.3s ease;
}

.navbar-link:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #0052cc;
    transition: width 0.3s ease;
}

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

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

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #0052cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 骨架屏加载 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* === 成功/错误消息动画 === */

.success-message,
.error-message {
    animation: slideDown 0.4s ease;
}

.success-message.show,
.error-message.show {
    animation: slideDown 0.4s ease, fadeIn 0.4s ease;
}

/* === 分页按钮动画 === */

.pagination button {
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 82, 204, 0.2);
}

.pagination button.active {
    animation: pulse 2s infinite;
}

/* === 表单输入框动画 === */

.form-input {
    transition: all 0.3s ease;
}

.form-input:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 82, 204, 0.1);
}

/* === 开关按钮动画 === */

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #0052cc;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* === 滚动条样式 === */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* === 响应式动画 === */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

@media print {
    .navbar,
    .notification-bell,
    .user-menu,
    .btn,
    .pagination {
        display: none !important;
    }
}
