﻿/* ==================== 任务管理模块 ==================== */

.task-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-page > .card.no-hover {
    overflow: visible;
    z-index: 20;
}

.task-page > .card.no-hover .card-header {
    overflow: visible;
}

.task-page-header {
    display: grid;
    grid-template-columns: minmax(560px, 1fr) auto;
    align-items: center;
    gap: 14px;
}

.task-main-tabs {
    margin: 0;
    justify-self: end;
    align-self: center;
}

.task-main-tabs .tab-btn {
    min-width: 88px;
}

.task-quick-create {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 10px;
    align-items: center;
}

.task-quick-create-in-header {
    width: 100%;
    max-width: none;
    justify-self: stretch;
    padding: 5px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: rgba(244, 247, 255, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.task-quick-create input,
.task-quick-create select {
    width: 100%;
    margin: 0;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(22, 29, 55, 0.08);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: none;
}

#taskQuickTitle {
    padding-left: 14px;
}

.task-quick-create input:focus,
.task-quick-create select:focus {
    background: #fff;
}

.task-quick-create #taskQuickCreateBtn {
    height: 38px;
    border-radius: 10px;
    padding-left: 14px;
    padding-right: 14px;
}

#taskQuickProject {
    display: none;
}

.task-project-picker {
    position: relative;
    min-width: 220px;
}

.task-picker-trigger {
    width: 100%;
    height: 38px;
    border: 1px solid rgba(22, 29, 55, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
    font-size: 14px;
}

.task-picker-trigger:hover {
    border-color: rgba(59, 130, 246, 0.28);
    background: #fff;
}

.task-project-picker.open .task-picker-trigger {
    border-color: var(--primary);
    box-shadow: var(--ring);
    background: #fff;
}

.task-picker-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-picker-caret {
    color: var(--text-tertiary);
    font-size: 12px;
    transition: transform 0.2s ease;
}

.task-project-picker.open .task-picker-caret {
    transform: rotate(180deg);
}

.task-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    padding: 10px 10px 12px;
    z-index: 120;
    max-height: 340px;
    overflow-y: auto;
    display: none;
}

.task-project-picker.open .task-picker-menu {
    display: block;
}

.task-picker-group + .task-picker-group {
    margin-top: 10px;
}

.task-picker-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
}

.task-picker-group-active {
    background: #e7f7ef;
    color: #0f766e;
}

.task-picker-group-paused {
    background: #fff7e5;
    color: #b45309;
}

.task-picker-group-longterm {
    background: #e8f4ff;
    color: #1e40af;
}

.task-picker-option {
    width: 100%;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.35;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}

.task-picker-option:hover {
    background: #eef4ff;
    color: #1e40af;
}

.task-picker-option.active {
    background: #e4edff;
    color: #1d4ed8;
    font-weight: 600;
}

.task-picker-option-default {
    background: #f5f3ff;
    color: #6d28d9;
    font-weight: 600;
    margin-bottom: 10px;
}

.task-picker-option-default:hover {
    background: #ede9fe;
    color: #5b21b6;
}

.task-picker-option-default.active {
    background: #e9e3ff;
    color: #5b21b6;
}

.task-picker-status-active:hover {
    background: #e8f7ef;
    color: #0f766e;
}

.task-picker-status-paused:hover {
    background: #fff6e8;
    color: #b45309;
}

.task-picker-status-longterm:hover {
    background: #edf4ff;
    color: #1e40af;
}

.task-picker-status-active.active {
    background: #dbf3e7;
    color: #0f766e;
}

.task-picker-status-paused.active {
    background: #ffefcf;
    color: #b45309;
}

.task-picker-status-longterm.active {
    background: #dfeeff;
    color: #1e40af;
}

.task-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.task-col {
    min-width: 0;
}

.task-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-col-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.task-check-col {
    width: 58px;
    text-align: center;
}

.task-ops-col {
    text-align: right;
    white-space: nowrap;
}

.task-col-right {
    text-align: right !important;
}

.task-col-priority {
    width: 72px;
    white-space: nowrap;
}

.task-col-created,
.task-col-due {
    width: 86px;
    white-space: nowrap;
}

.task-col-archived {
    width: 106px;
    white-space: nowrap;
}

.task-title-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    line-height: 1.45;
    color: var(--text-primary);
    word-break: break-word;
}

.task-title-btn {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.task-title-btn:hover {
    color: var(--primary);
}

.task-row-desc {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-tertiary);
    word-break: break-word;
}

.task-project-line {
    display: flex;
    align-items: center;
}

.task-project-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid rgba(14, 116, 144, 0.18);
    background: #eef7ff;
    color: #0369a1;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
}

.task-date-cell {
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.task-row-toggle td {
    cursor: pointer;
}

.task-empty-row {
    text-align: center;
    padding: 22px 8px;
    color: var(--text-tertiary);
}

.task-action-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.task-list-table .task-ops-col,
.task-archive-table .task-ops-col {
    text-align: right;
    padding-right: 8px;
}

.task-list-table th,
.task-list-table td {
    text-align: center;
    vertical-align: middle;
}

.task-list-table th:nth-child(2),
.task-list-table td:nth-child(2) {
    text-align: left;
}

.task-list-table .task-ops-col {
    text-align: center;
    padding-right: 0;
}

.task-list-table .task-col-right {
    text-align: center !important;
}

.task-list-table .task-ops-col .task-action-group {
    display: flex;
    justify-content: center;
    width: 100%;
}

.task-list-table .task-check-col {
    width: 52px;
}

.task-list-table .task-col-priority,
.task-list-table .task-col-created,
.task-list-table .task-col-due,
.task-list-table .task-ops-col {
    width: 78px;
    white-space: nowrap;
}

.task-list-table th,
.task-list-table td {
    padding-left: 8px;
    padding-right: 8px;
}

.task-archive-table .task-col-created,
.task-archive-table .task-col-archived,
.task-archive-table .task-col-due {
    width: 110px;
}

.task-archive-table .task-ops-col {
    width: 220px;
}

.task-action-btn {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    transition: var(--transition-fast);
}

#taskEditDeleteBtn {
    margin-right: auto;
}

.task-edit-btn {
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.26);
}

.task-edit-btn:hover {
    background: rgba(37, 99, 235, 0.1);
}

.task-archive-btn {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.26);
}

.task-archive-btn:hover {
    background: rgba(217, 119, 6, 0.1);
}

.task-unarchive-btn {
    color: #0284c7;
    border-color: rgba(2, 132, 199, 0.28);
}

.task-unarchive-btn:hover {
    background: rgba(2, 132, 199, 0.1);
}

.task-del-btn {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.28);
}

.task-del-btn:hover {
    background: rgba(220, 38, 38, 0.1);
}

.task-done-row {
    opacity: 0.62;
}

.task-done-text {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.task-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.task-archive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.task-source-filters,
.task-date-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.task-date-filters select,
.task-date-filters input {
    width: auto;
    min-width: 128px;
}

.task-date-sep {
    color: var(--text-tertiary);
    font-size: 13px;
}

@media (max-width: 1200px) {
    .task-two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .task-page-header {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .task-quick-create {
        grid-template-columns: 1fr;
    }

    .task-main-tabs {
        width: 100%;
        justify-self: stretch;
    }

    .task-main-tabs .tab-btn {
        min-width: 0;
        flex: 1;
    }

    .task-ops-col {
        width: 110px;
    }

    .task-edit-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .task-source-filters,
    .task-date-filters {
        width: 100%;
    }

    .task-date-filters select,
    .task-date-filters input,
    .task-date-filters button {
        width: 100%;
    }

    .task-date-sep {
        display: none;
    }

    .task-action-group {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .task-action-btn {
        width: 100%;
    }
}
