/* ============================================
   英语学习网站 - 全局样式
   参考 TEco Lab 设计风格：简洁、专业、现代
   ============================================ */

/* ========== CSS 变量定义 ========== */
:root {
    /* 主色调 */
    --primary-color: #2563EB;        /* 蓝色主色 */
    --primary-hover: #1D4ED8;         /* 蓝色悬停 */
    --secondary-color: #10B981;       /* 绿色辅助 */
    --accent-color: #F59E0B;          /* 橙色强调 */
    
    /* 中性色 */
    --bg-primary: #F9FAFB;            /* 主背景 */
    --bg-secondary: #FFFFFF;          /* 次级背景 */
    --bg-card: #FFFFFF;               /* 卡片背景 */
    --border-color: #E5E7EB;          /* 边框色 */
    --text-primary: #111827;         /* 主文字 */
    --text-secondary: #6B7280;        /* 次级文字 */
    --text-muted: #9CA3AF;            /* 弱化文字 */
    
    /* 功能色 */
    --success: #10B981;               /* 成功绿 */
    --warning: #F59E0B;               /* 警告橙 */
    --error: #EF4444;                 /* 错误红 */
    --info: #3B82F6;                  /* 信息蓝 */
    
    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --page-gutter: clamp(14px, 3vw, 28px);
    --page-gutter-sm: clamp(14px, 4vw, 20px);
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* 字体 */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* ========== 重置样式 ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input,
textarea,
select {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul, ol {
    list-style: none;
}

/* ========== 布局容器 ========== */
.container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 var(--page-gutter);
}

.container-sm {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--page-gutter);
}

/* ========== 导航栏 ========== */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    max-width: 1480px;
    margin: 0 auto;
    padding: 10px var(--page-gutter);
    gap: 14px;
    flex-wrap: wrap;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 0;
}

.navbar-brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    min-height: 40px;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
}

/* ========== 页面头部 ========== */
.page-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-2xl) 0;
    margin-bottom: var(--spacing-xl);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ========== 卡片组件 ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
    display: block;
    text-decoration: none;
    color: inherit;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.card-image-placeholder {
    color: var(--text-muted);
    font-size: 3rem;
}

.card-badge {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.card-body {
    padding: var(--spacing-lg);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
    white-space: nowrap;
}

.card-title-en {
    font-size: 0.78rem;
}

.card-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--spacing-md);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-md);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.tag-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* ========== 网格布局 ========== */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ========== 系列卡片（主页用） ========== */
.series-card {
    cursor: pointer;
}

.series-card .card-image {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3B82F6 50%, var(--secondary-color) 100%);
}

.series-card .card-image-placeholder {
    color: rgba(255, 255, 255, 0.8);
}

/* ========== 视频列表项 ========== */
.video-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.video-item {
    display: flex;
    gap: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.video-thumbnail {
    width: 200px;
    min-width: 200px;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.video-thumbnail-placeholder {
    color: var(--text-muted);
    font-size: 2rem;
}

.video-duration {
    position: absolute;
    bottom: var(--spacing-xs);
    right: var(--spacing-xs);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

.video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.video-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--spacing-sm);
}

.video-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.video-number {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ========== 视频播放器 ========== */
.video-player-container {
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    aspect-ratio: 16 / 9;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1F2937 0%, #374151 100%);
    color: white;
}

.video-placeholder-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.video-placeholder-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ========== 知识点区域 ========== */
.knowledge-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--spacing-xl);
    margin-top: var(--spacing-xl);
}

.knowledge-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.knowledge-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.knowledge-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.knowledge-content {
    line-height: 1.8;
    color: var(--text-secondary);
}

.knowledge-content h1,
.knowledge-content h2,
.knowledge-content h3 {
    color: var(--text-primary);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.knowledge-content h1 { font-size: 1.5rem; }
.knowledge-content h2 { font-size: 1.25rem; }
.knowledge-content h3 { font-size: 1.125rem; }

.knowledge-content p {
    margin-bottom: var(--spacing-md);
}

.knowledge-content ul,
.knowledge-content ol {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-lg);
}

.knowledge-content li {
    margin-bottom: var(--spacing-xs);
    list-style: disc;
}

.knowledge-content ol li {
    list-style: decimal;
}

.knowledge-content code {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875em;
}

.knowledge-content pre {
    background: #1F2937;
    color: #E5E7EB;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--spacing-md);
}

.knowledge-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.knowledge-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: var(--spacing-md);
    margin: var(--spacing-md) 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* 重点词汇高亮 */
.highlight-red { color: #EF4444; font-weight: 500; }
.highlight-orange { color: #F59E0B; font-weight: 500; }
.highlight-purple { color: #8B5CF6; font-weight: 500; }
.highlight-green { color: #10B981; font-weight: 500; }
.highlight-blue { color: #3B82F6; font-weight: 500; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

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

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

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== 返回按钮 ========== */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: var(--spacing-sm) 0;
    margin-bottom: var(--spacing-lg);
    transition: color 0.2s ease;
}

.back-button:hover {
    color: var(--primary-color);
}

/* ========== 主内容区域 ========== */
.main-content {
    padding: clamp(18px, 4vw, 32px) 0;
    min-height: calc(100vh - 64px);
}

/* ========== 页脚 ========== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: clamp(18px, 4vw, 32px) 0;
    margin-top: var(--spacing-2xl);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

video,
iframe,
canvas,
svg {
    max-width: 100%;
}

/* ========== 面包屑 ========== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

.breadcrumb-item {
    color: var(--text-secondary);
}

.breadcrumb-item:hover {
    color: var(--primary-color);
}

.breadcrumb-separator {
    color: var(--text-muted);
}

/* ========== 统计卡片 ========== */
.stats-bar {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon-blue {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.stat-icon-green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon-orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
    html {
        font-size: 15.5px;
    }

    .container,
    .container-sm {
        padding: 0 var(--page-gutter-sm);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .navbar-content {
        gap: 12px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .navbar-brand {
        font-size: 1.08rem;
    }

    .navbar-nav {
        gap: 8px;
    }
    
    .video-item {
        flex-direction: column;
    }
    
    .video-thumbnail {
        width: 100%;
    }
}

@media (max-width: 768px) {
    :root {
        --spacing-lg: 16px;
        --spacing-xl: 24px;
    }

    html {
        font-size: 15px;
    }

    body {
        overflow-x: hidden;
    }
    
    .navbar-content {
        min-height: 60px;
        height: auto;
        padding: 10px var(--page-gutter-sm);
        gap: 10px;
        flex-wrap: wrap;
        align-items: center;
    }

    .navbar-brand {
        font-size: clamp(0.96rem, 4vw, 1.08rem);
        min-width: 0;
    }

    .navbar-brand-icon {
        width: 28px;
        height: 28px;
    }
    
    .navbar-nav {
        gap: var(--spacing-sm);
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .navbar-nav::-webkit-scrollbar {
        display: none;
    }
    
    .nav-link {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.875rem;
        min-height: 38px;
        flex: 0 0 auto;
    }

    button,
    input,
    select,
    textarea {
        font-size: 16px;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 1.5rem;
    }

    .page-header {
        padding: var(--spacing-xl) 0;
        margin-bottom: var(--spacing-lg);
    }
    
    .stats-bar {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .stat-card {
        width: 100%;
    }
    
    .video-list {
        gap: var(--spacing-sm);
    }
    
    .video-item {
        padding: var(--spacing-md);
    }
    
    .video-thumbnail {
        min-width: 0;
        width: 100%;
    }
    
    .knowledge-section {
        padding: var(--spacing-lg);
    }

    .card-body {
        padding: var(--spacing-md);
    }

    .card-title {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .card-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    .footer {
        margin-top: var(--spacing-xl);
        padding: var(--spacing-lg) 0;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14.5px;
    }

    .container,
    .container-sm {
        padding: 0 var(--page-gutter-sm);
    }

    .nav-link {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    .card-body,
    .knowledge-section,
    .video-item {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* ========== 加载动画 ========== */
.skeleton {
    background: linear-gradient(90deg, #E5E7EB 25%, #F3F4F6 50%, #E5E7EB 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
