body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1em;
}

.container {
    max-width: 800px;
    margin: 2em auto;
    padding: 0 1em;
}

.checklist {
    background: white;
    padding: 2em;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.checklist h2 {
    color: #2c3e50;
    margin-bottom: 1em;
}

.checklist-item {
    margin-bottom: 1.5em;
    padding: 1em;
    border-bottom: 1px solid #eee;
    cursor: move;
}

.task-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.5em;
    gap: 10px;
}

.subtask-menu {
    margin-top: 0.5em;
    padding-left: 1em;
    border-left: 2px solid #ddd;
}

.subtask-list {
    margin-left: 1em;
    margin-top: 0.5em;
}

.subtask-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5em;
    gap: 10px;
    cursor: move;
}

.checklist-item input[type="checkbox"],
.subtask-item input[type="checkbox"] {
    margin-right: 1em;
}

.checklist-item label,
.subtask-item label {
    font-size: 1.1em;
    flex-grow: 1;
}

.completed {
    text-decoration: line-through;
    color: #888;
}

.delete-btn, .edit-btn, .toggle-subtask-btn, .checklist-control-btn, .delete-subtask-btn, .edit-subtask-btn, .delete-subchecklist-btn, .edit-subchecklist-btn {
    margin-left: 0.5em;
    padding: 0.3em 0.6em;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
}

.delete-btn, .delete-subtask-btn, .delete-subchecklist-btn {
    background-color: #e74c3c;
    color: white;
}

.delete-btn:hover, .delete-subtask-btn:hover, .delete-subchecklist-btn:hover {
    background-color: #c0392b;
}

.edit-btn, .edit-subtask-btn, .edit-subchecklist-btn {
    background-color: #3498db;
    color: white;
}

.edit-btn:hover, .edit-subtask-btn:hover, .edit-subchecklist-btn:hover {
    background-color: #2980b9;
}

.toggle-subtask-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
}

.toggle-subtask-btn:hover {
    background-color: #e0e0e0;
}

.checklist-control-btn {
    background-color: #2c3e50;
    color: white;
    padding: 0.5em 1em;
}

.checklist-control-btn:hover {
    background-color: #34495e;
}

.add-task, .add-subtask {
    margin: 1em 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.add-task input[type="text"],
.add-subtask input[type="text"] {
    padding: 0.5em;
    width: 60%;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.add-task select {
    padding: 0.5em;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.add-task button,
.add-subtask button {
    padding: 0.5em 1em;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.add-task button:hover,
.add-subtask button:hover {
    background-color: #34495e;
}

.auth-btn {
    margin: 1em 0;
    padding: 0.5em 1em;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.login {
    background-color: #27ae60;
    color: white;
}

.logout {
    background-color: #e67e22;
    color: white;
}

#checklist-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#current-checklist-display {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #e0f7fa;
    border: 1px solid #00acc1;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 10px;
}

#current-checklist-display span {
    flex-grow: 1;
}

#toggle-checklist-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
    padding: 0.3em 0.6em;
    border-radius: 3px;
    cursor: pointer;
}

#toggle-checklist-btn:hover {
    background-color: #e0e0e0;
}

#checklist-list, #subchecklist-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    display: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

#checklist-list.show, #subchecklist-list.show {
    display: block;
}

#checklist-list li, #subchecklist-list li {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    cursor: move;
    gap: 10px;
}

#checklist-list li:last-child, #subchecklist-list li:last-child {
    border-bottom: none;
}

#checklist-list li.current, #subchecklist-list li.current {
    background-color: #e0f7fa;
    border-color: #00acc1;
}

#checklist-list li span, #subchecklist-list li span {
    flex-grow: 1;
}

#subchecklist-menu {
    margin-top: 1em;
    padding-left: 1em;
    border-left: 2px solid #ddd;
}

@media (max-width: 600px) {
    .container {
        margin: 1em;
        padding: 0 0.5em;
    }

    .checklist-item {
        padding: 0.5em;
    }

    .add-task input[type="text"],
    .add-subtask input[type="text"],
    .add-task select {
        width: 50%;
    }

    .task-header {
        flex-wrap: wrap;
    }

    .delete-btn, .edit-btn, .toggle-subtask-btn, .checklist-control-btn, .delete-subtask-btn, .edit-subtask-btn, .delete-subchecklist-btn, .edit-subchecklist-btn {
        margin-top: 0.5em;
    }

    #checklist-controls {
        flex-direction: column;
        align-items: stretch;
    }

    #checklist-controls button {
        width: 100%;
        margin-bottom: 0.5em;
    }

    #checklist-list li, #subchecklist-list li {
        flex-direction: column;
        align-items: stretch;
    }
}
