/* 基础重置和变量定义 */
:root {
    --primary-color: #fb7299;
    --primary-dark: #ff2c7d;
    --secondary-color: #00a1d6;
    --bg-color: #f4f4f4;
    --sidebar-bg: #f6f7f8;
    --header-bg: #ffffff;
    --text-primary: #18191c;
    --text-secondary: #61666d;
    --border-color: #e3e5e7;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* 布局框架 */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: 220px;
    padding-top: 60px;
    min-height: 100vh;
}

/* 头部导航 */
.header {
    position: fixed;
    top: 0;
    left: 220px;
    right: 0;
    height: 60px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: var(--shadow);
}

/* Header layout: make search expand and align actions to the right */
.header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background-image: url("assets/welcome.png");
    background-size: cover;
    background-repeat: no-repeat;
}

.header-search {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
}

.header-search .search-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    box-sizing: border-box;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto; /* push to right */
}

.header-actions .icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid rgba(0,0,0,0.06);
}

/* small screens adjustments */
@media (max-width: 600px) {
    .header {
        padding: 8px 12px;
        gap: 8px;
    }

    .header-actions .icon-btn {
        font-size: 16px;
        padding: 4px;
    }

    .header-avatar {
        width: 32px;
        height: 32px;
    }
}

.header-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

/* 头部用户头像样式（用于替代退出按钮） */
.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    margin-left: 12px;
    border: 2px solid transparent;
}
.header-avatar:hover {
    border-color: rgba(0,0,0,0.08);
}

/* 头像下拉菜单 */
.avatar-container {
    position: relative;
}

.avatar-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    min-width: 150px;
    overflow: hidden;
    z-index: 2000;
}

.avatar-menu-item {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
}

.avatar-menu-item + .avatar-menu-item {
    border-top: 1px solid var(--border-color);
}

.avatar-menu-item:hover {
    background: var(--bg-color);
}
.search-input {
    width: 100%;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(251, 114, 153, 0.1);
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    /* 将侧边栏顶部留白减少，使标题靠近顶部 */
    padding: 10px 0 20px;
    overflow-y: auto;
    z-index: 999;
}

.sidebar-header {
    padding: 6px 16px 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.sidebar-header h2 {
    margin: 0;
    font-size: 1.25em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-nav {
    list-style: none;
}

.nav-item {
    padding: 12px 20px;
    margin: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-icon {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* 内容区域 */
.content-area {
    padding: 20px;
    min-height: calc(100vh - 60px);
}

/* 视频网格布局 */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.video-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.video-cover {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.video-info {
    padding: 12px;
}

.video-title {
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.form-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(251, 114, 153, 0.1);
}

/* 工具类 */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* 添加到 style.css 末尾 */

/* 通用空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* 通用卡片样式 */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* 通用按钮样式增强 */
.btn {
    transition: all 0.3s ease;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 加载状态样式 */
.loading-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.mt-20 {
    margin-top: 20px;
}

/* 按钮文本样式 */
.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px 10px;
}

.btn-text:hover {
    color: var(--primary-color);
}

/* 关注按钮样式 */
.follow-btn {
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.follow-btn.following {
    background: var(--text-secondary);
}

.follow-btn:hover {
    opacity: 0.8;
}

/* 模态框背景点击关闭 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

/* 表单样式增强 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* 响应式设计增强 */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        height: auto;
        width: 100%;
        padding: 10px 0;
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
    }
    
    .nav-item {
        flex: 0 0 auto;
        padding: 10px 15px;
    }
    
    .main-content {
        margin-left: 0;
        margin-bottom: 60px;
    }
    
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* 历史记录页面样式 */
.history-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.history-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-stats {
    display: flex;
    gap: 30px;
}

.history-stat {
    text-align: center;
}

.history-number {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

.history-label {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.history-actions {
    display: flex;
    gap: 10px;
}

.history-filters {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.history-filter {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.history-filter.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.history-filter:hover {
    border-color: var(--primary-color);
}

.history-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.history-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.history-item:hover {
    background: var(--bg-color);
}

.history-item:last-child {
    border-bottom: none;
}

.history-thumbnail {
    width: 120px;
    height: 80px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 15px;
    cursor: pointer;
}

.history-content {
    flex: 1;
}

.history-title {
    font-weight: 600;
    margin-bottom: 8px;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-title:hover {
    color: var(--primary-color);
}

.history-meta {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
}

.history-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.8em;
    min-width: 60px;
}

.history-actions-item {
    display: flex;
    align-items: center;
}

.history-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.history-delete:hover {
    background: var(--bg-color);
}

/* 空状态样式 */
.empty-history {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-history p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* 编辑模式样式 */
.history-item.editing {
    background: #fff9e6;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .history-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .history-stats {
        gap: 20px;
    }
    
    .history-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .history-item {
        flex-direction: column;
    }
    
    .history-thumbnail {
        width: 100%;
        height: 180px;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .history-filters {
        gap: 10px;
    }
    
    .history-filter {
        padding: 6px 12px;
        font-size: 0.9em;
    }
}

/* 分类页面样式 */
.category-filters {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-weight: bold;
    color: var(--text-secondary);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.video-count {
    color: var(--text-secondary);
    margin-left: auto;
}

.category-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.category-video-section {
    margin-top: 20px;
}

.load-more-container {
    text-align: center;
    margin: 30px 0;
}

.category-card {
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.category-description {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 8px;
    line-height: 1.4;
}

/* 响应式设计 */
@media (min-width: 768px) {
    .category-content {
        flex-direction: row;
    }
    
    .category-grid {
        flex: 0 0 300px;
    }
    
    .category-video-section {
        flex: 1;
        margin-top: 0;
    }
}

@media (max-width: 767px) {
    .category-filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .video-count {
        margin-left: 0;
    }
}

/* ------------------ styles extracted from index.html ------------------ */
/* 页面样式（来自 index.html 的内联样式，已迁移） */
.page { display: none; }
.page.active { display: block; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 20px; }
.category-card { background: white; padding: 30px; text-align: center; border-radius: 8px; cursor: pointer; box-shadow: var(--shadow); transition: all 0.3s; }
.category-card:hover { transform: translateY(-5px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.category-icon { font-size: 2em; margin-bottom: 10px; }
.loading-state, .empty-state { grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state button { margin-top: 20px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.video-card { background: white; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); transition: all 0.3s; cursor: pointer; }
.video-card:hover { transform: translateY(-5px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.video-cover { width: 100%; height: 160px; object-fit: cover; }
.video-info { padding: 15px; }
.video-title { font-weight: bold; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-meta { display: flex; justify-content: space-between; font-size: 0.9em; color: var(--text-secondary); }
.video-author { cursor: pointer; color: var(--primary-color); }
.video-author:hover { text-decoration: underline; }
.loading-spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin 1s ease-in-out infinite; margin-right: 10px; vertical-align: middle; }
.footer { margin-top: 40px; padding: 20px; background-color: white; text-align: center; color: var(--text-secondary); font-size: 12px; border-top: 1px solid var(--border-color); position: fixed; left: 0; bottom: 0; width: 100%; height: 50px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 768px) {
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
    .category-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 480px) {
    .video-grid { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------ end extracted index.html styles ------------------ */

/* ------------------ styles extracted from user.html ------------------ */
/* 用户主页页面样式（来自 user.html 的内联样式，已迁移） */
.profile-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 40px 20px; text-align: center; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; border: 4px solid white; margin-bottom: 15px; object-fit: cover; }
.profile-info { margin-bottom: 20px; }
.profile-username { font-size: 1.5em; font-weight: bold; margin-bottom: 5px; }
.profile-signature { color: rgba(255,255,255,0.8); margin-bottom: 15px; max-width: 500px; margin-left: auto; margin-right: auto; line-height: 1.4; }
.profile-stats { display: flex; justify-content: center; gap: 30px; }
.stat-item { text-align: center; cursor: pointer; transition: transform 0.2s; }
.stat-item:hover { transform: translateY(-2px); }
.stat-number { font-size: 1.2em; font-weight: bold; }
.stat-label { font-size: 0.9em; opacity: 0.8; }
.profile-actions { margin-top: 15px; }
.profile-tabs { background: white; border-bottom: 1px solid var(--border-color); }
.tab-nav { display: flex; list-style: none; padding: 0 20px; margin: 0; }
.tab-item { padding: 15px 20px; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.3s; }
.tab-item.active { border-bottom-color: var(--primary-color); color: var(--primary-color); }
.tab-item:hover { background: var(--bg-color); }
.tab-content { padding: 20px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.follow-btn { background: var(--primary-color); color: white; border: none; padding: 8px 20px; border-radius: 20px; cursor: pointer; font-size: 14px; transition: all 0.3s; }
.follow-btn.following { background: var(--text-secondary); }
.follow-btn:hover { opacity: 0.8; transform: translateY(-1px); }
.dynamic-item { background: white; padding: 15px; margin-bottom: 15px; border-radius: 8px; box-shadow: var(--shadow); transition: transform 0.2s; }
.dynamic-item:hover { transform: translateY(-2px); }
@media (max-width: 768px) {
    .profile-stats { gap: 20px; }
    .tab-nav { flex-wrap: wrap; }
    .tab-item { padding: 10px 15px; font-size: 0.9em; }
    .profile-header { padding: 30px 15px; }
}

/* ------------------ end extracted user.html styles ------------------ */