/* --- Task View --- */
.task-view {
    flex-grow: 1;
    padding: 2px;
    overflow-y: auto;
    overflow-x: hidden;
}
#current-project-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    flex-grow: 1;
}
.task-list-root {
    list-style: none;
    padding-bottom: 50px;
}
.task-item {
    display: block;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    border-radius: 4px;
    
    scroll-margin-top: 100px;
    scroll-margin-bottom: 20px;
}
.task-content {
    display: flex;
    align-items: flex-start;
    flex-grow: 1;
    padding: 6px 4px;
    border-radius: 4px;
    max-width: 100%;
    box-sizing: border-box; 
    border: 2px solid transparent;
}

/* --- SELECTED TASK STYLE --- */

/* 1. Outer Box (Blue Border) - Only for the immediate content */
.task-item.selected > .task-content {
    border-color: #0052cc;
    box-shadow: none; 
}

/* 2. Title Box (Green Background) - STRICT CHILD SELECTOR */
/* Was: .task-item.selected .task-text (matched all descendants) */
.task-item.selected > .task-content > .task-details > .task-text {
    border-color: #4CAF50; 
    background-color: rgba(76, 175, 80, 0.1); 
}

/* --- Description Visibility Logic --- */
.task-description {
    display: none;
    font-size: 0.9em;
    color: var(--color-text-alt);
    padding-left: 6px; 
    margin-top: 2px;
    border-radius: 4px;
    cursor: text; 
}

/* 3. Description Expand - STRICT CHILD SELECTOR */
.task-item.selected > .task-content > .task-details > .task-description {
    display: block; 
    overflow: visible;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: unset;
    min-height: 1.6em; 
}

.task-item.selected > .task-content > .task-details > .task-description:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* --- Description Indicator (Emoji) --- */
.desc-indicator {
    display: inline-block;
    background-color: #FFF3E0; 
    border: 1px solid #FFCC80;
    border-radius: 3px;
    padding: 0 4px;
    margin-right: 6px;
    font-size: 0.8em;
    vertical-align: middle;
    cursor: help;
}

/* 4. Hide Indicator - STRICT CHILD SELECTOR */
.task-item.selected > .task-content > .task-details > .task-text .desc-indicator {
    display: none;
}

/* --- collapsed state --- */
.task-item.collapsed>.task-content {
    background-color: var(--color-bg-collapsed);
}

/* --- Visual confirmation state (Striped Hazard) --- */
.task-item.confirming-completion > .task-content {
    background-image: repeating-linear-gradient(
        45deg,
        #E8F5E9,
        #E8F5E9 10px,
        #C8E6C9 10px,
        #C8E6C9 20px
    ) !important;
    border-color: #2E7D32 !important;      
    color: #1B5E20;                        
}

/* --- Collapse Toggle --- */
.collapse-toggle {
    width: var(--indent-size);
    height: 22px;
    flex-shrink: 0;
    font-size: 0.8em;
    padding-left: 6px;
    padding-top: 2px;
    color: var(--color-text-alt);
    cursor: pointer;
    font-family: monospace;
}
.collapse-toggle:hover {
    color: var(--color-text);
}
.collapse-toggle.hidden {
    visibility: hidden;
}
.task-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-text-alt);
    border-radius: 50%;
    margin-right: 12px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s;
}
.task-checkbox:hover {
    border-color: var(--color-accent);
    background-color: #FDF0EE;
}
/* --- Text & Details --- */
.task-details {
    flex-grow: 1;
    user-select: text;
    min-width: 0;
    overflow: hidden;
}
.task-text {
    flex-grow: 1;
    transition: color 0.2s, text-decoration 0.2s;
    overflow: hidden;
    word-wrap: break-word;
    border: 1px solid transparent; 
    padding: 1px 4px;
    border-radius: 4px;
}
.task-text hr {
    margin-top: 12px;
    margin-bottom: 0;
    width: 100%;
}
/* FIX: Display inline to prevent line break between Emoji and Text */
.task-text p {
    margin: 0;
    display: inline;
}
.task-description p {
    margin: 0;
}
/* --- Inline Edit --- */
.inline-edit-input {
    width: 100%;
    font-family: inherit;
    font-size: 1em;
    padding: 0;
    border: none;
    outline: 1px solid #0052cc;
    border-radius: 2px;
    line-height: 1.5;
    margin: 0;
}
/* --- Subtask container --- */
.subtask-list {
    list-style: none;
    padding-left: 0; 
    margin-top: 6px;
}
.subtask-list > .task-item {
    padding-left: var(--indent-size);
}
@media (max-width: 768px) {
    .mobile-drag-mode .task-item {
        cursor: grab;
        user-select: none;
    }
    .mobile-drag-mode .task-item * {
        user-select: none;
    }
    .mobile-drag-mode .task-item.dragging {
        cursor: grabbing;
    }
}
/* --- Stronger Blink Animation --- */
@keyframes highlight-pulse {
    0% { background-color: rgba(248, 225, 59, 0.85); }   
    50% { background-color: rgba(248, 225, 59, 0.3); }    
    100% { background-color: rgba(248, 225, 59, 0.85); }  
}
.task-item.highlight-blink>.task-content {
    animation: highlight-pulse 0.6s ease-in-out 1.8;
}
