/**
 * 任务侧边栏样式
 * 版本：v1.0
 * 日期：2026-01-23
 * 功能：显示任务列表、状态追踪、快速操作
 */

/* ===== 侧边栏容器 ===== */
.task-sidebar {
    position: fixed;
    right: 0;
    top: 56px; /* 导航栏高度 */
    bottom: 0;
    width: 380px;
    background: #fff;
    border-left: 1px solid #dee2e6;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

/* 侧边栏折叠状态 */
.task-sidebar.collapsed {
    transform: translateX(100%); /* 完全隐藏 */
}

/* 侧边栏展开按钮（折叠时显示） */
.task-sidebar-toggle-btn {
    position: fixed;
    right: -50px; /* 默认隐藏 */
    top: 120px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50% 0 0 50%;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
    transition: right 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 5px;
}

/* 折叠时显示展开按钮 */
.task-sidebar.collapsed ~ .task-sidebar-toggle-btn {
    right: 0;
}

.task-sidebar-toggle-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: -3px 3px 12px rgba(0, 0, 0, 0.3);
}

.task-sidebar-toggle-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 11px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    background: #dc3545;
    border: 2px solid #fff;
}

/* ===== 侧边栏头部 ===== */
.task-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.task-sidebar-header h6 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-sidebar-header .badge {
    font-size: 14px;
    padding: 4px 10px;
}

.task-sidebar-header button {
    color: #fff;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 8px;
    transition: background 0.2s;
}

.task-sidebar-header button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.task-sidebar.collapsed .task-sidebar-header button i {
    transform: rotate(180deg);
}

/* ===== 筛选器 ===== */
.task-sidebar-filters {
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.task-sidebar-filters .btn-group {
    width: 100%;
}

.task-sidebar-filters .btn {
    flex: 1;
    font-size: 12px;
    padding: 6px 8px;
}

.task-sidebar-filters .btn i {
    font-size: 11px;
    margin-right: 3px;
}

.task-sidebar-filters .btn .badge {
    margin-left: 5px;
}

.task-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.task-section-header h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

/* ===== 任务列表内容区 ===== */
.task-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

/* 滚动条样式 */
.task-sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.task-sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.task-sidebar-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.task-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== 空状态 ===== */
.task-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.task-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ===== 任务分组（Vendedor视角）===== */
.task-group {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.task-group-header {
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
}

.task-group-header .badge {
    font-size: 11px;
}

/* ===== 任务项（Vendedor视角）===== */
.task-item {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    transition: background 0.2s;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item:hover {
    background: #f8f9fa;
}

.task-item .task-icon {
    font-size: 20px;
    line-height: 1;
}

.task-item .task-info {
    flex: 1;
}

.task-item .task-type {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.task-item .task-meta {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.5;
}

.task-item .task-file {
    margin-top: 8px;
    padding: 8px;
    background: #e7f3ff;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.task-item .task-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

/* 任务状态颜色 */
.task-item.completed {
    opacity: 0.8;
}

.task-item.pending .task-icon {
    color: #ffc107;
}

.task-item.processing .task-icon {
    color: #17a2b8;
}

.task-item.completed .task-icon {
    color: #28a745;
}

.task-item.overdue .task-icon {
    color: #dc3545;
}

/* ===== 任务卡片（Financeiro/Faturamento视角）===== */
.task-card {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #28a745;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 紧急程度边框颜色 */
.task-card.urgent {
    border-left-color: #dc3545;
}

.task-card.warning {
    border-left-color: #ffc107;
}

.task-card.normal {
    border-left-color: #28a745;
}

.task-card.overdue {
    border-left-color: #6c757d;
    opacity: 0.9;
}

/* 任务卡片头部 */
.task-card-header {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.task-priority {
    font-weight: 600;
}

.task-time {
    color: #6c757d;
}

/* 任务卡片主体 */
.task-card-body {
    padding: 15px;
}

.task-card-body h6 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}

.task-details {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

.task-details div {
    margin-bottom: 4px;
}

/* 任务卡片底部 */
.task-card-footer {
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
}

.task-card-footer .btn {
    flex: 1;
    font-size: 13px;
    padding: 6px 12px;
}

/* ===== 已完成任务样式 ===== */
.task-card.completed {
    opacity: 0.7;
    border-left-color: #6c757d;
}

.task-card.completed .task-card-header {
    background: #e9ecef;
}

.task-card.completed h6 {
    text-decoration: line-through;
    color: #6c757d;
}

/* ===== 分组标题 ===== */
.task-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
    margin: 20px 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-section-title:first-child {
    margin-top: 0;
}

/* ===== 时间徽章 ===== */
.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.time-badge.urgent {
    background: #dc3545;
    color: #fff;
    animation: pulse 1.5s infinite;
}

.time-badge.warning {
    background: #ffc107;
    color: #000;
}

.time-badge.normal {
    background: #28a745;
    color: #fff;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .task-sidebar {
        width: 320px;
    }
    
    .task-sidebar.collapsed {
        transform: translateX(280px);
    }
}

@media (max-width: 768px) {
    .task-sidebar {
        width: 100%;
        max-width: 400px;
        right: -100%;
        box-shadow: none;
    }
    
    .task-sidebar.show {
        right: 0;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .task-sidebar.collapsed {
        transform: none;
        right: -100%;
    }
}

/* ===== 加载状态 ===== */
.task-loading {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

.task-loading .spinner-border {
    width: 2rem;
    height: 2rem;
}

/* ===== 统计信息 ===== */
.task-stats {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
}

.task-stat {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 4px;
    background: #f8f9fa;
}

.task-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.task-stat-label {
    display: block;
    color: #6c757d;
    margin-top: 2px;
}
