/*
- 开发时间：2026-07-03
- 更新时间：2026-07-06
- 文件作用：cloudPrompt「1点01」任务管理页面专属样式
- 实现原理：列表视图（工具栏 + 状态 tab + 任务卡片含执行中进度圆圈）和详情视图（6 段）样式；
            任务卡片左侧色条按优先级标识（high红#dc3545 / medium黄#f57c00 / low蓝#1976d2）；
            已完成任务卡片置灰 + 标题划线；
            详情页子任务：按 seq 整数分组收拢/展开（带标题+全部完成自动收拢）、seq 徽章双击重命名（max 10 字符）；
            详情页标题双击重命名；新增子任务栏置于顶部含序号输入
- 如何调用：由 tasks.html 通过 <link rel="stylesheet" href="tasks.css"> 引入
- 所属流程：cloudPrompt 任务管理流程（1点01）
*/

/* 工具栏：横向排列新建按钮 + 计数提示 */
.task-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
}
.task-count-tip {
    font-size: 12px;
    color: #666;
}
/* 状态 tab 按钮组 */
.task-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px 0;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
}
.task-tab {
    padding: 6px 18px;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background-color: #f0f0f0;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}
.task-tab.active {
    background-color: #fff;
    color: #1a237e;
    font-weight: bold;
    border-color: #1a237e;
}
/* 任务列表容器 */
.task-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* 空状态提示 */
.empty-tip {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 20px 12px;
    background-color: #fff;
    border-radius: 6px;
    border: 1px dashed #ddd;
}
/* 单个任务卡片：左侧色条 + 进度圆圈(进行中) + 标题 + 元信息 */
.task-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 10px 18px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.task-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
/* 任务卡片主体（标题+元信息纵向） */
.task-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
/* 左侧优先级色条 */
.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 6px 0 0 6px;
}
.task-card.priority-high::before { background-color: #dc3545; }
.task-card.priority-medium::before { background-color: #f57c00; }
.task-card.priority-low::before { background-color: #1976d2; }
/* 任务卡片标题 */
.task-card-title {
    font-size: 14px;
    color: #222;
    font-weight: 500;
}
/* 已完成任务：置灰 + 划线 */
.task-card.status-done .task-card-title {
    color: #999;
    text-decoration: line-through;
}
.task-card.status-done {
    opacity: 0.6;
}
/* 任务卡片元信息（优先级 + 创建时间 + 子任务进度） */
.task-card-meta {
    font-size: 11px;
    color: #888;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.task-card-meta .meta-priority {
    font-weight: bold;
}
.priority-high .meta-priority { color: #dc3545; }
.priority-medium .meta-priority { color: #f57c00; }
.priority-low .meta-priority { color: #1976d2; }

/* 详情视图工具栏 */
.detail-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background-color: #fff;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}
.btn-back {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
}
.btn-back:hover { background-color: #e0e0e0; }

/* 任务详情容器：6 段纵向排列 */
.task-detail {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
/* 详情头部：标题 + 元信息 */
.detail-header {
    background-color: #fff;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}
.detail-title {
    font-size: 18px;
    color: #1a237e;
    margin-bottom: 6px;
    font-weight: bold;
}
.detail-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
/* 进度条 */
.progress-bar-container {
    margin-top: 10px;
}
.progress-label {
    font-size: 13px;
    color: #1a237e;
    font-weight: bold;
    margin-bottom: 4px;
}
.progress-bar {
    width: 100%;
    height: 16px;
    background-color: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1976d2, #4caf50);
    border-radius: 8px;
    transition: width 0.3s ease;
}
/* 闭环标签 */
.meta-closed {
    color: #4caf50;
    font-weight: bold;
}
/* 6 段卡片：目标/拆解/方案/执行/验证/复盘 */
.detail-section {
    background-color: #fff;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}
.section-title {
    font-size: 14px;
    color: #1a237e;
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.section-title .section-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background-color: #1a237e;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
}
.section-desc {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
}
.section-textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
}
.section-save-bar {
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
}
/* 子任务列表 */
.subtask-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.subtask-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background-color: #fafafa;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 13px;
}
.subtask-item.done .subtask-title {
    text-decoration: line-through;
    color: #999;
}
.subtask-item input[type="checkbox"] {
    cursor: pointer;
}
.subtask-item .subtask-title {
    flex: 1;
}
.subtask-item .subtask-del {
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}
.subtask-add-bar {
    display: flex;
    gap: 6px;
}
.subtask-add-bar input {
    flex: 1;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
}
/* 模态对话框 */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background-color: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.modal-header {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: bold;
    color: #1a237e;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-close {
    cursor: pointer;
    font-size: 20px;
    color: #999;
    line-height: 1;
}
.modal-close:hover { color: #dc3545; }
.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.form-label {
    font-size: 12px;
    color: #555;
    margin-top: 6px;
}
.form-input, .form-textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
    box-sizing: border-box;
    font-family: inherit;
}
.form-textarea {
    min-height: 80px;
    resize: vertical;
}
.btn-cancel {
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f0f0f0;
    cursor: pointer;
    font-size: 13px;
}
.btn-cancel:hover { background-color: #e0e0e0; }

/* ===== 进度圆圈（列表视图进行中任务） ===== */
.progress-circle-wrap { width: 38px; height: 38px; flex-shrink: 0; position: relative; }
.progress-circle-wrap svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.progress-circle-bg { fill: none; stroke: #e0e0e0; stroke-width: 4; }
.progress-circle-fg { fill: none; stroke: #4caf50; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.progress-circle-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: bold; color: #1a237e; }

/* ===== 详情页标题重命名 ===== */
.detail-title { cursor: pointer; }
.detail-title-input { width: 100%; font-size: 18px; color: #1a237e; font-weight: bold; padding: 4px 6px; border: 2px solid #1a237e; border-radius: 4px; box-sizing: border-box; font-family: inherit; }

/* ===== 子任务序号徽章 + 重命名 ===== */
.subtask-seq { display: inline-block; min-width: 28px; padding: 1px 6px; background-color: #e8eaf6; color: #1a237e; border-radius: 3px; font-size: 11px; font-weight: bold; text-align: center; flex-shrink: 0; }
.subtask-item .subtask-title { cursor: pointer; }
.subtask-title-input { flex: 1; padding: 2px 4px; border: 1px solid #1a237e; border-radius: 3px; font-size: 13px; font-family: inherit; }
.subtask-rename { color: #1976d2; cursor: pointer; font-size: 12px; padding: 0 4px; }
.subtask-rename:hover { color: #0d47a1; }

/* ===== 子任务分组收拢/展开（需求5：收拢组带标题，全部完成自动 collapsed） ===== */
.subtask-group { border: 1px solid #e8eaf6; border-radius: 5px; margin-bottom: 6px; overflow: hidden; }
.subtask-group-header { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background-color: #e8eaf6; cursor: pointer; user-select: none; font-size: 12px; color: #1a237e; font-weight: bold; }
.subtask-group-toggle { display: inline-block; width: 14px; text-align: center; transition: transform 0.2s; }
.subtask-group.collapsed .subtask-group-toggle { transform: rotate(-90deg); }
.subtask-group.collapsed .subtask-group-body { display: none; }
.subtask-group-count { background-color: #1a237e; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 10px; line-height: 16px; flex-shrink: 0; }
/* 需求5：收拢组标题（采用第一个子任务名称），flex:1 占据中间剩余空间 */
.subtask-group-title { flex: 1; font-weight: normal; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtask-group-body { padding: 6px 8px; }
.subtask-group-body .subtask-item { background-color: #fff; margin-bottom: 4px; }
.subtask-group-body .subtask-item:last-child { margin-bottom: 0; }

/* ===== 子任务序号内联重命名输入框（需求3/4：10 字符上限，宽度刚刚好 = 10ch + padding + border） ===== */
.subtask-seq-input { padding: 1px 4px; border: 1px solid #1a237e; border-radius: 3px; font-size: 11px; font-weight: bold; color: #1a237e; font-family: inherit; text-align: center; box-sizing: border-box; }

/* ===== 新增子任务栏（顶部，含序号输入） ===== */
.subtask-add-bar { display: flex; gap: 6px; margin-bottom: 10px; }
.subtask-add-bar input[type="text"] { padding: 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 12px; box-sizing: border-box; }
/* 需求4：新增栏序号输入框宽度 = 10ch + 14px（padding 6px*2 + border 1px*2）刚刚好 10 字符 */
.subtask-add-bar .subtask-seq-input { width: calc(10ch + 14px); flex-shrink: 0; }
.subtask-add-bar .subtask-title-input-main { flex: 1; min-width: 0; }
