/**
 * Zibll 任务系统 - 前台样式
 * 复用子比 main.css 变量与工具类，自动适配亮色/暗色主题
 */

/* 容器 */
.zbs-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Tab 导航 */
.zbs-tabs {
    border-bottom: 2px solid var(--main-border-color);
    margin-bottom: 20px;
    gap: 0;
}

.zbs-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    font-size: 15px;
    color: var(--muted-color);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.zbs-tab:hover {
    color: var(--theme-color);
}

.zbs-tab.active {
    color: var(--theme-color);
    border-bottom-color: var(--theme-color);
    font-weight: bold;
}

/* 任务卡片网格 */
.zbs-task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.zbs-task-card {
    background: var(--main-bg-color);
    border-radius: var(--main-radius);
    box-shadow: var(--main-shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.zbs-task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* 封面 */
.zbs-task-cover {
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.zbs-task-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 卡片内容 */
.zbs-task-body {
    padding: 16px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.zbs-task-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--main-color);
    margin: 0;
    line-height: 1.4;
}

.zbs-task-desc {
    font-size: 13px;
    color: var(--muted-color);
    margin: 8px 0 0;
    line-height: 1.6;
}

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

.zbs-meta-item {
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.zbs-task-actions {
    margin-top: auto;
    padding-top: 12px;
}

/* ===== 自定义按钮样式（不依赖子比 btn-theme/btn-blue） ===== */
.zbs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    border: none;
    border-radius: var(--main-radius, 6px);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    vertical-align: middle;
    user-select: none;
}

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

/* 主题色按钮 */
.zbs-btn-primary {
    background: var(--theme-color, #3b82f6);
    color: #fff !important;
}
.zbs-btn-primary:hover:not(:disabled) {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 蓝色按钮 */
.zbs-btn-blue {
    background: #3b82f6;
    color: #fff !important;
}
.zbs-btn-blue:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
}

/* 绿色按钮 */
.zbs-btn-green {
    background: #52c41a;
    color: #fff !important;
}
.zbs-btn-green:hover:not(:disabled) {
    background: #49b018;
}

/* 黄色按钮（状态标签用） */
.zbs-btn-yellow {
    background: rgba(250, 173, 20, 0.15);
    color: #faad14 !important;
    cursor: default;
}

/* 绿色状态标签 */
.zbs-btn-status-green {
    background: rgba(82, 196, 26, 0.15);
    color: #52c41a !important;
    cursor: default;
}

/* 灰色按钮（已截止/名额已满等） */
.zbs-btn-gray {
    background: var(--muted-bg-color, #f5f5f5);
    color: var(--muted-2-color, #999) !important;
    cursor: default;
}

/* 灰色边框按钮（查看详情等） */
.zbs-btn-outline {
    background: transparent;
    color: var(--main-color, #333) !important;
    border: 1px solid var(--main-border-color, #e8e8e8);
}
.zbs-btn-outline:hover:not(:disabled) {
    border-color: var(--theme-color, #3b82f6);
    color: var(--theme-color, #3b82f6) !important;
}

/* 奖励徽标 */
.zbs-reward-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.zbs-reward-points {
    background: rgba(250, 173, 20, 0.12);
    color: #faad14;
}

.zbs-reward-balance {
    background: rgba(24, 144, 255, 0.12);
    color: #1890ff;
}

.zbs-reward-cash {
    background: rgba(245, 34, 45, 0.12);
    color: #f5222d;
}

/* 状态徽标 */
.zbs-status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.zbs-status-pending {
    background: rgba(250, 173, 20, 0.12);
    color: #faad14;
}

.zbs-status-approved {
    background: rgba(82, 196, 26, 0.12);
    color: #52c41a;
}

.zbs-status-rejected {
    background: rgba(245, 34, 45, 0.12);
    color: #f5222d;
}

/* 空状态 */
.zbs-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted-2-color);
}

.zbs-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.zbs-empty p {
    font-size: 15px;
    margin: 0 0 15px;
}

/* 我的提交记录 */
.zbs-submission-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.zbs-submission-card {
    background: var(--main-bg-color);
    border-radius: var(--main-radius);
    box-shadow: var(--main-shadow);
    padding: 18px 20px;
}

.zbs-reject-reason {
    background: rgba(245, 34, 45, 0.06);
    border-left: 3px solid #f5222d;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--main-color);
}

/* 文件预览网格 */
.zbs-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.zbs-file-preview {
    border-radius: var(--main-radius);
    overflow: hidden;
    background: var(--muted-bg-color);
}

.zbs-file-preview.image img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.zbs-file-preview.image img:hover {
    transform: scale(1.05);
}

.zbs-file-preview.video video {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.zbs-file-preview.document {
    padding: 12px;
    text-align: center;
}

.zbs-file-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--muted-color);
}

.zbs-file-icon {
    display: inline-block;
    padding: 8px 12px;
    background: var(--theme-color);
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.zbs-file-name {
    font-size: 12px;
    word-break: break-all;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zbs-file-size {
    font-size: 11px;
    color: var(--muted-3-color);
    text-align: center;
}

/* 上传表单 */
.zbs-upload-form {
    padding: 5px 0;
}

.zbs-task-summary {
    border-radius: var(--main-radius);
}

.zbs-upload-zone {
    border: 2px dashed var(--main-border-color);
    border-radius: var(--main-radius);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--muted-bg-color);
}

.zbs-upload-zone:hover,
.zbs-upload-zone.dragover {
    border-color: var(--theme-color);
    background: rgba(var(--theme-color-rgb, 24, 144, 255), 0.04);
}

.zbs-upload-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.zbs-upload-placeholder p {
    margin: 4px 0;
    color: var(--muted-color);
    font-size: 14px;
}

/* 上传文件列表 */
.zbs-upload-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zbs-upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--muted-bg-color);
    border-radius: var(--main-radius);
    transition: all 0.2s;
}

.zbs-upload-item.uploading {
    opacity: 0.7;
}

.zbs-upload-item .zbs-file-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--main-border-color);
}

.zbs-upload-item .zbs-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zbs-upload-item .zbs-file-thumb .zbs-file-thumb-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.zbs-upload-item-info {
    flex: 1;
    min-width: 0;
}

.zbs-upload-item-name {
    font-size: 13px;
    color: var(--main-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zbs-upload-item-size {
    font-size: 11px;
    color: var(--muted-3-color);
}

.zbs-upload-item-status {
    font-size: 12px;
}

.zbs-upload-item .zbs-remove-file {
    color: var(--muted-2-color);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.zbs-upload-item .zbs-remove-file:hover {
    color: #f5222d;
}

/* 文本域 */
.zbs-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--main-border-color);
    border-radius: var(--main-radius);
    background: var(--main-bg-color);
    color: var(--main-color);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}

.zbs-textarea:focus {
    outline: none;
    border-color: var(--theme-color);
}

/* 上传进度条 */
.zbs-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--muted-bg-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.zbs-progress-bar-fill {
    height: 100%;
    background: var(--theme-color);
    transition: width 0.3s;
    border-radius: 2px;
}

/* 响应式 */
@media (max-width: 768px) {
    .zbs-task-grid {
        grid-template-columns: 1fr;
    }

    .zbs-tab {
        padding: 8px 16px;
        font-size: 14px;
    }

    .zbs-files-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
}

/* 暗色主题适配 */
body.dark-theme .zbs-reward-points {
    background: rgba(250, 173, 20, 0.2);
}

body.dark-theme .zbs-reward-balance {
    background: rgba(24, 144, 255, 0.2);
}

body.dark-theme .zbs-reward-cash {
    background: rgba(245, 34, 45, 0.2);
}

body.dark-theme .zbs-upload-zone {
    background: rgba(255, 255, 255, 0.03);
}

/* ===== 自定义弹窗 ===== */
.zbs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 20px;
}

.zbs-modal-overlay.zbs-modal-show {
    background: rgba(0, 0, 0, 0.5);
}

.zbs-modal-box {
    background: var(--main-bg-color, #fff);
    border-radius: 12px;
    width: 100%;
    max-width: 550px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.2s;
}

.zbs-modal-overlay.zbs-modal-show .zbs-modal-box {
    transform: scale(1);
    opacity: 1;
}

.zbs-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--main-border-color, #eee);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.zbs-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: var(--main-color, #333);
}

.zbs-modal-close {
    cursor: pointer;
    font-size: 24px;
    color: var(--muted-2-color, #999);
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
    user-select: none;
}

.zbs-modal-close:hover {
    color: var(--main-color, #333);
}

.zbs-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ===== Toast 提示（无 notyf 时的回退） ===== */
.zbs-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 999999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: #52c41a;
    max-width: 350px;
    word-break: break-all;
}

/* ===== 响应式弹窗 ===== */
@media (max-width: 600px) {
    .zbs-modal-box {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 8px;
    }

    .zbs-modal-overlay {
        padding: 10px;
    }
}

/* ===== 弹窗内 Loading ===== */
.zbs-modal-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted-color);
}

.zbs-modal-loading p {
    margin-top: 12px;
    font-size: 14px;
}

.zbs-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--main-border-color, #e8e8e8);
    border-top-color: var(--theme-color, #3b82f6);
    border-radius: 50%;
    margin: 0 auto;
    animation: zbs-spin 0.8s linear infinite;
}

@keyframes zbs-spin {
    to { transform: rotate(360deg); }
}

/* ===== 任务描述展开/收起 ===== */
.zbs-task-desc-wrap {
    margin-top: 8px;
}

.zbs-task-desc.zbs-desc-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zbs-desc-toggle {
    display: inline-block;
    margin-top: 4px;
    font-size: 13px;
    color: var(--theme-color, #3b82f6);
    cursor: pointer;
    user-select: none;
}

.zbs-desc-toggle:hover {
    opacity: 0.8;
}
