/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* 顶部导航栏 */
.top-navbar {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateY(0);
    opacity: 1;
}

.top-navbar.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.top-navbar.compact {
    transform: translateY(0);
    opacity: 0.95;
}

.top-navbar.compact .navbar-main {
    padding: 8px 20px;
}

.top-navbar.compact .logo {
    font-size: 18px;
}

.top-navbar.compact .logo-subtitle {
    display: none;
}

.top-navbar.compact .nav-btn {
    padding: 6px 12px;
    font-size: 12px;
}

.navbar-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
}

.logo-subtitle {
    font-size: 14px;
    color: #b3d9ff;
    margin-left: 10px;
}

.navbar-right {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.nav-btn.active {
    background: #28a745;
    border-color: #28a745;
}

/* 标题横幅 */
.title-banner {
    background: linear-gradient(45deg, 
        rgba(255,0,0,0.8), 
        rgba(255,255,255,0.9), 
        rgba(0,0,255,0.8)
    );
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    color: white;
    text-align: center;
    padding: 15px 20px;
    margin-top: 70px;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateY(0);
    opacity: 1;
}

.title-banner.hidden {
    transform: translateY(-100%);
    opacity: 0;
    margin-top: 0;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 主容器 */
.main-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

/* 左侧主内容区 */
.main-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* 搜索区域 */
.search-section {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.search-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.search-btn:hover {
    background: #0056b3;
}

.search-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.pagination-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-input {
    width: 60px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.page-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.page-btn:hover:not(:disabled) {
    background: #545b62;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 帖子列表 */
.posts-container {
    max-height: 800px;
    overflow-y: auto;
}

.post-card {
    border-bottom: 1px solid #e9ecef;
    padding: 20px;
    transition: background-color 0.3s ease;
}

.post-card:hover {
    background-color: #f8f9fa;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: bold;
    color: #1da1f2;
    font-size: 16px;
}

.post-time {
    color: #666;
    font-size: 14px;
}

.post-content {
    margin-bottom: 15px;
}

.post-text-chinese {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 10px;
}

.post-text-english {
    font-size: 14px;
    line-height: 1.5;
    color: #666;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border-left: 3px solid #007bff;
    display: none;
}

.toggle-english {
    color: #007bff;
    cursor: pointer;
    font-size: 14px;
    text-decoration: underline;
    margin-bottom: 10px;
    display: inline-block;
}

.toggle-english:hover {
    color: #0056b3;
}

.post-interactions {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.interaction-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.post-link:hover {
    text-decoration: underline;
}
/* 帖子图片样式 - 优化压缩显示和加载性能 */
.post-image-container {
    margin: 15px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e1e8ed;
    max-width: 100%;
    /* 固定容器高度，避免布局跳动 */
    min-height: 200px;
    max-height: 400px;
    position: relative;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    /* 保持比例，裁剪多余部分 */
    object-fit: contain;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.3s ease;
    
    /* 图片渲染优化 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    
    /* 初始状态 */
    opacity: 0;
}

/* 图片加载完成后显示 */
.post-image.loaded {
    opacity: 1;
}

.post-image:hover {
    transform: scale(1.02);
}

/* 图片加载状态 */
.post-image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
}

.post-image-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* 图片错误状态 */
.post-image-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #dc3545;
    font-size: 14px;
    text-align: center;
}

/* 图片质量标识 */
.image-quality-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

.image-quality-badge.compressed {
    background: rgba(40, 167, 69, 0.8);
}

.image-quality-badge.original {
    background: rgba(255, 193, 7, 0.8);
}

/* 图片切换按钮 */
.image-toggle-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 123, 255, 0.8);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.image-toggle-btn:hover {
    background: rgba(0, 123, 255, 1);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .post-image-container {
        margin: 10px -20px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        max-height: 300px;
        min-height: 150px;
    }
    
    .post-image {
        max-height: 300px;
    }
}

/* 图片懒加载优化 */
.post-image[data-src] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

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

/* 图片模态框优化 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.image-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.image-modal-controls {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.image-modal-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.image-modal-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.2s ease;
}

.image-modal-close:hover {
    color: #ccc;
}

/* ===== 视频播放器样式 ===== */

/* 视频容器 */
.post-video-container {
    margin: 15px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e1e8ed;
    max-width: 100%;
    position: relative;
    background: #000;
    /* 16:9 宽高比容器 */
    aspect-ratio: 16/9;
    min-height: 200px;
    max-height: 400px;
}

/* 视频元素 */
.post-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    cursor: pointer;
    transition: transform 0.2s ease;
    border-radius: 12px;
}

.post-video:hover {
    transform: scale(1.01);
}

/* 视频控制栏覆盖层 */
.video-controls-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.post-video-container:hover .video-controls-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* 全屏按钮 */
.video-fullscreen-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    backdrop-filter: blur(5px);
}

.video-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* 视频错误状态 */
.video-error {
    color: #dc3545;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    margin: 0;
    font-size: 14px;
}

.video-error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.video-error-message p {
    margin: 5px 0;
    font-size: 14px;
}

.video-error-message button {
    margin-top: 10px;
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.video-error-message button:hover {
    background: #0056b3;
}

/* 视频加载状态 */
.post-video-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: video-loading-spin 1s linear infinite;
    z-index: 1;
    opacity: 0;
}

.post-video-container.loading::before {
    opacity: 1;
}

@keyframes video-loading-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 视频播放控制优化 */
.post-video::-webkit-media-controls {
    /* 自定义控制栏样式 */
}

.post-video::-webkit-media-controls-panel {
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

.post-video::-webkit-media-controls-play-button,
.post-video::-webkit-media-controls-pause-button {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
}

/* 全屏模式下的样式 */
.post-video:fullscreen {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    background: #000;
}

.post-video:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    background: #000;
}

.post-video:-moz-full-screen {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    background: #000;
}

.post-video:-ms-fullscreen {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    background: #000;
}

/* 视频质量标识（类似图片） */
.video-quality-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(220, 53, 69, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
}

.video-quality-badge.hd {
    background: rgba(40, 167, 69, 0.8);
}

.video-quality-badge.sd {
    background: rgba(255, 193, 7, 0.8);
}

/* 视频时长显示 */
.video-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-video-container:hover .video-duration-badge {
    opacity: 1;
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 768px) {
    .post-video-container {
        margin: 10px -20px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        max-height: 300px;
        min-height: 180px;
        /* 移动端使用更紧凑的宽高比 */
        aspect-ratio: 16/10;
    }
    
    .post-video {
        border-radius: 0;
    }
    
    .video-controls-overlay {
        /* 移动端始终显示控制按钮 */
        opacity: 1;
        pointer-events: auto;
    }
    
    .video-fullscreen-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* 移动端全屏优化 */
    .post-video:fullscreen {
        object-fit: cover;
    }
    
    .post-video:-webkit-full-screen {
        object-fit: cover;
    }
}

/* 小屏幕设备优化 */
@media (max-width: 480px) {
    .post-video-container {
        max-height: 250px;
        min-height: 150px;
        aspect-ratio: 4/3;
    }
    
    .video-error-message {
        padding: 15px;
    }
    
    .video-error-message p {
        font-size: 12px;
    }
    
    .video-fullscreen-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 视频与图片混合显示优化 */
.post-content .post-image-container + .post-video-container {
    margin-top: 10px;
}

.post-content .post-video-container + .post-image-container {
    margin-top: 10px;
}

/* 深色模式支持（预留） */
@media (prefers-color-scheme: dark) {
    .post-video-container {
        border-color: #333;
        background: #1a1a1a;
    }
    
    .video-error-message {
        background: #2a2a2a;
        color: #ccc;
    }
    
    .video-error-message button {
        background: #0d6efd;
    }
    
    .video-error-message button:hover {
        background: #0b5ed7;
    }
}

/* 视频播放性能优化 */
.post-video {
    /* 启用硬件加速 */
    transform: translateZ(0);
    will-change: transform;
    
    /* 视频渲染优化 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 视频加载优化动画 */
.post-video-container.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: video-loading-shimmer 1.5s infinite;
}

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

/* 多视频播放控制 */
.post-video.playing {
    box-shadow: 0 0 0 2px #007bff;
}

.post-video.paused {
    opacity: 0.8;
}

/* 视频控制按钮集合 */
.video-control-group {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.post-video-container:hover .video-control-group {
    opacity: 1;
}

.video-control-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    backdrop-filter: blur(5px);
}

.video-control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* 视频音量控制提示 */
.video-volume-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.video-volume-indicator.show {
    opacity: 1;
}



/* 右侧状态面板 */
.status-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.status-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.status-card h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.status-label {
    color: #666;
}

.status-value {
    font-weight: bold;
    color: #333;
}

.status-value.success {
    color: #28a745;
}

.status-value.warning {
    color: #ffc107;
}

.status-value.error {
    color: #dc3545;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误状态 */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 20px;
    border: 1px solid #f5c6cb;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 15px;
    }
    
    .navbar-main {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .navbar-right {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .title-banner {
        font-size: 16px;
        margin-top: 120px;
    }
    
    .title-banner.hidden {
        margin-top: 0;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-stats {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    /* 移动端图片优化 */
    .post-image-container {
        margin: 10px -20px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        max-height: 300px;
    }
    
    .post-image {
        max-height: 300px;
    }
    
    .image-modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .image-modal-close {
        top: -35px;
        font-size: 30px;
    }
    
    /* 移动端导航栏折叠优化 */
    .top-navbar.compact .navbar-main {
        padding: 6px 15px;
    }
    
    .top-navbar.compact .navbar-right {
        gap: 5px;
    }
    
    .top-navbar.compact .nav-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* 图片压缩和优化相关样式 */
.post-image-optimized {
    /* 启用硬件加速 */
    transform: translateZ(0);
    will-change: transform;
    
    /* 图片渲染优化 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    
    /* 压缩显示 */
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

/* 图片加载状态 */
.post-image-loading {
    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; }
}
