/* 前台样式 v1.0.3.2 - 优化移动端体验 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    /* 禁止iOS下拉刷新弹性效果 */
    overscroll-behavior-y: none;
    /* 优化移动端字体渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 移动端容器优化 */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
}

/* 头部 */
.header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    /* 移动端优化：防止滚动抖动 */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    min-height: 60px;
}

.logo {
    font-size: 22px;
    color: #1890ff;
    font-weight: 700;
    /* 防止换行 */
    white-space: nowrap;
}

.nav {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 移动端头部优化 */
@media (max-width: 768px) {
    .logo {
        font-size: 18px;
    }
}

.nav-link {
    text-decoration: none;
    color: #666;
    transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: #1890ff;
}

.user-info {
    color: #666;
}

/* 按钮 */
.btn-primary, .btn-secondary, .btn-logout, .btn-admin {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    /* 移动端优化：增大点击区域 */
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 防止双击缩放 */
    touch-action: manipulation;
    /* 去除移动端点击高亮 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* 移动端按钮优化 */
@media (max-width: 768px) {
    .btn-primary, .btn-secondary, .btn-logout, .btn-admin {
        font-size: 15px;
        padding: 12px 20px;
        min-height: 44px; /* iOS推荐最小触摸区域 */
    }
}

.btn-primary {
    background: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-logout {
    background: #ff4d4f;
    color: #fff;
}

.btn-logout:hover {
    background: #ff7875;
}

.btn-admin {
    background: #52c41a;
    color: #fff;
    text-decoration: none;
    display: inline-block;
}

.btn-block {
    width: 100%;
}

.btn-large {
    padding: 12px 24px;
    font-size: 16px;
}

/* 投票状态栏 */
.vote-status-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.vote-status {
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* 移动端状态栏优化 */
@media (max-width: 768px) {
    .vote-status-bar {
        padding: 10px 0;
    }
    
    .vote-status {
        font-size: 14px;
        line-height: 1.5;
    }
}

/* 主内容 */
.main-content {
    padding: 30px 0;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    border: 2px solid #d9d9d9;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    min-height: 40px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.filter-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
    background: #e6f7ff;
}

.filter-btn.active {
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #fff;
    border-color: #1890ff;
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

/* 移动端筛选栏优化 */
@media (max-width: 768px) {
    .filter-bar {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .filter-btn {
        flex: 1;
        min-width: 0;
        padding: 12px 20px;
        font-size: 15px;
        min-height: 44px;
    }
}

/* 作品网格 */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.work-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: default;
    position: relative;
    /* 移动端优化 */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.work-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.work-card.selected {
    border: 3px solid #1890ff;
    box-shadow: 0 4px 16px rgba(24, 144, 255, 0.25);
}

/* 移动端作品网格优化 */
@media (max-width: 768px) {
    .works-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .work-card:hover {
        transform: none; /* 移动端禁用悬停上浮效果 */
    }
    
    .work-card:active {
        transform: scale(0.98); /* 点击反馈 */
    }
}

.work-media-container {
    cursor: pointer;
    overflow: hidden;
}

.work-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
    /* 图片加载优化 */
    background: #f0f0f0;
}

.work-media-container:hover .work-image {
    transform: scale(1.05);
}

.work-video {
    width: 100%;
    height: 200px;
    background: #000;
}

/* 视频缩略图容器 */
.video-thumbnail-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    cursor: pointer;
    overflow: hidden;
}

.video-thumbnail-wrapper .video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-thumbnail-wrapper:hover .video-thumbnail {
    transform: scale(1.05);
}

/* 播放按钮覆盖层 */
.play-button-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: all 0.3s ease;
}

.video-thumbnail-wrapper:hover .play-button-overlay {
    transform: translate(-50%, -50%) scale(1.1);
}

.play-button-overlay svg {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.work-info {
    padding: 16px;
}

/* 移动端媒体优化 */
@media (max-width: 768px) {
    .work-image, .work-video, .video-thumbnail-wrapper {
        height: 220px; /* 移动端增加高度 */
    }
    
    .work-media-container:hover .work-image,
    .video-thumbnail-wrapper:hover .video-thumbnail {
        transform: none; /* 移动端禁用缩放效果 */
    }
    
    .video-thumbnail-wrapper:hover .play-button-overlay {
        transform: translate(-50%, -50%); /* 移动端禁用按钮缩放 */
    }
    
    .work-info {
        padding: 14px;
    }
}

.work-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.3s ease;
}

.work-title:hover {
    color: #1890ff;
}

.work-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
    word-break: break-word;
}

/* 描述中的段落标签样式重置 */
.work-description p {
    margin: 0;
    padding: 0;
    display: inline;
}

.work-description br {
    display: none; /* 隐藏换行符，保持紧凑 */
}

.work-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #999;
    font-size: 14px;
}

.work-votes {
    color: #1890ff;
    font-weight: 600;
}

.work-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.work-actions button {
    flex: 1;
    font-weight: 500;
}

/* 移动端操作按钮优化 */
@media (max-width: 768px) {
    .work-actions {
        gap: 8px;
        margin-top: 14px;
    }
    
    .work-actions button {
        padding: 11px 16px;
        font-size: 15px;
        min-height: 44px;
    }
}

.select-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 10;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.select-checkbox:hover {
    border-color: #1890ff;
    transform: scale(1.1);
}

.work-card.selected .select-checkbox {
    background: #1890ff;
    border-color: #1890ff;
    box-shadow: 0 2px 12px rgba(24, 144, 255, 0.4);
}

.work-card.selected .select-checkbox::after {
    content: '✓';
    color: #fff;
    display: block;
    text-align: center;
    line-height: 24px;
    font-size: 16px;
    font-weight: bold;
}

/* 移动端复选框优化 */
@media (max-width: 768px) {
    .select-checkbox {
        width: 32px;
        height: 32px;
        top: 10px;
        right: 10px;
    }
    
    .work-card.selected .select-checkbox::after {
        line-height: 28px;
        font-size: 18px;
    }
}

/* 批量投票栏 */
.batch-vote-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
    padding: 16px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 99;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #e8e8e8;
}

.selected-info {
    font-size: 16px;
    font-weight: 600;
    color: #1890ff;
}

.selected-info span {
    display: inline-block;
    background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    margin: 0 5px;
    font-size: 18px;
}

/* 移动端批量投票栏优化 */
@media (max-width: 768px) {
    .batch-vote-bar {
        padding: 12px 15px;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .selected-info {
        font-size: 15px;
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }
    
    .batch-vote-bar button {
        flex: 1;
        min-width: 120px;
    }
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.page-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.page-btn.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #1890ff;
}

.modal-footer {
    text-align: center;
    margin-top: 15px;
    color: #666;
}

.modal-footer a {
    color: #1890ff;
    text-decoration: none;
}

.loading {
    text-align: center;
    padding: 50px;
    color: #999;
}

/* ========== 分享按钮样式 ========== */
.share-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.share-btn:active {
    transform: translateY(0);
}

/* 响应式 - 优化版 */
@media (max-width: 768px) {
    /* 头部导航移动端布局 */
    .header-content {
        flex-direction: column;
        gap: 12px;
        padding: 10px 0;
    }
    
    .nav {
        width: 100%;
        justify-content: center;
        gap: 8px;
    }
    
    .nav-link {
        padding: 10px 16px;
        font-size: 15px;
    }
    
    .nav-link, .btn-primary, .btn-secondary, .btn-logout, .btn-admin {
        /* 移动端按钮更友好 */
        min-height: 44px;
    }
    
    /* 主内容区域 */
    .main-content {
        padding: 20px 0 80px; /* 底部留出批量投票栏空间 */
    }
    
    /* 分页移动端优化 */
    .pagination {
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 10px;
    }
    
    .page-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 8px 10px;
        font-size: 14px;
    }
    
    /* 弹窗移动端优化 */
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 25px 20px;
        margin: 15px;
    }
    
    .form-group input {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 12px;
    }
}

/* 平板适配 - 优化版 */
@media (min-width: 769px) and (max-width: 1024px) {
    .works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    
    .container {
        max-width: 95%;
    }
    
    .header-content {
        padding: 14px 0;
    }
    
    .main-content {
        padding: 25px 0;
    }
}

/* 大屏幕优化 */
@media (min-width: 1441px) {
    .container {
        max-width: 1400px;
    }
    
    .works-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 24px;
    }
}

/* 横屏移动设备 */
@media (max-width: 896px) and (orientation: landscape) {
    .vote-status-bar {
        padding: 8px 0;
    }
    
    .main-content {
        padding: 15px 0 70px;
    }
    
    .batch-vote-bar {
        padding: 10px 15px;
    }
}

/* 打印样式 */
@media print {
    .header, .vote-status-bar, .filter-bar, .batch-vote-bar, .pagination, .select-checkbox {
        display: none !important;
    }
    
    .works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .work-card {
        break-inside: avoid;
    }
}
