/* Checklist Manager Styles - v18 */

/* Hierarchical Tree Structure */
.checklist-tree {
    padding: 1rem 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: transparent;
}

.tree-item {
    position: relative;
    margin: 0;
    line-height: 1.8;
}

.tree-item-content {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    min-height: 2rem;
    position: relative;
    flex-wrap: nowrap;
}

.tree-item-content .drag-handle {
    order: -1; /* Place drag handle before toggle icon */
}

.tree-item-content:hover {
    background-color: #f8f9fa;
}

/* Root: Checklist */
.tree-root {
    margin-bottom: 0.5rem;
}

.tree-root .tree-item-content {
    font-weight: 600;
    font-size: 1.15rem;
    padding: 0.5rem 0;
    background-color: transparent;
    border: none;
    margin-bottom: 0.25rem;
}

.tree-root .tree-item-label {
    font-weight: 600;
    color: #212529;
}

/* Group level */
.tree-group {
    position: relative;
    margin-left: 0;
    padding-left: 0;
    margin-bottom: 0.5rem;
}

.tree-group .tree-item-content {
    padding-left: 0.5rem;
    font-weight: 600;
    font-size: 1.05rem;
    color: #0d6efd;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
}

.tree-group .tree-item-label {
    font-weight: 600;
    color: #0d6efd;
    margin-left: 0.5rem;
}

.group-toggle {
    cursor: pointer;
    color: #0d6efd;
    width: 1.25rem;
    min-width: 1.25rem;
    text-align: center;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    pointer-events: auto;
    user-select: none;
}

.group-toggle:hover {
    color: #0056b3;
    background-color: #e7f1ff;
    border-radius: 0.25rem;
}

/* Category level */
.tree-category {
    position: relative;
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 1px solid #e9ecef;
}

.tree-category .tree-item-content {
    padding-left: 0.5rem;
    font-weight: 500;
    font-size: 1rem;
    color: #6f42c1;
}

.tree-category .tree-item-label {
    font-weight: 500;
    color: #6f42c1;
    margin-left: 0.5rem;
}

/* Sub Category level */
.tree-subcategory {
    position: relative;
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 1px solid #e9ecef;
}

.tree-subcategory .tree-item-content {
    padding-left: 0.5rem;
    font-weight: 400;
    font-size: 0.95rem;
    color: #495057;
}

.tree-subcategory .tree-item-label {
    margin-left: 0.5rem;
}

/* Task level */
.tree-task {
    position: relative;
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 1px solid #e9ecef;
}

.tree-task .tree-item-content {
    padding-left: 0.5rem;
    font-weight: 400;
    font-size: 0.9rem;
    color: #495057;
}

.tree-task .tree-item-label {
    color: #495057;
    margin-left: 0.5rem;
}

/* Inactive items styling */
.tree-item-content.inactive {
    opacity: 0.6;
}

/* Maintain color distinction for inactive items but with reduced opacity */
.tree-group .tree-item-content.inactive .tree-item-label {
    color: #0d6efd;
}

.tree-category .tree-item-content.inactive .tree-item-label {
    color: #6f42c1;
}

.tree-task .tree-item-content.inactive .tree-item-label {
    color: #495057;
}

.tree-item-content.inactive .category-toggle,
.tree-item-content.inactive .subcategory-toggle,
.tree-item-content.inactive .group-toggle {
    opacity: 0.6;
}

/* Tree item label */
.tree-item-label {
    user-select: none;
    margin-right: 0.5rem;
}

/* Tree item actions - always visible, inline with text */
.tree-item-actions {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
    margin-left: 0.5rem;
    opacity: 1;
    vertical-align: middle;
}

.tree-action-btn {
    padding: 0.15rem 0.3rem;
    color: #6c757d;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    border-radius: 0.25rem;
    line-height: 1;
}

.tree-action-btn:hover {
    color: #0d6efd;
    background-color: #e7f1ff;
}

.tree-action-btn.delete-category-btn:hover,
.tree-action-btn.delete-subcategory-btn:hover,
.tree-action-btn.delete-task-btn:hover {
    color: #dc3545;
    background-color: #fff5f5;
}

.tree-action-btn i {
    font-size: 0.875rem;
}

/* Toggle icons (arrows) */
.category-toggle,
.subcategory-toggle {
    cursor: pointer;
    color: #6f42c1;
    width: 1.25rem;
    min-width: 1.25rem;
    text-align: center;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.category-toggle:hover,
.subcategory-toggle:hover {
    color: #5a32a3;
    background-color: #f3e8ff;
    border-radius: 0.25rem;
}

/* Tree children container */
.tree-children {
    margin-left: 0;
    position: relative;
    display: block;
    visibility: visible;
}

.tree-group .tree-children {
    margin-left: 0;
    padding-left: 1.5rem;
    border-left: 1px solid #e9ecef;
    display: block;
}

.tree-category .tree-children {
    margin-left: 0;
    padding-left: 1.5rem;
    border-left: 1px solid #e9ecef;
    display: block;
}

.tree-subcategory .tree-children {
    margin-left: 0;
    padding-left: 1.5rem;
    border-left: 1px solid #e9ecef;
    display: block;
}

/* Visual tree connectors */
.tree-category::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e9ecef;
}

.tree-subcategory::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e9ecef;
}

.tree-task::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e9ecef;
}

/* Form styling */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-label .text-danger {
    color: #dc3545;
}

/* Modal styling */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
}

/* Form control styling */
.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Readonly input styling */
.form-control[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Card styling - removed for plain tree style */

/* Breadcrumb styling - Minimized */
.breadcrumb-nav {
    margin-bottom: 0;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

.breadcrumb.small {
    font-size: 0.8rem;
    padding: 0.25rem 0;
}

.breadcrumb-item a {
    color: #0d6efd;
    text-decoration: none;
    font-size: inherit;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: #6c757d;
    font-size: inherit;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    padding: 0 0.5rem;
    color: #6c757d;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.progress-container {
    width: 200px;
    height: 4px;
    background-color: #fff;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background-color: #0d6efd;
    animation: progress-animation 1.5s ease-in-out infinite;
}

@keyframes progress-animation {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 70%;
        margin-left: 15%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

.loading-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Drag and drop styles */
.drag-handle {
    cursor: grab;
    color: #6c757d;
    margin-right: 0.5rem;
    padding: 0.25rem 0.15rem;
    font-size: 0.875rem;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drag-handle:hover {
    opacity: 1;
    color: #0d6efd;
}

.drag-handle:active {
    cursor: grabbing;
    opacity: 1;
}

.tree-item-content:hover .drag-handle {
    opacity: 0.8;
}

.tree-item-content:hover .drag-handle:hover {
    opacity: 1;
}

/* Sortable states */
.sortable-ghost {
    opacity: 0.4;
    background-color: #e7f1ff;
}

.sortable-chosen {
    background-color: #e7f1ff;
}

.sortable-drag {
    opacity: 0.8;
}

/* Disable drag handle on inactive items */
.tree-item-content.inactive .drag-handle {
    opacity: 0.3;
    cursor: not-allowed;
}

.tree-item-content.inactive:hover .drag-handle {
    opacity: 0.3;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .checklist-tree {
        padding: 1rem;
    }
    
    .tree-item-content {
        flex-wrap: wrap;
        padding: 0.5rem;
    }
    
    .tree-item-actions {
        width: 100%;
        margin-top: 0.5rem;
        padding-left: 2rem;
        justify-content: flex-start;
    }
    
    .tree-category .tree-item-content {
        padding-left: 0.5rem;
    }
    
    .tree-subcategory {
        margin-left: 1rem;
        padding-left: 0.75rem;
    }
    
    .tree-task {
        margin-left: 1rem;
        padding-left: 0.75rem;
    }
    
    .tree-category .tree-children {
        padding-left: 1rem;
    }
    
    .tree-subcategory .tree-children {
        padding-left: 1rem;
    }
}

/* Toast notification styles */
.toast {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.toast-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.toast-icon {
    margin-right: 8px;
}

/* Category Delete Confirmation Modal Styles */
#categoryDeleteConfirmModal .modal-header.bg-warning {
    background-color: #ffc107 !important;
    color: #000;
}

#categoryDeleteConfirmModal .modal-header.bg-warning .btn-close {
    filter: invert(1);
}

#categoryDeleteConfirmModal #deleteConfirmInput {
    font-weight: 500;
    letter-spacing: 0.5px;
}

#categoryDeleteConfirmModal #deleteConfirmInput:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

#categoryDeleteConfirmModal #confirmDeleteCategoryBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}