/* Task Management Styles - Jira-inspired Design */

/* ===========================
   Inline Task Creation Card
   =========================== */

.task-create-card {
    border: 2px solid #0052cc;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 82, 204, 0.15);
    transition: all 0.2s ease;
}

.task-create-card .card-body {
    position: relative;
}

.task-create-input {
    border: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    flex: 1;
    background-color: transparent;
}

.task-create-input:focus {
    outline: none;
    box-shadow: none;
    background-color: transparent;
}

.task-create-input::placeholder {
    color: #6c757d;
    font-weight: 400;
}

.task-create-icons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.task-create-icons .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: transparent;
    border: none;
    color: #6c757d;
    transition: all 0.2s ease;
}

.task-create-icons .btn-icon:hover {
    background-color: #f4f5f7;
    color: #0052cc;
}

.task-create-icons .btn-icon:active {
    background-color: #e4e6eb;
}

.task-create-due-date {
    font-size: 13px;
    border: 1px solid #dfe1e6;
    border-radius: 4px;
    padding: 6px 10px;
}

.task-create-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 8px;
    margin-bottom: 0;
}

.task-create-hint i {
    margin-right: 4px;
    opacity: 0.7;
}

/* Loading state for task creation */
.task-creating {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.task-creating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #0052cc;
    border-top-color: transparent;
    border-radius: 50%;
    animation: task-spinner 0.6s linear infinite;
}

@keyframes task-spinner {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Success flash animation */
.task-create-success {
    animation: task-success-flash 0.4s ease;
}

@keyframes task-success-flash {
    0% {
        background-color: #e3fcef;
        border-color: #00875a;
    }
    100% {
        background-color: #fff;
        border-color: #0052cc;
    }
}

/* ===========================
   Task Detail Modal Structure
   =========================== */

/* Task Detail Modal - Wider for two-column layout */
#mdl_task_detail .modal-dialog {
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    margin-top: 30px;
    margin-bottom: 0;
}

#mdl_task_detail .modal-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    border-radius: 0;
}

#mdl_task_detail .modal-body {
    padding: 0;
    flex: 1;
    display: flex;
    overflow: hidden;
}

#mdl_task_detail .modal-header {
    flex-shrink: 0;
}

#mdl_task_detail .modal-footer {
    flex-shrink: 0;
}

/* Task Header with ID */
.task-detail-header {
    padding: 20px 24px;
    border-bottom: 2px solid #f4f5f7;
    background-color: #fff;
    position: relative;
}

.task-detail-header .close {
    position: absolute;
    right: 20px;
    top: 20px;
    padding: 0;
    margin: 0;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    color: #000;
    opacity: 0.5;
}

.task-detail-header .close:hover {
    opacity: 0.75;
}

.task-detail-id {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
}

.task-detail-header h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #172b4d;
}

/* Two-Column Layout */
.task-detail-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.task-detail-main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    border-right: 1px solid #e1e4e8;
}

.task-detail-sidebar {
    width: 280px;
    padding: 24px 20px;
    background-color: #f8f9fa;
    border-left: 1px solid #e1e4e8;
    overflow-y: auto;
}

/* ===========================
   Sidebar Metadata Fields
   =========================== */

.task-meta-field {
    margin-bottom: 20px;
}

.task-meta-label {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

.task-meta-value {
    font-size: 14px;
    color: #172b4d;
    font-weight: 500;
}

.task-meta-value.text-muted {
    color: #999 !important;
    font-weight: 400;
}

/* Status Badge in Sidebar */
.task-meta-value .badge {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 3px;
}

/* Status Select Dropdown */
.task-detail-status-select {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    color: white !important;
    padding: 0 10px;
}

.task-detail-status-select option {
    color: #000 !important;
    background-color: #fff !important;
}

/* ===========================
   Main Content Sections
   =========================== */

.task-section {
    margin-bottom: 24px;
}

.task-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #172b4d;
    margin-bottom: 12px;
    display: block;
}

.task-description-content {
    font-size: 14px;
    color: #42526e;
    line-height: 1.6;
    word-wrap: break-word;
    min-height: 20px;
}

/* CKEditor content in description */
.task-description-content p {
    margin: 0 0 8px 0;
}

.task-description-content p:last-child {
    margin-bottom: 0;
}

.task-description-content ul,
.task-description-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.task-description-content img {
    max-width: 100%;
    height: auto;
    border-radius: 3px;
    margin: 8px 0;
}

.task-description-content .mention {
    background-color: #e6f2ff;
    color: #0052cc;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.task-description-content:empty:before {
    content: 'No description provided';
    color: #999;
    font-style: italic;
}

/* Description Editor */
.task-description-editor {
    margin-top: 8px;
}

.task-description-editor textarea {
    font-size: 14px;
    resize: vertical;
}

.task-description-editor .btn {
    margin-right: 8px;
}

/* Subtasks Section (placeholder) */
.task-subtasks-placeholder {
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 3px;
    color: #6c757d;
    font-size: 13px;
    text-align: center;
}

/* ===========================
   Activity Tabs
   =========================== */

.task-activity-section {
    margin-top: 32px;
    border-top: 2px solid #f4f5f7;
    padding-top: 24px;
}

.task-activity-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e1e4e8;
    margin-bottom: 16px;
}

.task-activity-tab {
    padding: 10px 16px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.task-activity-tab:hover {
    color: #007bff;
}

.task-activity-tab.active {
    color: #007bff;
}

.task-activity-tab.active:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #007bff;
}

/* Activity Tab Content */
.task-activity-content {
    display: none;
}

.task-activity-content.active {
    display: block;
}

/* ===========================
   Comments Section
   =========================== */

.task-comments-list {
    margin-bottom: 16px;
}

.task-comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f4f5f7;
}

.task-comment-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.task-comment-avatar {
    flex-shrink: 0;
    display: none;
}

.task-comment-avatar .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.task-comment-content {
    flex: 1;
}

.task-comment-header {
    margin-bottom: 6px;
}

.task-comment-author {
    font-size: 14px;
    font-weight: 600;
    color: #172b4d;
    margin-right: 8px;
}

.task-comment-time {
    font-size: 12px;
    color: #999;
}

.task-comment-body {
    font-size: 14px;
    color: #42526e;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Mention styling */
.task-comment-body .mention {
    background-color: #e6f2ff;
    color: #0052cc;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
}

.task-comment-body .mention:hover {
    background-color: #cce5ff;
}

/* CKEditor content styling */
.task-comment-body p {
    margin: 0 0 8px 0;
}

.task-comment-body p:last-child {
    margin-bottom: 0;
}

.task-comment-body ul,
.task-comment-body ol {
    margin: 8px 0;
    padding-left: 20px;
}

.task-comment-body img {
    max-width: 100%;
    height: auto;
    border-radius: 3px;
    margin: 8px 0;
}

/* Add Comment Form */
#frm_task_comment {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e1e4e8;
}

/* CKEditor wrapper styling */
.ck-editor__editable {
    min-height: 100px !important;
    max-height: 400px;
    overflow-y: auto;
}

.ck-editor__editable_inline {
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
}

#frm_task_comment .form-control {
    font-size: 14px;
    border-radius: 3px;
    border-color: #ddd;
}

#frm_task_comment .btn {
    border-radius: 3px;
}

/* ===========================
   Activity/History Items
   =========================== */

.task-activity-list {
    margin-top: 16px;
}

.task-activity-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f4f5f7;
}

.task-activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.task-activity-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #e1e4e8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #6c757d;
    margin-top: 2px;
}

.task-activity-content-text {
    flex: 1;
    min-width: 0;
}

.task-activity-text {
    font-size: 14px;
    color: #42526e;
    margin-bottom: 4px;
    line-height: 1.5;
}

.task-activity-text .activity-user {
    font-weight: 600;
    color: #172b4d;
}

.task-activity-text .activity-field {
    font-weight: 500;
    color: #007bff;
}

.task-activity-time {
    font-size: 12px;
    color: #999;
}

.task-activity-changes {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 3px;
    font-size: 13px;
}

.task-activity-changes .change-old {
    color: #dc3545;
    text-decoration: line-through;
}

.task-activity-changes .change-new {
    color: #28a745;
    font-weight: 500;
}

/* ===========================
   Attachments Section
   =========================== */

.task-attachments-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e1e4e8;
}

.task-attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.task-attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 3px;
    font-size: 13px;
    color: #172b4d;
    text-decoration: none;
    transition: all 0.2s;
}

.task-attachment-item:hover {
    background-color: #e9ecef;
    text-decoration: none;
    color: #007bff;
}

.task-attachment-item i {
    color: #6c757d;
}

.task-attachment-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===========================
   Empty States
   =========================== */

.task-empty-state {
    padding: 10px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-empty-state i {
    font-size: 20px;
    color: #dee2e6;
    display: block;
}

.task-empty-state p {
    margin: 0;
}

/* Work Log Empty State (special styling) */
.task-worklog-empty {
    padding: 60px 20px;
    text-align: center;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 12px;
}

.task-worklog-empty i {
    font-size: 64px;
    color: #dee2e6;
    margin-bottom: 16px;
    width: 56px;
    height: 64px;
    display: flex;
    margin: 0;
    padding: 0;
    text-align: center;
}

.task-worklog-empty .empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 8px;
}

.task-worklog-empty .empty-description {
    font-size: 14px;
    color: #999;
}

/* ===========================
   Modal Footer
   =========================== */

#mdl_task_detail .modal-footer {
    padding: 15px;
    border-top: 1px solid #dee2e6;
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    #mdl_task_detail .modal-dialog {
        max-width: 100%;
        margin: 0;
    }

    .task-detail-container {
        flex-direction: column;
    }

    .task-detail-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e1e4e8;
        max-height: none;
    }

    .task-detail-main {
        max-height: none;
    }

    .task-activity-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .task-activity-tab {
        white-space: nowrap;
    }
}

/* ===========================
   Utility Classes
   =========================== */

.task-badge-priority-low {
    background-color: #28a745;
    color: white;
}

.task-badge-priority-medium {
    background-color: #ffc107;
    color: #212529;
}

.task-badge-priority-high {
    background-color: #dc3545;
    color: white;
}

.task-badge-priority-urgent {
    background-color: #6f42c1;
    color: white;
}

.badge-purple {
    background-color: #6f42c1;
    color: white;
}

.task-divider {
    height: 1px;
    background-color: #e1e4e8;
    margin: 24px 0;
}
/* ===========================
   Tasks Container & Cards
   =========================== */

.tasks-container {
    height: 100%;
}

.task-card {
    border-left: 4px solid #3B82F6;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.task-card.task-upcoming {
    background-color: #F9FAFB;
}

.task-card.task-upcoming::before {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background-color: #8B5CF6;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    display: none;
}

.task-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.task-upcoming-badge {
    display: inline-block;
    background-color: #8B5CF6;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.task-card .task-title {
    font-weight: 600;
}

.task-card .task-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-status-select {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: none;
}

.task-actions .btn {
    padding: 0.25rem;
}

.activity-item {
    border-left-color: #3B82F6 !important;
}

/* ===========================
   Work Log Styles
   =========================== */

.task-worklog-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 10px;
}

.task-worklog-list {
    max-height: 400px;
    overflow-y: auto;
}

.task-worklog-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.task-worklog-item:hover {
    background-color: #f8f9fa;
}

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

.task-worklog-avatar {
    flex-shrink: 0;
    display: none;
}

.task-worklog-avatar .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.task-worklog-content {
    flex: 1;
    min-width: 0;
}

.task-worklog-content .task-worklog-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.task-worklog-author {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.task-worklog-time {
    color: #6c757d;
    font-size: 12px;
}

.task-worklog-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-worklog-item:hover .task-worklog-actions {
    opacity: 1;
}

.task-worklog-actions .btn-icon {
    padding: 2px 6px;
    font-size: 11px;
}

.task-worklog-details {
    display: flex;
    gap: 16px;
    margin-bottom: 4px;
    font-size: 12px;
}

.task-worklog-time-spent {
    color: #3B82F6;
    font-weight: 600;
}

.task-worklog-date-started {
    color: #6c757d;
}

.task-worklog-description {
    color: #555;
    font-size: 13px;
    line-height: 1.4;
    margin-top: 4px;
    white-space: pre-wrap;
}

/* Time Tracking Sidebar */
.task-time-tracking {
    margin-top: 8px;
}

.task-time-tracking .task-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 8px;
    display: block;
}

/* ===========================
   Estimated Time Inline Edit
   =========================== */

.task-estimated-time-section {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e4e8;
}

.task-estimated-label {
    flex: 1;
}

.task-estimated-value-container {
    display: flex;
    align-items: center;
}

.task-estimated-value {
    font-size: 14px;
    font-weight: 600;
    color: #3B82F6;
}

.task-estimated-value.text-muted {
    color: #999 !important;
    font-weight: 400;
}

.task-estimated-editor {
    max-width: 300px;
}

.task-estimated-editor-sidebar {
    margin-top: 4px;
}

.task-estimated-editor-sidebar .form-control {
    font-size: 12px;
}

#btn_edit_estimated_worklog,
#btn_edit_estimated_sidebar {
    color: #6c757d;
    opacity: 0.6;
    transition: opacity 0.2s;
}

#btn_edit_estimated_worklog:hover,
#btn_edit_estimated_sidebar:hover {
    opacity: 1;
    color: #007bff;
}

/* Comment attachments */
.task-comment-attachments {
    border-top: 1px solid #e9ecef;
    padding-top: 8px;
    margin-top: 8px;
}

.task-comment-attachment-item {
    display: inline-block;
    margin-right: 12px;
    margin-bottom: 4px;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #495057;
    text-decoration: none;
    transition: background 0.2s;
}

.task-comment-attachment-item:hover {
    background: #e9ecef;
    color: #212529;
    text-decoration: none;
}

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

#comment_attachments_preview {
    min-height: 0;
}

.comment-attachment-uploading,
.comment-attachment-uploaded {
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    display: inline-block;
    margin-right: 8px;
}

.comment-attachment-uploaded .fa-file {
    color: #28a745;
}

.remove-comment-attachment {
    font-size: 0.75rem;
}
