.checklist-wrapper {
    font-family: Arial, sans-serif;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    max-width: 700px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.checklist-title {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.checklist-progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 25px;
    margin-bottom: 25px;
    height: 30px; /* Increased height */
    overflow: hidden; /* Ensures inner bar stays within rounded corners */
    position: relative; /* For text positioning */
}

.checklist-progress-bar {
    height: 100%;
    background-color: #4CAF50; /* Green */
    border-radius: 25px; /* Match container */
    text-align: center;
    line-height: 30px; /* Vertically center text */
    color: white;
    font-weight: bold;
    transition: width 0.5s ease-in-out;
    position: relative; /* For text positioning */
}

.checklist-progress-bar span {
    position: absolute;
    width: 100%;
    left: 0;
    font-size: 14px;
}

.checklist-items {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.checklist-item {
    background-color: #fff;
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    display: flex;
    flex-direction: column; /* Stack content and due date */
    justify-content: space-between;
    align-items: flex-start; /* Align items to the start */
    transition: background-color 0.3s ease;
    position: relative; /* For strikethrough line */
}

.checklist-item .task-content {
    display: flex;
    align-items: center; /* Align checkbox and description */
    width: 100%; /* Take full width */
    margin-bottom: 8px; /* Space between content and due date */
}

.checklist-item input[type="checkbox"] {
    margin-right: 15px;
    width: 20px; /* Larger checkbox */
    height: 20px;
    cursor: pointer;
    flex-shrink: 0; /* Prevent checkbox from shrinking */
}

.checklist-item .task-description {
    font-size: 18px;
    color: #555;
    font-weight: bold; /* Bolder task description */
    line-height: 1.4;
    flex-grow: 1; /* Allow description to take available space */
}

.checklist-item .task-due-date {
    font-size: 14px;
    color: #777;
    font-style: italic;
    align-self: flex-end; /* Align due date to the right */
}

/* Strikethrough for completed items */
.checklist-item.completed .task-description {
    text-decoration: none; /* Remove default text-decoration to use pseudo-element */
    color: #888;
    position: relative; /* Needed for pseudo-element positioning */
}

.checklist-item.completed .task-description::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 0%; /* Start with 0 width for animation */
    height: 2px; /* Thickness of the line */
    background-color: #555; /* Color of the line */
    animation: strikethrough-animation 0.5s ease forwards;
}

/* Animation for strikethrough */
@keyframes strikethrough-animation {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

/* Optimistic update style (before server confirmation) */
.checklist-item.completed-optimistic .task-description {
    text-decoration: line-through;
    text-decoration-color: #aaa; /* Lighter color for optimistic */
    color: #aaa;
}

/* Hover effect for items */
.checklist-item:hover {
    background-color: #f0f0f0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .checklist-title {
        font-size: 22px;
    }
    .checklist-item .task-description {
        font-size: 16px;
    }
    .checklist-item .task-due-date {
        font-size: 12px;
    }
    .checklist-item {
        padding: 10px;
    }
}
