/* --- 全局和容器样式 --- */
.todo-widget-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.todo-widget-container:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* --- 输入区域 --- */
.todo-input-area {
    display: flex;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.todo-input-area:focus-within {
    border-color: #007bff;
}

.todo-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: none;
    font-size: 16px;
    outline: none;
}

.todo-add-btn {
    padding: 10px 15px;
    border: none;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-add-btn:hover {
    background-color: #0056b3;
}

/* --- 控制区域 --- */
.todo-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.todo-stats {
    font-weight: 500;
}

.clear-completed-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.clear-completed-btn:hover {
    background-color: #f8d7da;
}

/* --- 待办事项列表 --- */
.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    border-radius: 8px;
    margin-bottom: 5px;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    animation: fadeIn 0.4s ease;
}

.todo-item:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

/* 自定义复选框 */
.todo-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ced4da;
    border-radius: 5px;
    margin-right: 12px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.todo-checkbox:checked {
    background-color: #28a745;
    border-color: #28a745;
}

.todo-checkbox:checked::after {
    content: '✔';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

.todo-text {
    flex-grow: 1;
    cursor: text;
    padding: 2px 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.todo-text:hover {
    background-color: rgba(0,0,0,0.05);
}

.todo-text[contenteditable="true"]:focus {
    outline: 2px solid #007bff;
    background-color: #fff;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: #6c757d;
}

.todo-delete-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    opacity: 0;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.todo-item:hover .todo-delete-btn {
    opacity: 1;
}

.todo-delete-btn:hover {
    background-color: #f8d7da;
    transform: scale(1.1);
}

/* --- 空状态 --- */
.empty-state {
    text-align: center;
    padding: 30px 10px;
    color: #aaa;
    display: none; /* 默认隐藏 */
}

.empty-state p {
    margin-top: 10px;
    font-size: 16px;
}

/* --- 动画 --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 滚动条美化 --- */
.todo-list::-webkit-scrollbar {
    width: 6px;
}
.todo-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.todo-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}
.todo-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}