/* 自定义CSS变量 */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #f97316;
    --secondary-dark: #ea580c;
    --accent-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-light);
    line-height: 1.6;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* 通用动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

/* 滚动触发动画 */
.fade-in {
    animation: fadeIn var(--transition-slow) ease forwards;
}

.slide-in-left {
    animation: slideInLeft var(--transition-slow) ease forwards;
}

.slide-in-right {
    animation: slideInRight var(--transition-slow) ease forwards;
}

.scale-in {
    animation: scaleIn var(--transition-normal) ease forwards;
}

/* 导航栏样式 */
header {
    transition: all var(--transition-normal);
}

header.scrolled {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-md);
}

/* 下拉菜单样式 */
nav .group .dropdown-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    pointer-events: none;
}

nav .group:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* 移动端菜单样式 */
#mobile-menu {
    transition: all var(--transition-normal);
}

/* 按钮样式 */
.btn {
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-normal);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 卡片样式 */
.card {
    transition: all var(--transition-normal);
    background-color: var(--bg-white);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* 课程卡片样式 */
.course-card {
    position: relative;
}

.course-card .course-duration {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.course-card .course-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.course-card .course-rating .stars {
    color: #fbbf24;
}

/* 导航链接样式 */
nav a {
    transition: all var(--transition-fast);
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-normal);
}

nav a:hover::after {
    width: 100%;
}

/* 标签样式 */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tag-primary {
    background-color: var(--primary-color);
    color: white;
}

.tag-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.tag-accent {
    background-color: var(--accent-color);
    color: white;
}

/* 进度条样式 */
.progress-bar {
    background-color: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
    height: 8px;
}

.progress-bar .progress {
    background-color: var(--primary-color);
    height: 100%;
    transition: width var(--transition-slow);
}

/* 教师卡片样式 */
.teacher-card {
    text-align: center;
}

.teacher-card .teacher-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 1rem;
    border: 4px solid var(--bg-white);
    box-shadow: var(--shadow-md);
}

/* 响应式表格样式 */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--bg-light);
    font-weight: 600;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: all var(--transition-fast);
    background-color: var(--bg-white);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.error {
    border-color: #ef4444;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.pagination .page-item {
    transition: all var(--transition-fast);
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: var(--bg-white);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.pagination .page-link:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 页脚样式 */
footer {
    background-color: var(--text-primary);
    color: white;
}

footer a {
    color: #9ca3af;
    transition: all var(--transition-fast);
}

footer a:hover {
    color: white;
}

/* 社交媒体图标样式 */
.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transition: all var(--transition-normal);
}

.social-icon:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* 返回顶部按钮样式 */
#back-to-top {
    transition: all var(--transition-normal);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* 统计数字动画 */
.counter {
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--primary-color);
}

/* 响应式样式 */
@media (max-width: 1023px) {
    /* 平板设备样式 */
    nav .group .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background-color: transparent;
        pointer-events: auto;
        display: none;
    }
    
    nav .group.open .dropdown-menu {
        display: block;
    }
}

@media (max-width: 767px) {
    /* 移动设备样式 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .course-card .course-duration {
        top: 5px;
        right: 5px;
        padding: 0.125rem 0.5rem;
        font-size: 0.625rem;
    }
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(37, 99, 235, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* 搜索结果高亮 */
.highlight {
    background-color: rgba(249, 115, 22, 0.2);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

/* 成功/错误消息样式 */
.message {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.message.success {
    background-color: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--accent-color);
    color: #059669;
}

.message.error {
    background-color: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
    color: #dc2626;
}

.message.warning {
    background-color: rgba(251, 191, 36, 0.1);
    border-left: 4px solid #fbbf24;
    color: #d97706;
}

/* 标签云样式 */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-cloud .tag {
    background-color: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.tag-cloud .tag:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* 课程筛选器样式 */
.filter-tabs {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
}

.filter-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background-color: var(--bg-white);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 阅读进度条 */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 4px;
    background-color: var(--primary-color);
    z-index: 9999;
    transition: width var(--transition-fast);
}

/* 暗黑模式支持（如果需要） */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-light: #111827;
        --bg-white: #1f2937;
        --text-primary: #f9fafb;
        --text-secondary: #9ca3af;
        --border-color: #374151;
    }
    
    .card {
        background-color: var(--bg-white);
    }
    
    .form-input {
        background-color: var(--bg-white);
        color: var(--text-primary);
    }
    
    .pagination .page-link {
        background-color: var(--bg-white);
        color: var(--text-primary);
    }
}