/* Reset */
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f1f2f3;
    color: #18191c;
    line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; }

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid #e3e5e7;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.logo {
    font-size: 22px;
    font-weight: bold;
    color: #00a1d6;
    flex-shrink: 0;
}
.nav {
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}
.nav-link {
    color: #61666d;
    font-size: 14px;
    padding: 6px 0;
}
.nav-link:hover { color: #00a1d6; }
.search-form {
    flex: 1;
    max-width: 500px;
    display: flex;
}
.search-input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e3e5e7;
    border-radius: 4px 0 0 4px;
    outline: none;
    background: #f1f2f3;
}
.search-input:focus { border-color: #00a1d6; background: #fff; }
.search-btn {
    height: 36px;
    padding: 0 18px;
    border: none;
    background: #e3e5e7;
    color: #61666d;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}
.search-btn:hover { background: #00a1d6; color: #fff; }
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid #e3e5e7;
    background: #fff;
    color: #61666d;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background: #f1f2f3; }
.btn-primary {
    background: #00a1d6;
    border-color: #00a1d6;
    color: #fff;
}
.btn-primary:hover { background: #0087b3; border-color: #0087b3; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* User menu */
.user-menu { position: relative; }
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    min-width: 140px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 8px;
}
.user-dropdown a {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: #18191c;
}
.user-dropdown a:hover { background: #f1f2f3; color: #00a1d6; }
.user-menu:hover .user-dropdown { display: block; }

/* Avatar */
.avatar { border-radius: 50%; object-fit: cover; background: #e3e5e7; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 80px; height: 80px; }

/* Layout */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 64px - 60px);
}
.home-layout {
    display: flex;
    gap: 20px;
}
.sidebar {
    width: 160px;
    flex-shrink: 0;
}
.content { flex: 1; min-width: 0; }

/* Category list */
.category-list {
    background: #fff;
    border-radius: 4px;
    padding: 12px 0;
    border: 1px solid #e3e5e7;
}
.category-item {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: #61666d;
}
.category-item:hover { color: #00a1d6; background: #f1f2f3; }
.category-item.active { color: #00a1d6; background: #e8f7fc; }

/* Tab bar */
.tab-bar {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}
.tab-item {
    font-size: 16px;
    color: #61666d;
    padding-bottom: 6px;
    border-bottom: 2px solid transparent;
}
.tab-item.active { color: #18191c; border-bottom-color: #00a1d6; }
.tab-item:hover { color: #00a1d6; }

/* Video grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.video-card {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e3e5e7;
    transition: border-color 0.2s;
}
.video-card:hover { border-color: #00a1d6; }
.video-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #e3e5e7;
}
.video-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 2px;
}
.video-info { padding: 10px; }
.video-title {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.4;
    color: #18191c;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.video-meta {
    font-size: 12px;
    color: #9499a0;
}
.video-author { display: block; margin-bottom: 2px; }

/* Page header */
.page-title {
    font-size: 20px;
    margin: 0 0 16px;
}
.page-header { margin-bottom: 16px; }
.page-header h1 { font-size: 20px; margin: 0; }

/* Pagination */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}
.page-item {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    font-size: 14px;
    color: #61666d;
}
.page-item:hover { border-color: #00a1d6; color: #00a1d6; }
.page-item.active { background: #00a1d6; border-color: #00a1d6; color: #fff; }

/* Auth pages */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
}
.auth-box {
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 8px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
}
.auth-box h2 { margin: 0 0 24px; text-align: center; }
.auth-form .form-group { margin-bottom: 16px; }
.auth-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #61666d;
}
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    outline: none;
    font-size: 14px;
}
.form-input:focus { border-color: #00a1d6; }
.form-tip { font-size: 12px; color: #9499a0; margin-top: 4px; }
.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
}
.auth-link a { color: #00a1d6; }

/* Video show */
.video-show-layout {
    display: flex;
    gap: 20px;
}
.video-main { flex: 1; min-width: 0; }
.video-sidebar {
    width: 320px;
    flex-shrink: 0;
}
.dplayer-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}
.video-info-section {
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    padding: 16px;
    margin-top: 16px;
}
.video-show-title { font-size: 20px; margin: 0 0 10px; }
.video-show-meta {
    font-size: 13px;
    color: #9499a0;
    margin-bottom: 12px;
}
.video-show-meta span { margin-right: 16px; }
.video-actions { display: flex; gap: 10px; }
.action-btn {
    padding: 8px 16px;
    border: 1px solid #e3e5e7;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #61666d;
}
.action-btn:hover { background: #f1f2f3; }
.action-btn.active {
    background: #00a1d6;
    border-color: #00a1d6;
    color: #fff;
}

.video-uploader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    padding: 12px 16px;
    margin-top: 12px;
}
.uploader-link { display: flex; align-items: center; gap: 12px; }
.uploader-name { font-weight: 500; }
.uploader-desc { font-size: 12px; color: #9499a0; }

.video-description {
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    padding: 16px;
    margin-top: 12px;
    font-size: 14px;
}
.video-description p { margin: 0 0 12px; }
.video-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    background: #f1f2f3;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #61666d;
}

/* Comments */
.comment-section {
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    padding: 16px;
    margin-top: 12px;
}
.comment-form { margin-bottom: 16px; }
.comment-form textarea { margin-bottom: 10px; }
.comments-list { display: flex; flex-direction: column; gap: 16px; }
.comment-item { display: flex; gap: 12px; }
.comment-body { flex: 1; }
.comment-user { font-weight: 500; font-size: 14px; }
.comment-content { margin: 4px 0; font-size: 14px; }
.comment-time { font-size: 12px; color: #9499a0; }

/* Sidebar recommended */
.recommended-list { display: flex; flex-direction: column; gap: 12px; }
.recommended-item { display: flex; gap: 10px; }
.recommended-cover {
    width: 120px;
    flex-shrink: 0;
    aspect-ratio: 16 / 10;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    background: #e3e5e7;
}
.recommended-cover img { width: 100%; height: 100%; object-fit: cover; }
.recommended-info { flex: 1; min-width: 0; }
.recommended-title {
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.recommended-meta { font-size: 12px; color: #9499a0; margin-top: 4px; }

/* Profile */
.profile-header {
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    padding: 24px;
    margin-bottom: 16px;
    background-size: cover;
    background-position: center;
}
.profile-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
}
.profile-info h1 { margin: 0 0 8px; }
.profile-bio { color: #61666d; margin: 0 0 10px; }
.profile-stats { font-size: 14px; color: #9499a0; margin-bottom: 12px; }
.profile-stats span { margin-right: 16px; }
.profile-content {
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    padding: 16px;
}
.profile-content h2 { font-size: 18px; margin: 0 0 16px; }
.avatar-upload { display: flex; align-items: center; gap: 12px; }

/* Admin */
.admin-body { background: #f1f2f3; }
.admin-layout {
    display: flex;
    gap: 20px;
}
.admin-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    padding: 16px;
}
.admin-sidebar h3 { margin: 0 0 16px; font-size: 16px; }
.admin-nav {
    display: block;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 14px;
    color: #61666d;
    margin-bottom: 4px;
}
.admin-nav:hover { background: #f1f2f3; }
.admin-nav.active { background: #e8f7fc; color: #00a1d6; }
.admin-content {
    flex: 1;
    background: #fff;
    border: 1px solid #e3e5e7;
    border-radius: 4px;
    padding: 20px;
    min-width: 0;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.stat-card {
    background: #f1f2f3;
    border-radius: 4px;
    padding: 20px;
    text-align: center;
}
.stat-value { font-size: 28px; font-weight: bold; color: #00a1d6; }
.stat-label { font-size: 14px; color: #61666d; margin-top: 4px; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.admin-table th, .admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e3e5e7;
}
.admin-table th { background: #f1f2f3; font-weight: 500; }
.admin-table a { color: #00a1d6; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9499a0;
    font-size: 14px;
}

/* Footer */
.footer {
    background: #fff;
    border-top: 1px solid #e3e5e7;
    padding: 20px;
    text-align: center;
    color: #9499a0;
    font-size: 13px;
}
.footer-inner { max-width: 1400px; margin: 0 auto; }

/* DPlayer overrides */
.dplayer { border-radius: 4px; background: #000; }
.dplayer .dplayer-video-wrap .dplayer-video { background: #000; }
.dplayer .dplayer-video-wrap .dplayer-video-current-time,
.dplayer .dplayer-video-wrap .dplayer-video-bar-wrap,
.dplayer .dplayer-video-wrap .dplayer-video-bar,
.dplayer .dplayer-video-wrap .dplayer-thumbnails { z-index: 3; }
.dplayer .dplayer-mask { background: rgba(0,0,0,0); }
.dplayer .dplayer-preview { transition: opacity 0.3s; }
.dplayer .dplayer-preview.dplayer-preview-hide { opacity: 0; pointer-events: none; }

/* 视频加载动画 */
.dplayer-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #000;
    color: #fff;
    z-index: 2;
    transition: opacity 0.3s;
    pointer-events: none;
}
.dplayer-loader.dplayer-loader-hide {
    opacity: 0;
    visibility: hidden;
}
.dplayer-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: #00a1d6;
    border-radius: 50%;
    animation: dplayer-spin 0.8s linear infinite;
}
.dplayer-loader-text {
    margin-top: 14px;
    font-size: 14px;
    color: #ccc;
}
@keyframes dplayer-spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .video-show-layout { flex-direction: column; }
    .video-sidebar { width: 100%; }
    .home-layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .category-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; }
    .category-item { padding: 6px 12px; white-space: nowrap; }
}
@media (max-width: 768px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 10px; }
    .nav { order: 3; width: 100%; margin-top: 8px; }
    .search-form { order: 2; }
    .video-grid { grid-template-columns: repeat(2, 1fr); }
    .header-actions { order: 4; width: 100%; margin-top: 8px; justify-content: flex-end; }
}
