/**
 * Task Sidebar CSS
 *
 * Styles für die collapsible Task-Sidebar in allen Dashboards.
 *
 * @version 1.0.0
 */

/* ===== Sidebar Container ===== */
.task-sidebar {
    position: fixed;
    top: 60px; /* Header-Höhe */
    right: 0;
    width: 380px;
    height: calc(100vh - 60px);
    background: var(--bg-secondary, #1e293b);
    border-left: 1px solid var(--border-color, #334155);
    z-index: 1000;
    display: flex;
    transition: transform 0.3s ease, width 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.task-sidebar.collapsed {
    transform: translateX(100%);
    width: 0;
}

/* ===== Header Toggle Button (in Dashboard Header) ===== */
.task-sidebar-header-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary, #334155);
    border: 1px solid var(--border-color, #475569);
    border-radius: 6px;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.task-sidebar-header-toggle:hover {
    background: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
    color: white;
}

.task-sidebar-header-toggle.active {
    background: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
    color: white;
}

.task-sidebar-header-toggle .task-toggle-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.task-sidebar-header-toggle.active .task-toggle-arrow {
    transform: rotate(180deg);
}

.task-sidebar-header-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    background: var(--danger-color, #ef4444);
    color: white;
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===== Sidebar Content ===== */
.task-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.task-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #334155);
    background: var(--bg-tertiary, #0f172a);
}

.task-sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary, #f8fafc);
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-sidebar-header h3 i {
    color: var(--primary-color, #3b82f6);
}

.task-sidebar-close {
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1.2rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.task-sidebar-close:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #f8fafc);
}

/* ===== Tabs ===== */
.task-sidebar-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-tertiary, #0f172a);
    border-bottom: 1px solid var(--border-color, #334155);
}

.task-sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.task-sidebar-tab:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
    border-color: var(--primary-color, #3b82f6);
}

.task-sidebar-tab.active {
    background: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
    color: white;
}

.task-sidebar-tab i {
    font-size: 0.9rem;
}

.task-tab-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.task-sidebar-tab.active .task-tab-count {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Panels ===== */
.task-sidebar-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.task-sidebar-panel.active {
    display: flex;
}

.task-list-actions {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #334155);
}

.task-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* ===== Task Items ===== */
.task-item {
    background: var(--bg-tertiary, #0f172a);
    border: 1px solid var(--border-color, #334155);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.task-item:hover {
    border-color: var(--primary-color, #3b82f6);
    transform: translateX(-4px);
    box-shadow: 4px 0 10px rgba(59, 130, 246, 0.2);
}

.task-item.unread {
    border-left: 4px solid var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
}

.task-item-header {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.task-item-title {
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
    margin-bottom: 8px;
    line-height: 1.3;
}

.task-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
}

.task-item-meta i {
    margin-right: 4px;
}

.task-item-author {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    margin-top: 8px;
}

/* ===== Priority & Status Badges ===== */
.task-priority-badge,
.task-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Priority Colors */
.task-priority-badge.priority-low {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.task-priority-badge.priority-normal {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.task-priority-badge.priority-high {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.task-priority-badge.priority-urgent {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Status Colors */
.task-status-badge.status-pending {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.task-status-badge.status-in_progress {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.task-status-badge.status-completed {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.task-status-badge.status-cancelled {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Priority Item Borders */
.task-item.priority-urgent {
    border-left: 4px solid #ef4444;
}

.task-item.priority-high {
    border-left: 4px solid #fb923c;
}

.task-item.unread.priority-urgent,
.task-item.unread.priority-high {
    background: rgba(239, 68, 68, 0.1);
}

/* ===== Empty State ===== */
.task-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted, #64748b);
    text-align: center;
}

.task-empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.task-empty-state span {
    font-size: 0.9rem;
}

/* ===== Task Modal ===== */
.task-modal {
    max-width: 500px;
}

.task-modal.task-detail-modal {
    max-width: 600px;
}

.task-target-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.task-target-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 10px;
    background: var(--bg-tertiary, #0f172a);
    border: 2px solid var(--border-color, #334155);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 80px;
}

.task-target-tile:hover {
    border-color: var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.task-target-tile.selected {
    border-color: var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.task-target-tile.selected .task-target-icon {
    color: var(--primary-color, #3b82f6);
}

.task-target-tile.selected .task-target-label {
    color: var(--primary-color, #3b82f6);
}

.task-target-tile.selected .task-target-check {
    opacity: 1;
    transform: scale(1);
}

.task-target-tile.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.task-target-icon {
    font-size: 1.5rem;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 8px;
    transition: color 0.2s;
}

.task-target-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary, #94a3b8);
    text-align: center;
    transition: color 0.2s;
}

.task-target-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--primary-color, #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.task-target-check i {
    color: white;
    font-size: 0.65rem;
}

/* ===== Task Create Modal ===== */
.task-create-modal {
    max-width: 550px;
}

.task-create-modal .form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.85rem;
}

.task-create-modal .form-group label i {
    color: var(--primary-color, #3b82f6);
    font-size: 0.9rem;
}

/* ===== Checklist Editor ===== */
.task-checklist-editor {
    background: var(--bg-tertiary, #0f172a);
    border: 1px solid var(--border-color, #334155);
    border-radius: 8px;
    padding: 12px;
}

.task-checklist-items-edit {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.task-checklist-item-edit {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-secondary, #1e293b);
    border-radius: 6px;
    margin-bottom: 6px;
}

.task-checklist-item-edit .drag-handle {
    color: var(--text-muted, #64748b);
    cursor: grab;
}

.task-checklist-item-edit .checklist-item-text {
    flex: 1;
    color: var(--text-primary, #f8fafc);
    font-size: 0.9rem;
}

.task-checklist-item-edit .btn-remove-checklist {
    background: none;
    border: none;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.task-checklist-item-edit .btn-remove-checklist:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.task-checklist-add {
    display: flex;
    gap: 8px;
}

.task-checklist-add .form-input {
    flex: 1;
}

/* ===== Task Detail ===== */
.task-detail-header-info {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.task-detail-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.task-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
}

.task-detail-meta i {
    color: var(--primary-color, #3b82f6);
    margin-right: 4px;
}

.task-detail-meta strong {
    color: var(--text-primary, #f8fafc);
}

.task-detail-due {
    color: var(--warning-color, #fb923c);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.task-detail-due i {
    margin-right: 6px;
}

.task-detail-created {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
}

.task-detail-created i {
    margin-right: 6px;
}

.task-detail-description {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.task-detail-description h4 {
    color: var(--text-primary, #f8fafc);
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-detail-description h4 i {
    color: var(--primary-color, #3b82f6);
}

.task-detail-description p {
    color: var(--text-secondary, #94a3b8);
    margin: 0;
    line-height: 1.6;
    white-space: pre-wrap;
    font-size: 0.9rem;
}

/* ===== Checklist in Detail View ===== */
.task-detail-checklist {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.task-detail-checklist h4 {
    color: var(--text-primary, #f8fafc);
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-detail-checklist h4 i {
    color: var(--success-color, #22c55e);
}

.task-checklist-items {
    margin-bottom: 12px;
}

.task-checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color, #334155);
    cursor: pointer;
    transition: all 0.2s;
}

.task-checklist-item:last-child {
    border-bottom: none;
}

.task-checklist-item:hover {
    background: rgba(59, 130, 246, 0.05);
}

.task-checklist-item input[type="checkbox"] {
    display: none;
}

.task-checklist-item .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #475569);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.task-checklist-item input:checked + .checkmark {
    background: var(--success-color, #22c55e);
    border-color: var(--success-color, #22c55e);
}

.task-checklist-item input:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

.task-checklist-item .checklist-text {
    flex: 1;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.task-checklist-item.completed .checklist-text {
    text-decoration: line-through;
    color: var(--text-muted, #64748b);
}

.task-checklist-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-checklist-progress .progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color, #334155);
    border-radius: 3px;
    overflow: hidden;
}

.task-checklist-progress .progress-fill {
    height: 100%;
    background: var(--success-color, #22c55e);
    transition: width 0.3s ease;
}

.task-checklist-progress .progress-text {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    min-width: 35px;
}

/* ===== Comments ===== */
.task-detail-comments h4 {
    color: var(--text-primary, #f8fafc);
    margin: 0 0 12px 0;
    font-size: 0.95rem;
}

.task-comments-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.task-comments-list .no-comments {
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
    font-style: italic;
}

.task-comment {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.task-comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.task-comment-author {
    color: var(--primary-color, #3b82f6);
    font-weight: 500;
    font-size: 0.85rem;
}

.task-comment-time {
    color: var(--text-muted, #64748b);
    font-size: 0.75rem;
}

.task-comment-text {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    line-height: 1.5;
}

.task-comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-comment-form textarea {
    width: 100%;
    min-height: 70px;
    padding: 10px 12px;
    background: var(--bg-tertiary, #0f172a);
    border: 1px solid var(--border-color, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.9rem;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

.task-comment-form textarea:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.task-comment-form textarea::placeholder {
    color: var(--text-muted, #64748b);
}

.task-comment-form .btn {
    align-self: flex-end;
}

/* ===== Task Detail Footer Buttons ===== */
.modal-footer .btn-info {
    background: #0ea5e9;
    color: white;
    border: none;
}

.modal-footer .btn-info:hover {
    background: #0284c7;
}

.task-completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.task-completed-badge i {
    font-size: 1rem;
}

/* Modal Footer Button Layout */
#task-detail-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

#task-detail-footer .btn {
    min-width: auto;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .task-sidebar {
        width: 100%;
        max-width: 100%;
    }

    .task-sidebar-header-toggle {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .task-sidebar-header-toggle span:not(.task-sidebar-header-badge) {
        display: none;
    }

    .task-target-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .task-target-tile {
        padding: 12px 8px;
        min-height: 70px;
    }

    .task-target-icon {
        font-size: 1.25rem;
    }

    .task-target-label {
        font-size: 0.7rem;
    }
}

/* ===== Scrollbar Styling ===== */
.task-list::-webkit-scrollbar,
.task-comments-list::-webkit-scrollbar {
    width: 6px;
}

.task-list::-webkit-scrollbar-track,
.task-comments-list::-webkit-scrollbar-track {
    background: transparent;
}

.task-list::-webkit-scrollbar-thumb,
.task-comments-list::-webkit-scrollbar-thumb {
    background: var(--border-color, #334155);
    border-radius: 3px;
}

.task-list::-webkit-scrollbar-thumb:hover,
.task-comments-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #64748b);
}
